Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ef0de6e1c | |||
| 1cf24407c0 |
+33
-1
@@ -401,6 +401,9 @@ class Bot
|
||||
case preg_match('~^/deldomain$~', $this->input['callback'], $m):
|
||||
$this->delDomain();
|
||||
break;
|
||||
case preg_match('~^/addNipdomain$~', $this->input['callback'], $m):
|
||||
$this->addNipdomain();
|
||||
break;
|
||||
case preg_match('~^/(?P<action>change|delete)(?P<typelist>\w+) (?P<arg>\d+)$~', $this->input['callback'], $m):
|
||||
$this->listPacChange($m['typelist'], $m['action'], $m['arg']);
|
||||
break;
|
||||
@@ -452,6 +455,9 @@ class Bot
|
||||
case preg_match('~^/delTemplate (\w+)(?: (.+))?$~', $this->input['callback'], $m):
|
||||
$this->delTemplate($m[1], $m[2]);
|
||||
break;
|
||||
case preg_match('~^/downloadOrigin (\w+)$~', $this->input['callback'], $m):
|
||||
$this->downloadOrigin($m[1]);
|
||||
break;
|
||||
case preg_match('~^/downloadTemplate (\w+)(?: (.+))?$~', $this->input['callback'], $m):
|
||||
$this->downloadTemplate($m[1], $m[2]);
|
||||
break;
|
||||
@@ -1765,6 +1771,11 @@ class Bot
|
||||
}
|
||||
}
|
||||
|
||||
public function addNipdomain()
|
||||
{
|
||||
$this->addDomain(str_replace('.', '-', $this->ip) . '.nip.io');
|
||||
}
|
||||
|
||||
public function addDomain($domain, $nomenu = false)
|
||||
{
|
||||
$domain = trim($domain);
|
||||
@@ -4407,6 +4418,19 @@ DNS-over-HTTPS with IP:
|
||||
$this->templates($type);
|
||||
}
|
||||
|
||||
public function downloadOrigin($type)
|
||||
{
|
||||
switch ($type) {
|
||||
case 'sing':
|
||||
$f = new \CURLFile('/config/sing.json', 'application/json', 'origin.json');
|
||||
break;
|
||||
case 'v2ray':
|
||||
$f = new \CURLFile('/config/v2ray.json', 'application/json', 'origin.json');
|
||||
break;
|
||||
}
|
||||
$this->sendFile($this->input['chat'], $f);
|
||||
}
|
||||
|
||||
public function downloadTemplate($type, $name)
|
||||
{
|
||||
$pac = $this->getPacConf();
|
||||
@@ -4445,6 +4469,10 @@ DNS-over-HTTPS with IP:
|
||||
'text' => "origin",
|
||||
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&ty=$type"],
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('download'),
|
||||
'callback_data' => "/downloadOrigin $type",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n($pac["default{$type}template"] && !empty($pac["{$type}templates"][base64_decode($pac["default{$type}template"])]) ? 'off' : 'on'),
|
||||
'callback_data' => "/defaultTemplate $type",
|
||||
@@ -4453,7 +4481,7 @@ DNS-over-HTTPS with IP:
|
||||
foreach ($templates as $k => $v) {
|
||||
$data[] = [
|
||||
[
|
||||
'text' => "$k",
|
||||
'text' => $k,
|
||||
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&ty=$type&te=" . urlencode($k)],
|
||||
],
|
||||
[
|
||||
@@ -5598,6 +5626,10 @@ DNS-over-HTTPS with IP:
|
||||
'text' => $this->i18n('+ subdomain'),
|
||||
'callback_data' => '/addSubdomain',
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('nip.io'),
|
||||
'callback_data' => '/addNipdomain',
|
||||
],
|
||||
],
|
||||
];
|
||||
if ($conf['domain']) {
|
||||
|
||||
Reference in New Issue
Block a user