warp+ set key
This commit is contained in:
+64
-4
@@ -368,6 +368,12 @@ class Bot
|
||||
case preg_match('~^/domain$~', $this->input['callback'], $m):
|
||||
$this->domain();
|
||||
break;
|
||||
case preg_match('~^/warp$~', $this->input['callback'], $m):
|
||||
$this->warp();
|
||||
break;
|
||||
case preg_match('~^/warpPlus$~', $this->input['callback'], $m):
|
||||
$this->warpPlus();
|
||||
break;
|
||||
case preg_match('~^/xray(?: (\d+))?$~', $this->input['callback'], $m):
|
||||
$this->xray($m[1] ?: 0);
|
||||
break;
|
||||
@@ -3275,8 +3281,8 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/menu ss",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('mirror'),
|
||||
'callback_data' => "/menu mirror",
|
||||
'text' => $this->i18n('warp'),
|
||||
'callback_data' => "/warp",
|
||||
],
|
||||
],
|
||||
[
|
||||
@@ -3837,6 +3843,59 @@ DNS-over-HTTPS with IP:
|
||||
);
|
||||
}
|
||||
|
||||
public function warpPlus()
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} enter key",
|
||||
$this->input['message_id'],
|
||||
reply: 'enter key',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
'start_callback' => $this->input['callback_id'],
|
||||
'callback' => 'addWarpPlus',
|
||||
'args' => [],
|
||||
];
|
||||
}
|
||||
|
||||
public function addWarpPlus($key)
|
||||
{
|
||||
$c = $this->getPacConf();
|
||||
$c['warp'] = $key;
|
||||
$this->setPacConf($c);
|
||||
$this->send($this->input['chat'], 'Warp registration license: ' . $this->ssh("warp-cli --accept-tos registration license $key", 'wp'));
|
||||
sleep(1);
|
||||
$this->warp();
|
||||
}
|
||||
|
||||
public function warp()
|
||||
{
|
||||
$st = $this->ssh('curl -x socks5://127.0.0.1:40000 https://cloudflare.com/cdn-cgi/trace', 'wp');
|
||||
preg_match('~warp=(\w+)~', $st, $m);
|
||||
$text[] = "Menu -> " . $this->i18n('warp');
|
||||
$text[] = "status: {$m['1']}";
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('set key'),
|
||||
'callback_data' => "/warpPlus",
|
||||
],
|
||||
];
|
||||
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/menu",
|
||||
],
|
||||
];
|
||||
$this->update(
|
||||
$this->input['chat'],
|
||||
$this->input['message_id'],
|
||||
implode("\n", $text ?: ['...']),
|
||||
$data ?: false,
|
||||
);
|
||||
}
|
||||
|
||||
public function choiceTemplate($arg)
|
||||
{
|
||||
$arg = explode('_', $arg);
|
||||
@@ -5059,8 +5118,9 @@ DNS-over-HTTPS with IP:
|
||||
fclose($s);
|
||||
ssh2_disconnect($c);
|
||||
} catch (Exception | Error $e) {
|
||||
$this->send($this->input['chat'], $e->getMessage(), $this->input['message_id']);
|
||||
die();
|
||||
if (!empty($GLOBALS['debug'])) {
|
||||
$this->send($this->input['chat'], $e->getMessage(), $this->input['message_id']);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?php
|
||||
|
||||
$i = [
|
||||
'warp' => [
|
||||
'en' => 'Warp',
|
||||
'ru' => 'Warp',
|
||||
],
|
||||
'wg_title' => [
|
||||
'en' => 'Wireguard',
|
||||
'ru' => 'Wireguard',
|
||||
|
||||
+3
-1
@@ -2,10 +2,12 @@
|
||||
|
||||
require __DIR__ . '/timezone.php';
|
||||
|
||||
// require __DIR__ . '/debug.php';
|
||||
require __DIR__ . '/bot.php';
|
||||
require __DIR__ . '/config.php';
|
||||
require __DIR__ . '/i18n.php';
|
||||
if ($c['debug']) {
|
||||
require __DIR__ . '/debug.php';
|
||||
}
|
||||
|
||||
$bot = new Bot($c['key'], $i);
|
||||
$bot->adguardProtect();
|
||||
|
||||
+4
-1
@@ -2,11 +2,14 @@
|
||||
|
||||
require __DIR__ . '/timezone.php';
|
||||
|
||||
// require __DIR__ . '/debug.php';
|
||||
require __DIR__ . '/bot.php';
|
||||
require __DIR__ . '/config.php';
|
||||
require __DIR__ . '/i18n.php';
|
||||
|
||||
if ($c['debug']) {
|
||||
require __DIR__ . '/debug.php';
|
||||
}
|
||||
|
||||
$bot = new Bot($c['key'], $i);
|
||||
|
||||
if (!empty($c['admin'])) {
|
||||
|
||||
+1
-1
@@ -491,7 +491,7 @@ services:
|
||||
ipv4_address: 10.10.0.12
|
||||
logging: *default-logging
|
||||
wp:
|
||||
image: mercurykd/vpnbot-wp:1
|
||||
image: mercurykd/vpnbot-wp:1.1
|
||||
build:
|
||||
dockerfile: dockerfile/warp.dockerfile
|
||||
args:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
FROM ubuntu:22.04
|
||||
RUN apt update && apt install -y curl gpg socat lsb-release \
|
||||
RUN apt update && apt install -y curl gpg socat jq lsb-release openssh-server \
|
||||
&& curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg \
|
||||
&& echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/cloudflare-client.list \
|
||||
&& apt update && apt install -y cloudflare-warp
|
||||
&& apt update && apt install -y cloudflare-warp \
|
||||
&& mkdir /root/.ssh
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||
echo 'HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
|
||||
echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
|
||||
service ssh start
|
||||
warp-svc > /dev/null &
|
||||
sleep 3
|
||||
warp-cli --accept-tos registration new
|
||||
key=$(cat /config/pac.json | jq -r .warp)
|
||||
if [ ! -z "$key" ]
|
||||
then
|
||||
warp-cli --accept-tos registration license $key
|
||||
fi
|
||||
warp-cli --accept-tos mode proxy
|
||||
warp-cli --accept-tos connect
|
||||
socat TCP-LISTEN:4000,fork TCP:127.0.0.1:40000
|
||||
|
||||
Reference in New Issue
Block a user