Compare commits

..

1 Commits

Author SHA1 Message Date
mercury 4ef0de6e1c ability to download origin template 2024-10-30 23:16:17 +04:00
2 changed files with 23 additions and 1 deletions
+21 -1
View File
@@ -455,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;
@@ -4415,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();
@@ -4453,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",
@@ -4461,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)],
],
[
+2
View File
@@ -1,3 +1,5 @@
30.10.2024 v1.92
- возможность скачать origin шаблон
30.10.2024 v1.91
- кнопка nip.io для быстрой смены домена
27.10.2024 v1.90