diff --git a/submanager/config.py b/submanager/config.py new file mode 100644 index 0000000..cdad2c5 --- /dev/null +++ b/submanager/config.py @@ -0,0 +1,20 @@ +DIRECTORY_PATH = "/sub" +NGINX_PATH = "/conf.d" + +AGENTS = [ + ("clash-verge/1.8.0", "clash.yaml"), + ("shadowrocket/2.2.50", "shadowrocket"), +] + +LOCATION_DICT = { + "dalian": "大连", + "foshan": "佛山", + "default": "默认", + "tianjin": "天津", + "jinghai": "静海", + "beijing": "北京", + "dongguan": "东莞", + "tangshan": "唐山", + "guangzhou": "广州", + "shijiazhuang": "石家庄", +} diff --git a/submanager/remove_subscription.py b/submanager/remove_subscription.py index b8991bc..b8589f1 100644 --- a/submanager/remove_subscription.py +++ b/submanager/remove_subscription.py @@ -1,10 +1,9 @@ import os import shutil import datetime +from config import DIRECTORY_PATH from xui_credentials import get_credentials -DIRECTORY_PATH = "/sub" - def remove_old_client_config(): try: diff --git a/submanager/update_nginx_config.py b/submanager/update_nginx_config.py index 25ec5cd..08a79cb 100644 --- a/submanager/update_nginx_config.py +++ b/submanager/update_nginx_config.py @@ -1,10 +1,8 @@ import os import datetime +from config import DIRECTORY_PATH, NGINX_PATH from xui_credentials import get_credentials -DIRECTORY_PATH = "/sub" -NGINX_PATH = "/conf.d" - def update_nginx_config(credentials): with open( diff --git a/submanager/update_subscription.py b/submanager/update_subscription.py index ecb25ab..4e98305 100644 --- a/submanager/update_subscription.py +++ b/submanager/update_subscription.py @@ -1,32 +1,13 @@ import os import requests import datetime +from config import AGENTS, LOCATION_DICT from xui_credentials import get_credentials -DIRECTORY_PATH = "/sub" - -LOCATION_DICT = { - "dalian": "大连", - "foshan": "佛山", - "default": "默认", - "tianjin": "天津", - "jinghai": "静海", - "beijing": "北京", - "dongguan": "东莞", - "tangshan": "唐山", - "guangzhou": "广州", - "shijiazhuang": "石家庄", -} - -AGENTS = [ - ("clash-verge/1.8.0", "clash.yaml"), - ("shadowrocket/2.2.50", "shadowrocket"), -] - MITCE_URL = os.environ.get("MITCE_URL") if MITCE_URL is None: - print("Environment variables not fulfilled") + raise Exception("Environment variables not fulfilled") def get_provider_ip():