ability to change subdomain for naiveproxy
This commit is contained in:
+40
-1
@@ -367,6 +367,9 @@ class Bot
|
||||
case preg_match('~^/changeNaiveUser$~', $this->input['callback'], $m):
|
||||
$this->changeNaiveUser();
|
||||
break;
|
||||
case preg_match('~^/changeNaiveSubdomain$~', $this->input['callback'], $m):
|
||||
$this->changeNaiveSubdomain();
|
||||
break;
|
||||
case preg_match('~^/changeNaivePass$~', $this->input['callback'], $m):
|
||||
$this->changeNaivePass();
|
||||
break;
|
||||
@@ -883,7 +886,7 @@ class Bot
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} enter login",
|
||||
$this->input['message_id'],
|
||||
reply: 'enter password',
|
||||
reply: 'enter login',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
@@ -893,6 +896,22 @@ class Bot
|
||||
];
|
||||
}
|
||||
|
||||
public function changeNaiveSubdomain()
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} enter subdomain",
|
||||
$this->input['message_id'],
|
||||
reply: 'enter subdomain',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
'start_callback' => $this->input['callback_id'],
|
||||
'callback' => 'chNpSubdomain',
|
||||
'args' => [],
|
||||
];
|
||||
}
|
||||
|
||||
public function changeNaivePass()
|
||||
{
|
||||
$r = $this->send(
|
||||
@@ -1020,6 +1039,20 @@ class Bot
|
||||
$this->menu('oc');
|
||||
}
|
||||
|
||||
public function chNpSubdomain($domain)
|
||||
{
|
||||
$pac = $this->getPacConf();
|
||||
if (!empty($data)) {
|
||||
unset($pac['np_domain']);
|
||||
} else {
|
||||
$pac['np_domain'] = $domain;
|
||||
}
|
||||
$this->setPacConf($pac);
|
||||
$this->restartNaive();
|
||||
$this->setUpstreamDomainNaive($pac['domain']);
|
||||
$this->menu('naive');
|
||||
}
|
||||
|
||||
public function chnplogin($user)
|
||||
{
|
||||
$pac = $this->getPacConf();
|
||||
@@ -4856,6 +4889,12 @@ DNS-over-HTTPS with IP:
|
||||
$text[] = "Menu -> NaiveProxy";
|
||||
$np = $this->getHashSubdomain('np');
|
||||
$text[] = "<code>https://{$pac['naive']['user']}:{$pac['naive']['pass']}@$np.$domain</code>";
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('change subdomain'),
|
||||
'callback_data' => "/changeNaiveSubdomain",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('change login'),
|
||||
|
||||
Reference in New Issue
Block a user