diff --git a/app/bot.php b/app/bot.php index b325394..76661d9 100644 --- a/app/bot.php +++ b/app/bot.php @@ -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)], ], [ diff --git a/version b/version index 48790cf..4814c31 100644 --- a/version +++ b/version @@ -1,3 +1,5 @@ +30.10.2024 v1.92 +- возможность скачать origin шаблон 30.10.2024 v1.91 - кнопка nip.io для быстрой смены домена 27.10.2024 v1.90