some updates

This commit is contained in:
MoonDev
2025-05-23 01:55:25 +03:00
parent a775fe1c80
commit f1d8283224
18 changed files with 251 additions and 56 deletions

View File

@@ -62,7 +62,6 @@ class V2rayAController:
async with self.session.post(url, headers=headers, json=data) as response:
if response.status == 200:
print("Прокси успешно включен")
V2RAY_VPN_ENABLED = True
await show_notification({"title":"✅ V2Ray proxy","message":"Прокси успешно включен"})
return True
else:
@@ -75,7 +74,7 @@ class V2rayAController:
async def disable_proxy(self):
"""Выключение прокси"""
global V2RAY_VPN_ENABLED
if not self.token:
print("Не выполнен вход. Пожалуйста, сначала выполните аутентификацию")
return False
@@ -88,7 +87,6 @@ class V2rayAController:
async with self.session.delete(url, headers=headers, json=data) as response:
if response.status == 200:
print("Прокси успешно выключен")
V2RAY_VPN_ENABLED = False
await show_notification({"title":"🔴 V2Ray proxy","message":"Прокси успешно выключен"})
return True
else:
@@ -105,6 +103,7 @@ class V2rayAController:
await self.session.close()
async def enable_vpn(args):
global V2RAY_VPN_ENABLED
# Инициализация контроллера
config = await read_config("v2ray.yaml")
if config.get("username") and config.get("password"):
@@ -119,9 +118,11 @@ async def enable_vpn(args):
# Закрытие сессии
await controller.close()
V2RAY_VPN_ENABLED = True
else:
raise OSError("Config unset")
async def disable_vpn(args):
global V2RAY_VPN_ENABLED
# Инициализация контроллера
config = await read_config("v2ray.yaml")
if config.get("username") and config.get("password"):
@@ -136,6 +137,7 @@ async def disable_vpn(args):
# Закрытие сессии
await controller.close()
V2RAY_VPN_ENABLED = False
else:
raise OSError("Config unset")
@@ -143,5 +145,5 @@ async def disable_vpn(args):
async def is_vpn_enabled(args):
global V2RAY_VPN_ENABLED
return {
"vpn_enabled": V2RAY_VPN_ENABLED
"value": V2RAY_VPN_ENABLED
}