diff --git a/app/bot.php b/app/bot.php
index f085486..5060071 100644
--- a/app/bot.php
+++ b/app/bot.php
@@ -149,6 +149,9 @@ class Bot
case preg_match('~^/qr (\d+)$~', $this->input['callback'], $m):
$this->qrPeer($m[1]);
break;
+ case preg_match('~^/qrSS$~', $this->input['callback'], $m):
+ $this->qrSS();
+ break;
case preg_match('~^/delupstream (\d+)$~', $this->input['callback'], $m):
$this->delupstream($m[1]);
break;
@@ -471,6 +474,24 @@ class Bot
unlink($qr_file);
}
+ public function qrSS()
+ {
+ $conf = $this->getPacConf();
+ $ip = file_get_contents('https://ipinfo.io/ip');
+ $domain = $conf['domain'] ?: $ip;
+ $scheme = empty($ssl = $this->nginxGetTypeCert()) ? 'http' : 'https';
+ $ss = $this->getSSConfig();
+ $port = !empty($ssl) && !empty($ss['plugin']) ? 443 : 8388;
+ $ss_link = 'ss://' . base64_encode("{$ss['method']}:{$ss['password']}@$domain:$port");
+ $qr_file = __DIR__ . "/qr/shadowsocks.png";
+ exec("qrencode -t png -o $qr_file '$ss_link'");
+ $r = $this->sendPhoto(
+ $this->input['chat'],
+ curl_file_create($qr_file),
+ );
+ unlink($qr_file);
+ }
+
public function upload($name, $code)
{
$path = "/logs/$name";
@@ -1493,6 +1514,8 @@ DNS-over-HTTPS with IP:
'callback_data' => "/sspswd",
],
];
+ $ss_link = 'ss://' . base64_encode("{$ss['method']}:{$ss['password']}@$domain:$port");
+ $text .= "\n\n$ss_link\n";
$text .= "\n\nserver: $domain:$port";
$text .= "\n\nmethod: {$ss['method']}";
$text .= "\n\nnameserver: 10.10.0.5";
@@ -1506,6 +1529,12 @@ DNS-over-HTTPS with IP:
'callback_data' => "/v2ray",
],
];
+ $data[] = [
+ [
+ 'text' => 'show QR',
+ 'callback_data' => "/qrSS",
+ ],
+ ];
$data[] = [
[
'text' => 'back',