Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 95c5b5b8fd | |||
| efbe20485a | |||
| 475eea1f47 | |||
| 02d9cdcccc |
+81
-3
@@ -358,12 +358,18 @@ class Bot
|
|||||||
case preg_match('~^/changeCamouflage$~', $this->input['callback'], $m):
|
case preg_match('~^/changeCamouflage$~', $this->input['callback'], $m):
|
||||||
$this->changeCamouflage();
|
$this->changeCamouflage();
|
||||||
break;
|
break;
|
||||||
|
case preg_match('~^/changeOcDomain$~', $this->input['callback'], $m):
|
||||||
|
$this->changeOcDomain();
|
||||||
|
break;
|
||||||
case preg_match('~^/changeOcPass$~', $this->input['callback'], $m):
|
case preg_match('~^/changeOcPass$~', $this->input['callback'], $m):
|
||||||
$this->changeOcPass();
|
$this->changeOcPass();
|
||||||
break;
|
break;
|
||||||
case preg_match('~^/changeNaiveUser$~', $this->input['callback'], $m):
|
case preg_match('~^/changeNaiveUser$~', $this->input['callback'], $m):
|
||||||
$this->changeNaiveUser();
|
$this->changeNaiveUser();
|
||||||
break;
|
break;
|
||||||
|
case preg_match('~^/changeNaiveSubdomain$~', $this->input['callback'], $m):
|
||||||
|
$this->changeNaiveSubdomain();
|
||||||
|
break;
|
||||||
case preg_match('~^/changeNaivePass$~', $this->input['callback'], $m):
|
case preg_match('~^/changeNaivePass$~', $this->input['callback'], $m):
|
||||||
$this->changeNaivePass();
|
$this->changeNaivePass();
|
||||||
break;
|
break;
|
||||||
@@ -816,7 +822,7 @@ class Bot
|
|||||||
$this->input['chat'],
|
$this->input['chat'],
|
||||||
"@{$this->input['username']} enter camouflage key",
|
"@{$this->input['username']} enter camouflage key",
|
||||||
$this->input['message_id'],
|
$this->input['message_id'],
|
||||||
reply: 'enter password',
|
reply: 'enter camouflage key',
|
||||||
);
|
);
|
||||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||||
'start_message' => $this->input['message_id'],
|
'start_message' => $this->input['message_id'],
|
||||||
@@ -826,6 +832,22 @@ class Bot
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function changeOcDomain()
|
||||||
|
{
|
||||||
|
$r = $this->send(
|
||||||
|
$this->input['chat'],
|
||||||
|
"@{$this->input['username']} enter subdomain",
|
||||||
|
$this->input['message_id'],
|
||||||
|
reply: 'enter subdomain',
|
||||||
|
);
|
||||||
|
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||||
|
'start_message' => $this->input['message_id'],
|
||||||
|
'start_callback' => $this->input['callback_id'],
|
||||||
|
'callback' => 'chOcSubdomain',
|
||||||
|
'args' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function changeOcDns()
|
public function changeOcDns()
|
||||||
{
|
{
|
||||||
$r = $this->send(
|
$r = $this->send(
|
||||||
@@ -864,7 +886,7 @@ class Bot
|
|||||||
$this->input['chat'],
|
$this->input['chat'],
|
||||||
"@{$this->input['username']} enter login",
|
"@{$this->input['username']} enter login",
|
||||||
$this->input['message_id'],
|
$this->input['message_id'],
|
||||||
reply: 'enter password',
|
reply: 'enter login',
|
||||||
);
|
);
|
||||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||||
'start_message' => $this->input['message_id'],
|
'start_message' => $this->input['message_id'],
|
||||||
@@ -874,6 +896,22 @@ class Bot
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function changeNaiveSubdomain()
|
||||||
|
{
|
||||||
|
$r = $this->send(
|
||||||
|
$this->input['chat'],
|
||||||
|
"@{$this->input['username']} enter subdomain",
|
||||||
|
$this->input['message_id'],
|
||||||
|
reply: 'enter subdomain',
|
||||||
|
);
|
||||||
|
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||||
|
'start_message' => $this->input['message_id'],
|
||||||
|
'start_callback' => $this->input['callback_id'],
|
||||||
|
'callback' => 'chNpSubdomain',
|
||||||
|
'args' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function changeNaivePass()
|
public function changeNaivePass()
|
||||||
{
|
{
|
||||||
$r = $this->send(
|
$r = $this->send(
|
||||||
@@ -987,6 +1025,34 @@ class Bot
|
|||||||
$this->menu('oc');
|
$this->menu('oc');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function chOcSubdomain($domain)
|
||||||
|
{
|
||||||
|
$pac = $this->getPacConf();
|
||||||
|
if (empty($domain)) {
|
||||||
|
unset($pac["oc_domain"]);
|
||||||
|
} else {
|
||||||
|
$pac["oc_domain"] = $domain;
|
||||||
|
}
|
||||||
|
$this->setPacConf($pac);
|
||||||
|
$this->chocdomain($pac['domain']);
|
||||||
|
$this->setUpstreamDomainOcserv($pac['domain']);
|
||||||
|
$this->menu('oc');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function chNpSubdomain($domain)
|
||||||
|
{
|
||||||
|
$pac = $this->getPacConf();
|
||||||
|
if (!empty($data)) {
|
||||||
|
unset($pac['np_domain']);
|
||||||
|
} else {
|
||||||
|
$pac['np_domain'] = $domain;
|
||||||
|
}
|
||||||
|
$this->setPacConf($pac);
|
||||||
|
$this->restartNaive();
|
||||||
|
$this->setUpstreamDomainNaive($pac['domain']);
|
||||||
|
$this->menu('naive');
|
||||||
|
}
|
||||||
|
|
||||||
public function chnplogin($user)
|
public function chnplogin($user)
|
||||||
{
|
{
|
||||||
$pac = $this->getPacConf();
|
$pac = $this->getPacConf();
|
||||||
@@ -4823,6 +4889,12 @@ DNS-over-HTTPS with IP:
|
|||||||
$text[] = "Menu -> NaiveProxy";
|
$text[] = "Menu -> NaiveProxy";
|
||||||
$np = $this->getHashSubdomain('np');
|
$np = $this->getHashSubdomain('np');
|
||||||
$text[] = "<code>https://{$pac['naive']['user']}:{$pac['naive']['pass']}@$np.$domain</code>";
|
$text[] = "<code>https://{$pac['naive']['user']}:{$pac['naive']['pass']}@$np.$domain</code>";
|
||||||
|
$data[] = [
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('change subdomain'),
|
||||||
|
'callback_data' => "/changeNaiveSubdomain",
|
||||||
|
],
|
||||||
|
];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('change login'),
|
'text' => $this->i18n('change login'),
|
||||||
@@ -4926,6 +4998,12 @@ DNS-over-HTTPS with IP:
|
|||||||
$text[] = "<code>https://$oc.$domain/?$cs</code>";
|
$text[] = "<code>https://$oc.$domain/?$cs</code>";
|
||||||
}
|
}
|
||||||
$text[] = "password: <span class='tg-spoiler'>$pass</span>";
|
$text[] = "password: <span class='tg-spoiler'>$pass</span>";
|
||||||
|
$data[] = [
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('change subdomain'),
|
||||||
|
'callback_data' => "/changeOcDomain",
|
||||||
|
],
|
||||||
|
];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('change secret'),
|
'text' => $this->i18n('change secret'),
|
||||||
@@ -6386,7 +6464,7 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
public function getHashSubdomain($subdomain)
|
public function getHashSubdomain($subdomain)
|
||||||
{
|
{
|
||||||
return substr(hash('sha256', "$subdomain{$this->key}"), 0, 8);
|
return $this->getPacConf()["{$subdomain}_domain"] ?: substr(hash('sha256', "$subdomain{$this->key}"), 0, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addWg($page)
|
public function addWg($page)
|
||||||
|
|||||||
+11
-2
@@ -1,5 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
pwd=`pwd`
|
pwd=`pwd`
|
||||||
|
process_name="$pwd/update/update.sh"
|
||||||
|
current_pid=$$
|
||||||
|
pids=$(pgrep -f $process_name)
|
||||||
|
for pid in $pids; do
|
||||||
|
if [ $pid -ne $current_pid ]; then
|
||||||
|
kill -9 $pid
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
> $pwd/update/pipe
|
> $pwd/update/pipe
|
||||||
echo "$$" > $pwd/update/update_pid
|
echo "$$" > $pwd/update/update_pid
|
||||||
|
|
||||||
@@ -27,10 +36,10 @@ do
|
|||||||
git pull > ./update/message
|
git pull > ./update/message
|
||||||
fi
|
fi
|
||||||
curl -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$key/editMessageText -d "$(cat $pwd/update/curl | sed 's/"text":"~t~"/"text": "launching the bot"/')"
|
curl -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$key/editMessageText -d "$(cat $pwd/update/curl | sed 's/"text":"~t~"/"text": "launching the bot"/')"
|
||||||
IP=$(curl ipinfo.io/ip) VER=$(git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
|
|
||||||
bash $pwd/update/update.sh &
|
|
||||||
> $pwd/update/key
|
> $pwd/update/key
|
||||||
> $pwd/update/curl
|
> $pwd/update/curl
|
||||||
|
IP=$(curl -s -t 1 2ip.io || curl -s -t 1 ipinfo.io/ip || curl -s -t 1 ifconfig.me) VER=$(git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
|
||||||
|
bash $pwd/update/update.sh &
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|||||||
Reference in New Issue
Block a user