Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d12e5c972 | |||
| 2efcea9dbe | |||
| 5b1bf2b3d5 |
+45
@@ -140,6 +140,12 @@ class Bot
|
||||
case preg_match('~^/updatebot$~', $this->input['callback'], $m):
|
||||
$this->updatebot();
|
||||
break;
|
||||
case preg_match('~^/branches$~', $this->input['callback'], $m):
|
||||
$this->branches();
|
||||
break;
|
||||
case preg_match('~^/changeBranch (\d+)$~', $this->input['callback'], $m):
|
||||
$this->changeBranch($m[1]);
|
||||
break;
|
||||
case preg_match('~^/getMirror$~', $this->input['callback'], $m):
|
||||
$this->getMirror();
|
||||
break;
|
||||
@@ -3783,7 +3789,13 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/debug",
|
||||
],
|
||||
];
|
||||
exec('git -C / branch', $m);
|
||||
$track = trim(file_get_contents('/update/branch'));
|
||||
$data[] = [
|
||||
[
|
||||
'text' => "{$m[0]} => $track",
|
||||
'callback_data' => "/branches",
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n('update bot'),
|
||||
'callback_data' => "/updatebot",
|
||||
@@ -3801,6 +3813,39 @@ DNS-over-HTTPS with IP:
|
||||
];
|
||||
}
|
||||
|
||||
public function branches()
|
||||
{
|
||||
exec('git -C / branch -r', $m);
|
||||
array_shift($m);
|
||||
foreach ($m as $k => $v) {
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $v,
|
||||
'callback_data' => "/changeBranch $k",
|
||||
]
|
||||
];
|
||||
}
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('back'),
|
||||
'callback_data' => "/menu config",
|
||||
]
|
||||
];
|
||||
$this->update($this->input['from'], $this->input['message_id'], 'branches', $data);
|
||||
}
|
||||
|
||||
public function changeBranch($i)
|
||||
{
|
||||
exec('git -C / branch -r', $m);
|
||||
array_shift($m);
|
||||
foreach ($m as $k => $v) {
|
||||
if ($i == $k) {
|
||||
file_put_contents('/update/branch', trim(str_replace('origin/', '', $v)));
|
||||
}
|
||||
}
|
||||
$this->menu('config');
|
||||
}
|
||||
|
||||
public function logs()
|
||||
{
|
||||
foreach (scandir('/logs/') as $k => $v) {
|
||||
|
||||
+2
-2
@@ -74,7 +74,6 @@ services:
|
||||
- ./config/sshd_config:/etc/ssh/sshd_config
|
||||
- ./logs/:/logs/
|
||||
- ./app/webapp:/app
|
||||
- ./app/login.html:/app/login.html
|
||||
ports:
|
||||
- 80:80
|
||||
hostname: nginx
|
||||
@@ -96,7 +95,7 @@ services:
|
||||
ipv4_address: 10.10.1.2
|
||||
logging: *default-logging
|
||||
php:
|
||||
image: mercurykd/vpnbot-php:1.2
|
||||
image: mercurykd/vpnbot-php:1.3
|
||||
build:
|
||||
dockerfile: dockerfile/php.dockerfile
|
||||
args:
|
||||
@@ -117,6 +116,7 @@ services:
|
||||
- ./mirror:/mirror
|
||||
- ./.env:/mirror/.env
|
||||
- ./update:/update
|
||||
- ./.git:/.git
|
||||
environment:
|
||||
IP: ${IP}
|
||||
VER: ${VER}
|
||||
|
||||
@@ -19,6 +19,7 @@ RUN apk add --no-cache --update php81 \
|
||||
openssh \
|
||||
openssl \
|
||||
curl \
|
||||
git \
|
||||
py3-qt5 \
|
||||
&& wget https://github.com/ameshkov/dnslookup/releases/download/v1.9.1/dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||
&& tar -xf dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||
|
||||
+7
-1
@@ -6,10 +6,16 @@ echo "$$" > $pwd/update/update_pid
|
||||
while true
|
||||
do
|
||||
cmd=$(cat $pwd/update/pipe)
|
||||
branch=$(cat $pwd/update/branch 2>/dev/null)
|
||||
if [[ -n "$cmd" ]]
|
||||
then
|
||||
docker compose down --remove-orphans
|
||||
git reset --hard
|
||||
git reset --hard && git clean -fd
|
||||
git fetch
|
||||
if [[ -n "$branch" ]]
|
||||
then
|
||||
git checkout -t origin/$branch || git checkout $branch
|
||||
fi
|
||||
git pull > ./update/message
|
||||
IP=$(curl https://ipinfo.io/ip) VER=$(git describe --tags) docker compose up -d --force-recreate
|
||||
bash $pwd/update/update.sh &
|
||||
|
||||
Reference in New Issue
Block a user