From 88f8c1c4c2d82891afa4729404242221d875c9f2 Mon Sep 17 00:00:00 2001 From: mercury Date: Sat, 4 May 2024 21:56:40 +0400 Subject: [PATCH 1/5] changelog in update message --- app/bot.php | 9 ++++++++- version | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/bot.php b/app/bot.php index 20972ae..444d1cc 100644 --- a/app/bot.php +++ b/app/bot.php @@ -1005,7 +1005,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"], + ] + ] + ]); } } } diff --git a/version b/version index 2d73917..8caf0df 100644 --- a/version +++ b/version @@ -1,3 +1,5 @@ +04.05.2024 v1.38 +- changelog в сообщении новой версии 04.05.2024 v1.37.1 - warp на образе alpine (thx @zmeyzloy) - фикс выбора шаблона singbox From 455b9cea074dc4d98ae8cb9e23fca45d0075dcc5 Mon Sep 17 00:00:00 2001 From: runalsh <21105673+runalsh@users.noreply.github.com> Date: Fri, 17 May 2024 11:46:57 +0300 Subject: [PATCH 2/5] Remove absolute versions for xray.dockerfile (#16) * added sing-box from repo (#12) * edge repo for sing-box (#13) * added sing-box from repo * add testing repo for sing-box * Revert "added sing-box from repo (#12)" This reverts commit 256e43352a4c70bd72e6d6159db4bd77354dce1f. * Revert "edge repo for sing-box (#13)" This reverts commit bb1ac60accf9b7c7f97d9f1144a44f981b725e6c. * Update xray.dockerfile --------- Co-authored-by: mercury --- dockerfile/xray.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile/xray.dockerfile b/dockerfile/xray.dockerfile index 0d86db0..4d70ef9 100644 --- a/dockerfile/xray.dockerfile +++ b/dockerfile/xray.dockerfile @@ -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 \ From 277b00da87d9c941f2bc1ca5130d6230b8812300 Mon Sep 17 00:00:00 2001 From: runalsh <21105673+runalsh@users.noreply.github.com> Date: Fri, 17 May 2024 11:47:28 +0300 Subject: [PATCH 3/5] Remove absolute versions for shadowsocks.dockerfile (#15) * added sing-box from repo (#12) * edge repo for sing-box (#13) * added sing-box from repo * add testing repo for sing-box * Revert "added sing-box from repo (#12)" This reverts commit 256e43352a4c70bd72e6d6159db4bd77354dce1f. * Revert "edge repo for sing-box (#13)" This reverts commit bb1ac60accf9b7c7f97d9f1144a44f981b725e6c. * Update shadowsocks.dockerfile --------- Co-authored-by: mercury --- dockerfile/shadowsocks.dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dockerfile/shadowsocks.dockerfile b/dockerfile/shadowsocks.dockerfile index ed79010..23770c2 100644 --- a/dockerfile/shadowsocks.dockerfile +++ b/dockerfile/shadowsocks.dockerfile @@ -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" From 52738c0491129443ac0ee5aa6520569ffa1c8b64 Mon Sep 17 00:00:00 2001 From: mercury Date: Fri, 17 May 2024 12:56:56 +0400 Subject: [PATCH 4/5] update version xray, shadowsocks --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ae73aad..6634999 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: From 624713347a43fe1fca1449f70d2043de1fedd361 Mon Sep 17 00:00:00 2001 From: mercury Date: Sat, 18 May 2024 17:00:04 +0400 Subject: [PATCH 5/5] change autobackup --- app/bot.php | 54 +++++++++++++++++++++++++---------------------------- version | 2 ++ 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/app/bot.php b/app/bot.php index 444d1cc..16b0086 100644 --- a/app/bot.php +++ b/app/bot.php @@ -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() @@ -4707,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'), @@ -4918,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); diff --git a/version b/version index 8caf0df..3ce715c 100644 --- a/version +++ b/version @@ -1,3 +1,5 @@ +18.05.2024 v1.39 +- изменен автобэкап 04.05.2024 v1.38 - changelog в сообщении новой версии 04.05.2024 v1.37.1