Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 624713347a | |||
| 52738c0491 | |||
| 277b00da87 | |||
| 455b9cea07 | |||
| 88f8c1c4c2 | |||
| 6631ea5cc2 | |||
| 09d49fd0fb | |||
| 6766a56440 | |||
| 4fb039ffc4 | |||
| 0b7ae110fc | |||
| 6fb1931c2d |
+42
-38
@@ -948,22 +948,17 @@ class Bot
|
||||
|
||||
public function checkBackup()
|
||||
{
|
||||
$c = time();
|
||||
$conf = $this->getPacConf();
|
||||
$time = $conf['backup'];
|
||||
if ($time) {
|
||||
preg_match('~(\d+\s\w+)(?:\s+)?/(?:\s+)?(\d{2}:\d{2})~', $time, $m);
|
||||
$period = strtotime($m[1]) - $c;
|
||||
$start = strtotime($m[2]);
|
||||
$last = $conf['pinbackup'];
|
||||
if ($last) {
|
||||
[$pin, $time] = explode('/', $last);
|
||||
if ($c - $time >= $period) {
|
||||
$this->pinAdmin($pin, 1);
|
||||
$this->pinBackup();
|
||||
return;
|
||||
$c = $this->getPacConf();
|
||||
$now = strtotime(date('Y-m-d H:i'));
|
||||
if (!empty($c['backup'])) {
|
||||
[$start, $period] = explode('/', $c['backup']);
|
||||
$start = strtotime($start);
|
||||
$period = strtotime($period, 0);
|
||||
(var_dump($now, $start, $period, ($now - $start) % $period));
|
||||
if ($now - $start >= $period && ($now - $start) % $period == 0) {
|
||||
if (!empty($c['pinbackup'])) {
|
||||
$this->pinAdmin($c['pinbackup'], 1);
|
||||
}
|
||||
} elseif ($c - $start > 0 && $c - $start < 30) {
|
||||
$this->pinBackup();
|
||||
}
|
||||
}
|
||||
@@ -984,10 +979,10 @@ class Bot
|
||||
require __DIR__ . '/config.php';
|
||||
$conf = $this->getPacConf();
|
||||
$bot = $this->request('getMyName', [])['result']['name'];
|
||||
$pin = $this->upload("{$bot}_export_" . date('d_m_Y_H_i') . '.json', $this->export(), $c['admin'][0])['result']['message_id'];
|
||||
$conf['pinbackup'] = "$pin/" . time();
|
||||
$conf['pinbackup'] = $this->upload("{$bot}_export_" . date('d_m_Y_H_i') . '.json', $this->export(), $c['admin'][0])['result']['message_id'];
|
||||
$conf['backup'] = implode(' / ', [date('Y-m-d H:i'), trim(explode('/', $conf['backup'])[1])]);
|
||||
$this->setPacConf($conf);
|
||||
$this->pinAdmin($pin);
|
||||
$this->pinAdmin($conf['pinbackup']);
|
||||
}
|
||||
|
||||
public function checkVersion()
|
||||
@@ -1005,7 +1000,14 @@ class Bot
|
||||
$diff = array_slice($diff, 0, 10);
|
||||
if (!empty($diff)) {
|
||||
foreach ($c['admin'] as $k => $v) {
|
||||
$this->send($v, implode("\n", $diff));
|
||||
$this->send($v, implode("\n", $diff), 0, [
|
||||
[
|
||||
[
|
||||
'text' => 'changelog',
|
||||
'web_app' => ['url' => "https://raw.githubusercontent.com/mercurykd/vpnbot/$b/version"],
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3747,7 +3749,7 @@ DNS-over-HTTPS with IP:
|
||||
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&ty=$type"],
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n($pac["default{$type}template"] && !empty($pac["{$type}templates"][$pac["default{$type}template"]]) ? 'off' : 'on'),
|
||||
'text' => $this->i18n($pac["default{$type}template"] && !empty($pac["{$type}templates"][base64_decode($pac["default{$type}template"])]) ? 'off' : 'on'),
|
||||
'callback_data' => "/defaultTemplate $type",
|
||||
],
|
||||
];
|
||||
@@ -4126,6 +4128,7 @@ DNS-over-HTTPS with IP:
|
||||
|
||||
public function subscription()
|
||||
{
|
||||
$type = $_GET['t'] == 's' ? 'v2ray' : 'sing';
|
||||
$pac = $this->getPacConf();
|
||||
$domain = $pac['domain'] ?: $this->ip;
|
||||
$xr = $this->getXray();
|
||||
@@ -4138,7 +4141,7 @@ DNS-over-HTTPS with IP:
|
||||
if (empty($v['off'])) {
|
||||
$flag = false;
|
||||
}
|
||||
$template = base64_decode($_GET['t'] == 's' ? $v['v2raytemplate'] : $v['singtemplate']);
|
||||
$template = base64_decode($v["{$type}template"]);
|
||||
$uid = $v['id'];
|
||||
break;
|
||||
}
|
||||
@@ -4181,19 +4184,19 @@ DNS-over-HTTPS with IP:
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
switch (true) {
|
||||
case !empty($template) && $template == 'origin':
|
||||
case empty($template) && empty($pac['default' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'template']):
|
||||
case empty($template) && !empty($pac['default' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'template']) && empty($pac[($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'templates'][$pac['default' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'template']]):
|
||||
$c = json_decode(file_get_contents('/config/' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . '.json'), true);
|
||||
case empty($template) && empty($pac["default{$type}template"]):
|
||||
case empty($template) && empty($pac["{$type}templates"][base64_decode($pac["default{$type}template"])]):
|
||||
case !empty($template) && empty($pac["{$type}templates"][$template]):
|
||||
$c = json_decode(file_get_contents("/config/{$type}.json"), true);
|
||||
break;
|
||||
case !empty($template):
|
||||
$c = $pac[$_GET['t'] == 's' ? 'v2raytemplates' : 'singtemplates'][$template];
|
||||
$c = $pac["{$type}templates"][$template];
|
||||
break;
|
||||
|
||||
default:
|
||||
$c = $pac[$_GET['t'] == 's' ? 'v2raytemplates' : 'singtemplates'][base64_decode($pac['default' . ($_GET['t'] == 's' ? 'v2ray' : 'sing') . 'template'])];
|
||||
$c = $pac["{$type}templates"][base64_decode($pac["default{$type}template"])];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4699,15 +4702,17 @@ DNS-over-HTTPS with IP:
|
||||
'text' => $this->i18n('export'),
|
||||
'callback_data' => "/export",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('backup') . ': ' . (implode(' / ', explode('/', $conf['backup'])) ?: $this->i18n('off')),
|
||||
'callback_data' => "/backup",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('import'),
|
||||
'callback_data' => "/import",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('backup') . ': ' . (implode(' / ', explode('/', $conf['backup'])) ?: $this->i18n('off')),
|
||||
'callback_data' => "/backup",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('logs'),
|
||||
@@ -4910,16 +4915,15 @@ DNS-over-HTTPS with IP:
|
||||
public function setBackup($text)
|
||||
{
|
||||
$text = trim($text);
|
||||
$c = $this->getPacConf();
|
||||
$c = $this->getPacConf();
|
||||
if (empty($text)) {
|
||||
$c['backup'] = '';
|
||||
} elseif (preg_match('~(\d+\s\w+)(?:\s+)?/(?:\s+)?(\d{2}:\d{2})~', $text, $m)) {
|
||||
$period = $m[1];
|
||||
$start = $m[2];
|
||||
$c['backup'] = $text;
|
||||
} else {
|
||||
[$start, $period] = explode('/', $text);
|
||||
$c['backup'] = implode(' / ', [date('Y-m-d H:i', strtotime($start)), trim($period)]);
|
||||
}
|
||||
if ($pin = explode('/', $c['pinbackup'])[0]) {
|
||||
$this->pinAdmin($pin, 1);
|
||||
if ($c['pinbackup']) {
|
||||
$this->pinAdmin($c['pinbackup'], 1);
|
||||
$c['pinbackup'] = '';
|
||||
}
|
||||
$this->setPacConf($c);
|
||||
|
||||
+11
-8
@@ -19,7 +19,7 @@ volumes:
|
||||
|
||||
services:
|
||||
up:
|
||||
image: mercurykd/vpnbot-up:1.1
|
||||
image: mercurykd/vpnbot-ng:1.1
|
||||
build:
|
||||
context: dockerfile
|
||||
dockerfile: nginx.dockerfile
|
||||
@@ -191,7 +191,7 @@ services:
|
||||
- oc
|
||||
- np
|
||||
proxy:
|
||||
image: mercurykd/vpnbot-ss:1.1
|
||||
image: mercurykd/vpnbot-ss:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/shadowsocks.dockerfile
|
||||
args:
|
||||
@@ -338,7 +338,7 @@ services:
|
||||
entrypoint: ["/bin/sh", "/start_ad.sh"]
|
||||
logging: *default-logging
|
||||
ss:
|
||||
image: mercurykd/vpnbot-ss:1.1
|
||||
image: mercurykd/vpnbot-ss:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/shadowsocks.dockerfile
|
||||
args:
|
||||
@@ -399,7 +399,7 @@ services:
|
||||
ipv4_address: 10.10.0.8
|
||||
logging: *default-logging
|
||||
xr:
|
||||
image: mercurykd/vpnbot-xr:1.2
|
||||
image: mercurykd/vpnbot-xr:1.3
|
||||
build:
|
||||
dockerfile: dockerfile/xray.dockerfile
|
||||
args:
|
||||
@@ -493,7 +493,7 @@ services:
|
||||
ipv4_address: 10.10.0.12
|
||||
logging: *default-logging
|
||||
wp:
|
||||
image: mercurykd/vpnbot-wp:1.1
|
||||
image: mercurykd/vpnbot-wp:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/warp.dockerfile
|
||||
args:
|
||||
@@ -503,7 +503,7 @@ services:
|
||||
devices:
|
||||
- /dev/net/tun:/dev/net/tun
|
||||
volumes:
|
||||
- ./config/.profile:/root/.bashrc:ro
|
||||
- ./config/.profile:/root/.ashrc:ro
|
||||
- ./ssh:/ssh
|
||||
- ./config/sshd_config:/etc/ssh/sshd_config
|
||||
- ./config:/config
|
||||
@@ -514,8 +514,11 @@ services:
|
||||
depends_on:
|
||||
php:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
TZ: ${TZ}
|
||||
env_file:
|
||||
- path: ./.env
|
||||
required: true # default
|
||||
- path: ./override.env
|
||||
required: false
|
||||
stop_grace_period: 1s
|
||||
command: ["/bin/sh", "/start_wp.sh"]
|
||||
networks:
|
||||
|
||||
@@ -2,16 +2,16 @@ ARG image
|
||||
FROM $image
|
||||
RUN apk add openssh git xz \
|
||||
&& mkdir /root/.ssh \
|
||||
&& wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.15.3/shadowsocks-v1.15.3.x86_64-unknown-linux-musl.tar.xz \
|
||||
&& tar -xf shadowsocks-v1.15.3.x86_64-unknown-linux-musl.tar.xz \
|
||||
&& wget https://github.com/teddysun/v2ray-plugin/releases/download/v5.7.0/v2ray-plugin-linux-amd64-v5.7.0.tar.gz \
|
||||
&& tar -xf v2ray-plugin-linux-amd64-v5.7.0.tar.gz \
|
||||
&& wget -O shadowsocks-rust.x86_64-unknown-linux-musl.tar.xz $(wget -q -O - https://api.github.com/repos/shadowsocks/shadowsocks-rust/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep '.x86_64-unknown-linux-musl.tar.xz$') \
|
||||
&& tar -xf shadowsocks-rust.x86_64-unknown-linux-musl.tar.xz \
|
||||
&& wget -O v2ray-plugin-linux-amd64.tar.gz $(wget -q -O - https://api.github.com/repos/teddysun/v2ray-plugin/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep 'v2ray-plugin-linux-amd64') \
|
||||
&& tar -xf v2ray-plugin-linux-amd64.tar.gz \
|
||||
&& mv sslocal /usr/bin/ \
|
||||
&& mv ssserver /usr/bin/ \
|
||||
&& mv ssmanager /usr/bin/ \
|
||||
&& mv ssservice /usr/bin/ \
|
||||
&& mv ssurl /usr/bin/ \
|
||||
&& mv v2ray-plugin_linux_amd64 /usr/bin/v2ray-plugin \
|
||||
&& rm v2ray-plugin-linux-amd64-v5.7.0.tar.gz\
|
||||
&& rm shadowsocks-v1.15.3.x86_64-unknown-linux-musl.tar.xz
|
||||
&& rm v2ray-plugin-linux-amd64.tar.gz \
|
||||
&& rm shadowsocks-rust.x86_64-unknown-linux-musl.tar.xz
|
||||
ENV ENV="/root/.ashrc"
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
FROM ubuntu:22.04
|
||||
RUN apt update && apt install -y curl gpg socat jq lsb-release openssh-server \
|
||||
FROM ubuntu:22.04 AS build
|
||||
RUN apt update && apt install -y curl gpg lsb-release \
|
||||
&& 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
|
||||
|
||||
FROM alpine:3.17
|
||||
ARG GLIBC_VERSION=2.34-r0
|
||||
COPY --from=build /usr/bin/warp-cli /usr/bin/warp-svc /usr/local/bin/
|
||||
RUN apk add --no-cache dbus-libs wget socat openssh-server jq curl \
|
||||
&& mkdir /tmp/glibc-pkgs \
|
||||
&& for PKG in glibc-$GLIBC_VERSION.apk glibc-bin-$GLIBC_VERSION.apk; do wget -q --directory-prefix /tmp/glibc-pkgs https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$GLIBC_VERSION/$PKG; done \
|
||||
&& apk add --no-cache --allow-untrusted --force-overwrite /tmp/glibc-pkgs/* \
|
||||
&& rm -rf /tmp/glibc-pkgs \
|
||||
&& /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib \
|
||||
&& mkdir /root/.ssh
|
||||
|
||||
@@ -2,7 +2,7 @@ ARG image
|
||||
FROM $image
|
||||
RUN apk add openssh openssl jq \
|
||||
&& mkdir /root/.ssh \
|
||||
&& wget https://github.com/XTLS/Xray-core/releases/download/v1.8.10/Xray-linux-64.zip \
|
||||
&& wget -O Xray-linux-64.zip $(wget -q -O - https://api.github.com/repos/XTLS/Xray-core/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep 'Xray-linux-64.zip$') \
|
||||
&& unzip Xray-linux-64.zip \
|
||||
&& mv xray /usr/bin/ \
|
||||
&& rm Xray-linux-64.zip \
|
||||
|
||||
@@ -31,7 +31,7 @@ up: # консоль сервиса
|
||||
ad: # консоль сервиса
|
||||
docker compose exec ad /bin/sh
|
||||
wp: # консоль сервиса
|
||||
docker compose exec wp bash
|
||||
docker compose exec wp /bin/sh
|
||||
proxy: # консоль сервиса
|
||||
docker compose exec proxy /bin/sh
|
||||
tg: # консоль сервиса
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
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
|
||||
ssh-keygen -A
|
||||
exec /usr/sbin/sshd -D -e "$@" &
|
||||
warp-svc > /dev/null &
|
||||
sleep 3
|
||||
warp-cli --accept-tos registration new
|
||||
|
||||
Reference in New Issue
Block a user