diff --git a/common/config.py b/common/config.py index e3b6e10..3fe2092 100644 --- a/common/config.py +++ b/common/config.py @@ -7,16 +7,23 @@ import aiofiles from .stack_error import stack_error from .log import log + async def gen_config_file(): + qa1 = "温馨提示:Github_Personal_Token可在Github设置的最底下开发者选项找到,详情看教程" + tutorial = "https://ikunshare.com/Onekey_tutorial" default_config ={ "Github_Personal_Token": "", "Custom_Steam_Path": "", - "QA1": "温馨提示:Github_Personal_Token可在Github设置的最底下开发者选项找到,详情看教程", - "教程": "https://lyvx-my.sharepoint.com/:w:/g/personal/ikun_ikunshare_com/EWqIqyCElLNLo_CKfLbqix0BWU_O03HLzEHQKHdJYrUz-Q?e=79MZjw" + "QA1": qa1, + "教程": tutorial } - async with aiofiles.open("./config.json", mode="w", encoding="utf-8") as f: - await f.write(json.dumps(default_config, indent=2, ensure_ascii=False, - escape_forward_slashes=False)) + async with aiofiles.open("./config.json", + mode="w", + encoding="utf-8") as f: + await f.write(json.dumps(default_config, + indent=2, + ensure_ascii=False, + escape_forward_slashes=False)) await f.close() log.info(' 🖱️ 程序可能为第一次启动,请填写配置文件后重新启动程序') @@ -28,7 +35,9 @@ async def load_config(): sys.exit() else: try: - async with aiofiles.open("./config.json", mode="r", encoding="utf-8") as f: + async with aiofiles.open("./config.json", + mode="r", + encoding="utf-8") as f: config = json.loads(await f.read()) return config except Exception as e: @@ -37,4 +46,4 @@ async def load_config(): os.system('pause') -config = asyncio.run(load_config()) \ No newline at end of file +config = asyncio.run(load_config()) diff --git a/common/dkey_merge.py b/common/dkey_merge.py index 3693db4..00f2039 100644 --- a/common/dkey_merge.py +++ b/common/dkey_merge.py @@ -6,6 +6,7 @@ from .log import log lock = asyncio.Lock() + async def depotkey_merge(config_path, depots_config): if not config_path.exists(): async with lock: diff --git a/common/log.py b/common/log.py index 1120746..700caad 100644 --- a/common/log.py +++ b/common/log.py @@ -1,6 +1,7 @@ import logging import colorlog + def init_log(): logger = logging.getLogger('Onekey') logger.setLevel(logging.DEBUG) @@ -18,4 +19,5 @@ def init_log(): logger.addHandler(stream_handler) return logger -log = init_log() \ No newline at end of file + +log = init_log()