Skip to content

Commit

Permalink
move static variables to config.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrtye committed Sep 21, 2024
1 parent d914a2f commit 6102366
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
20 changes: 20 additions & 0 deletions submanager/config.py
Original file line number Diff line number Diff line change
@@ -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": "石家庄",
}
3 changes: 1 addition & 2 deletions submanager/remove_subscription.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 1 addition & 3 deletions submanager/update_nginx_config.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
23 changes: 2 additions & 21 deletions submanager/update_subscription.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down

0 comments on commit 6102366

Please sign in to comment.