Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 757c704d38 | |||
| 7c9f4d9815 | |||
| 9bfa7bd0c7 | |||
| d8620ef4f2 | |||
| d4b9c4af48 |
+18
-13
@@ -1045,6 +1045,7 @@ class Bot
|
|||||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||||
$this->saveClients($json['wg']['clients']);
|
$this->saveClients($json['wg']['clients']);
|
||||||
$this->restartWG($this->createConfig($json['wg']['server']), $switch_amnezia);
|
$this->restartWG($this->createConfig($json['wg']['server']), $switch_amnezia);
|
||||||
|
$this->iptablesWG();
|
||||||
}
|
}
|
||||||
// ad
|
// ad
|
||||||
if (!empty($json['ad'])) {
|
if (!empty($json['ad'])) {
|
||||||
@@ -1099,7 +1100,7 @@ class Bot
|
|||||||
|
|
||||||
$t = file_get_contents('/config/nginx_default.conf');
|
$t = file_get_contents('/config/nginx_default.conf');
|
||||||
if (!empty($json['pac']['domain'])) {
|
if (!empty($json['pac']['domain'])) {
|
||||||
$t = preg_replace('/server_name([^\n]+)?/', "server_name {$json['pac']['domain']};", $t);
|
$t = preg_replace('/server_name ([^\n]+)?/', "server_name {$json['pac']['domain']};", $t);
|
||||||
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
|
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
|
||||||
foreach ($m[0] as $k => $v) {
|
foreach ($m[0] as $k => $v) {
|
||||||
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
||||||
@@ -1235,29 +1236,33 @@ class Bot
|
|||||||
$this->menu('wg', $page);
|
$this->menu('wg', $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function switchTorrent($page)
|
public function switchTorrent($page = 0, $restart = false)
|
||||||
{
|
{
|
||||||
$c = $this->getPacConf();
|
$c = $this->getPacConf();
|
||||||
$c['blocktorrent'] = $c['blocktorrent'] ? 0 : 1;
|
$c['blocktorrent'] = $c['blocktorrent'] ? 0 : 1;
|
||||||
$this->setPacConf($c);
|
$this->setPacConf($c);
|
||||||
if ($c['blocktorrent']) {
|
$this->iptablesWG();
|
||||||
$this->ssh('bash /block_torrent.sh');
|
|
||||||
} else {
|
|
||||||
$this->ssh('bash /unblock_torrent.sh');
|
|
||||||
}
|
|
||||||
$this->answer($this->input['callback_id'], 'доступ к торрентам ' . ($c['blocktorrent'] ? 'заблокирован' : 'разблокирован'), true);
|
$this->answer($this->input['callback_id'], 'доступ к торрентам ' . ($c['blocktorrent'] ? 'заблокирован' : 'разблокирован'), true);
|
||||||
$this->menu('wg', $page);
|
$this->menu('wg', $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function iptablesWG()
|
||||||
|
{
|
||||||
|
$c = $this->getPacConf();
|
||||||
|
$this->ssh('iptables -F');
|
||||||
|
if ($c['exchange']) {
|
||||||
|
$this->ssh('bash /block_exchange.sh');
|
||||||
|
}
|
||||||
|
if ($c['blocktorrent']) {
|
||||||
|
$this->ssh('bash /block_torrent.sh');
|
||||||
|
}
|
||||||
|
}
|
||||||
public function switchExchange($page)
|
public function switchExchange($page)
|
||||||
{
|
{
|
||||||
$c = $this->getPacConf();
|
$c = $this->getPacConf();
|
||||||
$c['exchange'] = $c['exchange'] ? 0 : 1;
|
$c['exchange'] = $c['exchange'] ? 0 : 1;
|
||||||
$this->setPacConf($c);
|
$this->setPacConf($c);
|
||||||
if ($c['exchange']) {
|
$this->iptablesWG();
|
||||||
$this->ssh('bash /block_exchange.sh');
|
|
||||||
} else {
|
|
||||||
$this->ssh('bash /unblock_exchange.sh');
|
|
||||||
}
|
|
||||||
$this->answer($this->input['callback_id'], 'обмен между пользователями ' . ($c['exchange'] ? 'заблокирован' : 'разблокирован'), true);
|
$this->answer($this->input['callback_id'], 'обмен между пользователями ' . ($c['exchange'] ? 'заблокирован' : 'разблокирован'), true);
|
||||||
$this->menu('wg', $page);
|
$this->menu('wg', $page);
|
||||||
}
|
}
|
||||||
@@ -1402,7 +1407,7 @@ class Bot
|
|||||||
$conf = $this->getPacConf();
|
$conf = $this->getPacConf();
|
||||||
$conf['domain'] = idn_to_ascii($domain);
|
$conf['domain'] = idn_to_ascii($domain);
|
||||||
$nginx = file_get_contents('/config/nginx.conf');
|
$nginx = file_get_contents('/config/nginx.conf');
|
||||||
$t = preg_replace('/server_name([^\n]+)?/', "server_name {$conf['domain']};", $nginx);
|
$t = preg_replace('/server_name ([^\n]+)?/', "server_name {$conf['domain']};", $nginx);
|
||||||
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
|
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
|
||||||
foreach ($m[0] as $k => $v) {
|
foreach ($m[0] as $k => $v) {
|
||||||
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
|
server_names_hash_bucket_size 64;
|
||||||
include include.conf;
|
include include.conf;
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
|
server_names_hash_bucket_size 64;
|
||||||
include include.conf;
|
include include.conf;
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|||||||
+1
-2
@@ -164,9 +164,7 @@ services:
|
|||||||
- ./scripts/start_wg.sh:/start_wg.sh
|
- ./scripts/start_wg.sh:/start_wg.sh
|
||||||
- ./scripts/reset_wg.sh:/reset_wg.sh
|
- ./scripts/reset_wg.sh:/reset_wg.sh
|
||||||
- ./scripts/block_torrent.sh:/block_torrent.sh
|
- ./scripts/block_torrent.sh:/block_torrent.sh
|
||||||
- ./scripts/unblock_torrent.sh:/unblock_torrent.sh
|
|
||||||
- ./scripts/block_exchange.sh:/block_exchange.sh
|
- ./scripts/block_exchange.sh:/block_exchange.sh
|
||||||
- ./scripts/unblock_exchange.sh:/unblock_exchange.sh
|
|
||||||
- ./ssh:/ssh
|
- ./ssh:/ssh
|
||||||
- ./config/sshd_config:/etc/ssh/sshd_config
|
- ./config/sshd_config:/etc/ssh/sshd_config
|
||||||
hostname: wireguard
|
hostname: wireguard
|
||||||
@@ -180,6 +178,7 @@ services:
|
|||||||
TZ: ${TZ}
|
TZ: ${TZ}
|
||||||
WGPORT: ${WGPORT}
|
WGPORT: ${WGPORT}
|
||||||
ADDRESS: ${WGADDRESS}
|
ADDRESS: ${WGADDRESS}
|
||||||
|
ENV: /root/.ashrc
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
devices:
|
devices:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ d: # остановка контейнеров
|
|||||||
docker compose down
|
docker compose down
|
||||||
dv: # остановка контейнеров
|
dv: # остановка контейнеров
|
||||||
docker compose down -v
|
docker compose down -v
|
||||||
r: cleanf d u cleanf
|
r: d cleanf u cleanf
|
||||||
ps: # список контейнеров
|
ps: # список контейнеров
|
||||||
docker compose ps
|
docker compose ps
|
||||||
l: # логи из контейнеров
|
l: # логи из контейнеров
|
||||||
@@ -25,12 +25,14 @@ up: # консоль сервиса
|
|||||||
docker compose exec up /bin/sh
|
docker compose exec up /bin/sh
|
||||||
ad: # консоль сервиса
|
ad: # консоль сервиса
|
||||||
docker compose exec ad /bin/sh
|
docker compose exec ad /bin/sh
|
||||||
|
wp: # консоль сервиса
|
||||||
|
docker compose exec wp bash
|
||||||
proxy: # консоль сервиса
|
proxy: # консоль сервиса
|
||||||
docker compose exec proxy /bin/sh
|
docker compose exec proxy /bin/sh
|
||||||
tg: # консоль сервиса
|
tg: # консоль сервиса
|
||||||
docker compose exec tg /bin/sh
|
docker compose exec tg /bin/sh
|
||||||
xr: # консоль сервиса
|
xr: # консоль сервиса
|
||||||
docker compose exec xr /bin/shec tg /bin/sh
|
docker compose exec xr /bin/sh
|
||||||
oc: # консоль сервиса
|
oc: # консоль сервиса
|
||||||
docker compose exec oc /bin/sh
|
docker compose exec oc /bin/sh
|
||||||
clean:
|
clean:
|
||||||
@@ -51,3 +53,5 @@ cn:
|
|||||||
docker compose exec ng nginx -t
|
docker compose exec ng nginx -t
|
||||||
push:
|
push:
|
||||||
docker compose push
|
docker compose push
|
||||||
|
s:
|
||||||
|
git status -su
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
01.03.2024 фикс блокировок торрентов и обмена между пользователями
|
||||||
|
- <code>git pull && make r</code>
|
||||||
|
01.03.2024 фикс установки домена с длинным названием
|
||||||
|
- <code>make update</code>
|
||||||
29.02.2024 образы теперь будут скачиваться с docker hub
|
29.02.2024 образы теперь будут скачиваться с docker hub
|
||||||
- <code>git pull && make d cleanall u</code>
|
- <code>git pull && make d cleanall u</code>
|
||||||
28.02.2024 v1.1 добавлен раздел "зеркало"
|
28.02.2024 v1.1 добавлен раздел "зеркало"
|
||||||
|
|||||||
Reference in New Issue
Block a user