duplicating the list of subnets for openconnect
This commit is contained in:
+24
-16
@@ -325,13 +325,13 @@ class Bot
|
|||||||
case preg_match('~^/defaultMTU (?P<arg>\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
case preg_match('~^/defaultMTU (?P<arg>\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
||||||
$this->defaultMTU(...explode('_', $m['arg']));
|
$this->defaultMTU(...explode('_', $m['arg']));
|
||||||
break;
|
break;
|
||||||
case preg_match('~^/subnet (?P<arg>-?\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
case preg_match('~^/subnet (?P<arg>-?\d+(?:_-?\d+)?(?:_\d)?)$~', $this->input['callback'], $m):
|
||||||
$this->subnet(...explode('_', $m['arg']));
|
$this->subnet(...explode('_', $m['arg']));
|
||||||
break;
|
break;
|
||||||
case preg_match('~^/subnetAdd (?P<arg>-?\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
case preg_match('~^/subnetAdd (?P<arg>-?\d+(?:_-?\d+)?(?:_-?\d+)?)$~', $this->input['callback'], $m):
|
||||||
$this->subnetAdd(...explode('_', $m['arg']));
|
$this->subnetAdd(...explode('_', $m['arg']));
|
||||||
break;
|
break;
|
||||||
case preg_match('~^/subnetDelete (?P<arg>-?\d+(?:_-?\d+)?(?:_-?\d+)?)$~', $this->input['callback'], $m):
|
case preg_match('~^/subnetDelete (?P<arg>-?\d+(?:_-?\d+)?(?:_-?\d+)?(?:_-?\d+)?)$~', $this->input['callback'], $m):
|
||||||
$this->subnetDelete(...explode('_', $m['arg']));
|
$this->subnetDelete(...explode('_', $m['arg']));
|
||||||
break;
|
break;
|
||||||
case preg_match('~^/addSubnets (?P<arg>-?\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
case preg_match('~^/addSubnets (?P<arg>-?\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
|
||||||
@@ -3112,7 +3112,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->menu('client', "{$client}_$page");
|
$this->menu('client', "{$client}_$page");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function subnetAdd($wgpage, $page)
|
public function subnetAdd($wgpage, $page, $openconnect)
|
||||||
{
|
{
|
||||||
$r = $this->send(
|
$r = $this->send(
|
||||||
$this->input['chat'],
|
$this->input['chat'],
|
||||||
@@ -3124,11 +3124,11 @@ DNS-over-HTTPS with IP:
|
|||||||
'start_message' => $this->input['message_id'],
|
'start_message' => $this->input['message_id'],
|
||||||
'start_callback' => $this->input['callback_id'],
|
'start_callback' => $this->input['callback_id'],
|
||||||
'callback' => 'subnetSave',
|
'callback' => 'subnetSave',
|
||||||
'args' => [$wgpage, $page],
|
'args' => [$wgpage, $page, $openconnect],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function subnetSave($text, $wgpage, $page)
|
public function subnetSave($text, $wgpage, $page, $openconnect)
|
||||||
{
|
{
|
||||||
$c = $this->getPacConf();
|
$c = $this->getPacConf();
|
||||||
$subnets = explode(',', $text);
|
$subnets = explode(',', $text);
|
||||||
@@ -3137,15 +3137,15 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->setPacConf($c);
|
$this->setPacConf($c);
|
||||||
$page = floor(count($c['subnets']) / $this->limit);
|
$page = floor(count($c['subnets']) / $this->limit);
|
||||||
}
|
}
|
||||||
$this->subnet($wgpage, $page);
|
$this->subnet($wgpage, $page, $openconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function subnetDelete($wgpage, $k, $page = 0)
|
public function subnetDelete($wgpage, $k, $page = 0, $openconnect = 0)
|
||||||
{
|
{
|
||||||
$c = $this->getPacConf();
|
$c = $this->getPacConf();
|
||||||
unset($c['subnets'][$k]);
|
unset($c['subnets'][$k]);
|
||||||
$this->setPacConf($c);
|
$this->setPacConf($c);
|
||||||
$this->subnet($wgpage, $page);
|
$this->subnet($wgpage, $page, $openconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function calc()
|
public function calc()
|
||||||
@@ -3201,10 +3201,10 @@ DNS-over-HTTPS with IP:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function subnet($wgpage = 0, $page = 0, $count = 5)
|
public function subnet($wgpage = 0, $page = 0, $openconnect = 0)
|
||||||
{
|
{
|
||||||
$count = $this->limit;
|
$count = $this->limit;
|
||||||
$text = "Menu -> Wireguard -> " . $this->i18n('listSubnet') . "\n";
|
$text = 'Menu -> ' . ($openconnect ? 'Openconnect' : 'Wireguard') . ' -> ' . $this->i18n('listSubnet') . "\n";
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('calc'),
|
'text' => $this->i18n('calc'),
|
||||||
@@ -3214,7 +3214,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('add'),
|
'text' => $this->i18n('add'),
|
||||||
'callback_data' => "/subnetAdd {$wgpage}_$page",
|
'callback_data' => "/subnetAdd {$wgpage}_{$page}_$openconnect",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$subnets = $this->getPacConf()['subnets'];
|
$subnets = $this->getPacConf()['subnets'];
|
||||||
@@ -3227,7 +3227,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('delete') . " $v",
|
'text' => $this->i18n('delete') . " $v",
|
||||||
'callback_data' => "/subnetDelete {$wgpage}_{$k}_$page",
|
'callback_data' => "/subnetDelete {$wgpage}_{$k}_{$page}_$openconnect",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -3235,11 +3235,11 @@ DNS-over-HTTPS with IP:
|
|||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => '<<',
|
'text' => '<<',
|
||||||
'callback_data' => "/subnet {$wgpage}_" . ($page - 1 >= 0 ? $page - 1 : $all - 1),
|
'callback_data' => "/subnet {$wgpage}_" . ($page - 1 >= 0 ? $page - 1 : $all - 1) . ($openconnect ? '_1' : ''),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => '>>',
|
'text' => '>>',
|
||||||
'callback_data' => "/subnet {$wgpage}_" . ($page < $all - 1 ? $page + 1 : 0),
|
'callback_data' => "/subnet {$wgpage}_" . ($page < $all - 1 ? $page + 1 : 0) . ($openconnect ? '_1' : ''),
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -3247,7 +3247,7 @@ DNS-over-HTTPS with IP:
|
|||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('back'),
|
'text' => $this->i18n('back'),
|
||||||
'callback_data' => "/menu wg $wgpage",
|
'callback_data' => $openconnect ? '/menu oc' : "/menu wg $wgpage",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$this->update(
|
$this->update(
|
||||||
@@ -4961,11 +4961,19 @@ DNS-over-HTTPS with IP:
|
|||||||
'text' => $this->i18n('change password'),
|
'text' => $this->i18n('change password'),
|
||||||
'callback_data' => "/changeOcPass",
|
'callback_data' => "/changeOcPass",
|
||||||
],
|
],
|
||||||
|
];
|
||||||
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('dns') . ": $dns",
|
'text' => $this->i18n('dns') . ": $dns",
|
||||||
'callback_data' => "/changeOcDns",
|
'callback_data' => "/changeOcDns",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
$data[] = [
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('listSubnet'),
|
||||||
|
'callback_data' => "/subnet 0_0_1",
|
||||||
|
],
|
||||||
|
];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('expose-iroutes') . ' ' . $this->i18n($expose ? 'on' : 'off'),
|
'text' => $this->i18n('expose-iroutes') . ' ' . $this->i18n($expose ? 'on' : 'off'),
|
||||||
|
|||||||
Reference in New Issue
Block a user