improve qr
This commit is contained in:
+74
-11
@@ -230,6 +230,12 @@ class Bot
|
||||
case preg_match('~^/qrSS$~', $this->input['callback'], $m):
|
||||
$this->qrSS();
|
||||
break;
|
||||
case preg_match('~^/qrXray$~', $this->input['callback'], $m):
|
||||
$this->qrXray();
|
||||
break;
|
||||
case preg_match('~^/qrMtproto$~', $this->input['callback'], $m):
|
||||
$this->qrMtproto();
|
||||
break;
|
||||
case preg_match('~^/delupstream (\d+)$~', $this->input['callback'], $m):
|
||||
$this->delupstream($m[1]);
|
||||
break;
|
||||
@@ -358,6 +364,14 @@ class Bot
|
||||
$this->ssh('xray run -config /xray.json > /dev/null 2>&1 &', 'xr');
|
||||
}
|
||||
|
||||
public function linkMtproto()
|
||||
{
|
||||
$s = file_get_contents('/config/mtprotosecret');
|
||||
$p = getenv('TGPORT');
|
||||
$ip = $this->getPacConf()['domain'] ?: $this->ip;
|
||||
return "https://t.me/proxy?server=$ip&port=$p&secret=$s";
|
||||
}
|
||||
|
||||
public function mtproto()
|
||||
{
|
||||
$s = file_get_contents('/config/mtprotosecret');
|
||||
@@ -367,17 +381,7 @@ class Bot
|
||||
$text[] = "Menu -> MTProto\n";
|
||||
$text[] = "status: $st\n";
|
||||
if ($st == 'on') {
|
||||
$text[] = "<code>https://t.me/proxy?server=$ip&port=$p&secret=$s</code>\n\n<code>tg://proxy?server=$ip&port=$p&secret=$s</code>";
|
||||
$data[] = [
|
||||
[
|
||||
'text' => "https://t.me/proxy",
|
||||
'url' => "https://t.me/proxy?server=$ip&port=$p&secret=$s",
|
||||
],
|
||||
[
|
||||
'text' => "tg://proxy",
|
||||
'url' => "tg://proxy?server=$ip&port=$p&secret=$s",
|
||||
],
|
||||
];
|
||||
$text[] = "<code>{$this->linkMtproto()}</code>";
|
||||
}
|
||||
$data[] = [
|
||||
[
|
||||
@@ -391,6 +395,12 @@ class Bot
|
||||
'callback_data' => "/setSecret",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('show QR'),
|
||||
'callback_data' => "/qrMtproto",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
@@ -964,6 +974,7 @@ class Bot
|
||||
$r = $this->sendPhoto(
|
||||
$this->input['chat'],
|
||||
curl_file_create($qr_file),
|
||||
"<code>$ss_link</code>"
|
||||
);
|
||||
unlink($qr_file);
|
||||
if ($this->getPacConf()['blinkmenu']) {
|
||||
@@ -973,6 +984,42 @@ class Bot
|
||||
}
|
||||
}
|
||||
|
||||
public function qrXray()
|
||||
{
|
||||
$link = $this->linkXray();
|
||||
$qr_file = __DIR__ . "/qr/xray.png";
|
||||
exec("qrencode -t png -o $qr_file '$link'");
|
||||
$r = $this->sendPhoto(
|
||||
$this->input['chat'],
|
||||
curl_file_create($qr_file),
|
||||
"<code>$link</code>"
|
||||
);
|
||||
unlink($qr_file);
|
||||
if ($this->getPacConf()['blinkmenu']) {
|
||||
$this->delete($this->input['chat'], $this->input['message_id']);
|
||||
$this->input['message_id'] = $this->send($this->input['chat'], '.')['result']['message_id'];
|
||||
$this->xray();
|
||||
}
|
||||
}
|
||||
|
||||
public function qrMtproto()
|
||||
{
|
||||
$link = $this->linkMtproto();
|
||||
$qr_file = __DIR__ . "/qr/mtproto.png";
|
||||
exec("qrencode -t png -o $qr_file '$link'");
|
||||
$r = $this->sendPhoto(
|
||||
$this->input['chat'],
|
||||
curl_file_create($qr_file),
|
||||
"<code>$link</code>"
|
||||
);
|
||||
unlink($qr_file);
|
||||
if ($this->getPacConf()['blinkmenu']) {
|
||||
$this->delete($this->input['chat'], $this->input['message_id']);
|
||||
$this->input['message_id'] = $this->send($this->input['chat'], '.')['result']['message_id'];
|
||||
$this->mtproto();
|
||||
}
|
||||
}
|
||||
|
||||
public function upload($name, $code, $chat = false)
|
||||
{
|
||||
$path = "/logs/$name";
|
||||
@@ -2537,16 +2584,26 @@ DNS-over-HTTPS with IP:
|
||||
}
|
||||
}
|
||||
|
||||
public function linkXray()
|
||||
{
|
||||
$c = $this->getXray();
|
||||
$pac = $this->getPacConf();
|
||||
$domain = $pac['domain'] ?: $this->ip;
|
||||
return "vless://{$c['inbounds'][0]['settings']['clients'][0]['id']}@$domain:443?security=reality&sni={$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]}&fp=chrome&pbk={$pac['xray']}&sid={$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0]}&type=tcp&flow=xtls-rprx-vision#vpnbot";
|
||||
}
|
||||
|
||||
public function xray()
|
||||
{
|
||||
$c = $this->getXray();
|
||||
$pac = $this->getPacConf();
|
||||
$domain = $pac['domain'] ?: $this->ip;
|
||||
$st = $this->ssh('pgrep xray', 'xr') ? 'on' : 'off';
|
||||
$text[] = "Menu -> " . $this->i18n('xray') . "\n";
|
||||
$text[] = "uuid: <code>{$c['inbounds'][0]['settings']['clients'][0]['id']}</code>";
|
||||
$text[] = "shortId: <code>{$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0]}</code>";
|
||||
$text[] = "pubkey: <code>{$pac['xray']}</code>";
|
||||
$text[] = "fake domain: <code>{$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]}</code>";
|
||||
$text[] = "\n<code>{$this->linkXray()}</code>";
|
||||
$text[] = "\nstatus: $st";
|
||||
|
||||
$data[] = [
|
||||
@@ -2561,6 +2618,12 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/changeFakeDomain",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('show QR'),
|
||||
'callback_data' => "/qrXray",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
|
||||
Reference in New Issue
Block a user