diff --git a/main.py b/main.py index ced8663..8d537a7 100644 --- a/main.py +++ b/main.py @@ -1,494 +1,323 @@ +DEFAULT_CONFIG = { + "Github_Personal_Token": "", + "Custom_Steam_Path": "", + "QA1": "Github Personal Token可在GitHub设置的Developer settings中生成", + "教程": "https://ikunshare.com/Onekey_tutorial", +} + +import platform import sys import os import traceback -import time -import logging -import subprocess +import logzero import asyncio import aiofiles -import colorlog import httpx import winreg import ujson as json import vdf -from typing import Any +from typing import Any, Tuple, List, Dict from pathlib import Path -from colorama import init, Fore, Back, Style +from enum import Enum -init() -sys.path.append(os.path.dirname(os.path.abspath(__file__))) -lock = asyncio.Lock() -client = httpx.AsyncClient(verify=False) +class RepoChoice(Enum): + IKUN = ("ikun0014/ManifestHub", "已断更的旧仓库") + AUIOWU = ("Auiowu/ManifestAutoUpdate", "未知维护状态的仓库") + STEAM_AUTO = ("SteamAutoCracks/ManifestHub", "官方推荐仓库") DEFAULT_CONFIG = { "Github_Personal_Token": "", "Custom_Steam_Path": "", - "QA1": "温馨提示: Github_Personal_Token可在Github设置的最底下开发者选项找到, 详情看教程", - "教程": "https://ikunshare.com/Onekey_tutorial" + "QA1": "Github Personal Token可在GitHub设置的Developer settings中生成", + "教程": "https://ikunshare.com/Onekey_tutorial", } -LOG_FORMAT = '%(log_color)s%(message)s' -LOG_COLORS = { - 'INFO': 'cyan', - 'WARNING': 'yellow', - 'ERROR': 'red', - 'CRITICAL': 'purple', -} +DEFAULT_REPO = RepoChoice.STEAM_AUTO +WINDOWS_VERSIONS = ["10", "11"] +STEAM_REG_PATH = r"Software\Valve\Steam" +CONFIG_PATH = Path("./config.json") +LOCK = asyncio.Lock() +CLIENT = httpx.AsyncClient(verify=False, timeout=30) + +log = logzero.setup_logger("Onekey") -def init_log(level=logging.DEBUG) -> logging.Logger: - """ 初始化日志模块 """ - logger = logging.getLogger('Onekey') - logger.setLevel(level) - - stream_handler = logging.StreamHandler() - stream_handler.setLevel(level) - - fmt = colorlog.ColoredFormatter(LOG_FORMAT, log_colors=LOG_COLORS) - stream_handler.setFormatter(fmt) - - if not logger.handlers: - logger.addHandler(stream_handler) - - return logger +def init() -> None: + """初始化控制台输出""" + banner = r""" + _____ __ _ _____ _ _ _____ __ __ + / _ \ | \ | | | ____| | | / / | ____| \ \ / / + | | | | | \| | | |__ | |/ / | |__ \ \/ / + | | | | | |\ | | __| | |\ \ | __| \ / + | |_| | | | \ | | |___ | | \ \ | |___ / / + \_____/ |_| \_| |_____| |_| \_\ |_____| /_/ + """ + print(banner) + print("作者: ikun0014 | 版本: 1.3.7 | 官网: ikunshare.com") + print("项目仓库: GitHub: https://github.com/ikunshare/Onekey") + print("提示: 请确保已安装最新版Windows 10/11并正确配置Steam") -log = init_log() +def validate_windows_version() -> None: + """验证Windows版本""" + if platform.system() != "Windows": + log.error("仅支持Windows操作系统") + sys.exit(1) + + release = platform.uname().release + if release not in WINDOWS_VERSIONS: + log.error(f"需要Windows 10/11,当前版本: Windows {release}") + sys.exit(1) -def init(): - """ 输出初始化信息 """ - banner_lines = [ - " _____ __ _ _____ _ _ _____ __ __ ", - " / _ \\ | \\ | | | ____| | | / / | ____| \\ \\ / /", - " | | | | | \\| | | |__ | |/ / | |__ \\ \\/ /", - " | | | | | |\\ | | __| | |\\ \\ | __| \\ / ", - " | |_| | | | \\ | | |___ | | \\ \\ | |___ / /", - " \\_____/ |_| \\_| |_____| |_| \\_\\ |_____| /_/", - ] - for line in banner_lines: - log.info(line) +async def load_config() -> Dict[str, Any]: + """异步加载配置文件""" + if not CONFIG_PATH.exists(): + await generate_config() + log.info("请填写配置文件后重新运行程序") + sys.exit(0) - log.info('作者: ikun0014') - log.warning('本项目采用GNU General Public License v3开源许可证, 请勿用于商业用途') - log.info('版本: 1.3.6') - log.info( - '项目Github仓库: https://github.com/ikunshare/Onekey \n Gitee: https://gitee.com/ikun0014/Onekey' - ) - log.info('官网: ikunshare.com') - log.warning( - '本项目完全开源免费, 如果你在淘宝, QQ群内通过购买方式获得, 赶紧回去骂商家死全家\n 交流群组:\n https://t.me/ikunshare_qun' - ) - log.info('App ID可以在SteamDB, SteamUI或Steam商店链接页面查看') - - -def stack_error(exception: Exception) -> str: - """ 处理错误堆栈 """ - stack_trace = traceback.format_exception( - type(exception), exception, exception.__traceback__) - return ''.join(stack_trace) - - -async def gen_config_file(): - """ 生成配置文件 """ try: - 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)) - - log.info('程序可能为第一次启动或配置重置,请填写配置文件后重新启动程序') - except KeyboardInterrupt: - log.info("程序已退出") + async with aiofiles.open(CONFIG_PATH, "r", encoding="utf-8") as f: + return json.loads(await f.read()) + except json.JSONDecodeError: + log.error("配置文件损坏,正在重新生成...") + await generate_config() + sys.exit(1) except Exception as e: - log.error(f'配置文件生成失败,{stack_error(e)}') + log.error(f"配置加载失败: {str(e)}") + sys.exit(1) -async def load_config() -> dict: - """ 加载配置文件 """ - if not os.path.exists('./config.json'): - await gen_config_file() - os.system('pause') - sys.exit() - +async def generate_config() -> None: + """生成默认配置文件""" try: - async with aiofiles.open("./config.json", mode="r", encoding="utf-8") as f: - config = json.loads(await f.read()) - return config - except KeyboardInterrupt: - log.info("程序已退出") + async with aiofiles.open(CONFIG_PATH, "w", encoding="utf-8") as f: + await f.write(json.dumps(DEFAULT_CONFIG, indent=2, ensure_ascii=False)) + log.info("配置文件已生成") + except IOError as e: + log.error(f"配置文件创建失败: {str(e)}") + sys.exit(1) + + +def get_steam_path(config: Dict) -> Path: + """获取Steam安装路径""" + try: + if custom_path := config.get("Custom_Steam_Path"): + return Path(custom_path) + + with winreg.OpenKey(winreg.HKEY_CURRENT_USER, STEAM_REG_PATH) as key: + return Path(winreg.QueryValueEx(key, "SteamPath")[0]) except Exception as e: - log.error(f"配置文件加载失败,原因: {stack_error(e)},重置配置文件中...") - os.remove("./config.json") - await gen_config_file() - os.system('pause') - sys.exit() - -config = asyncio.run(load_config()) + log.error(f"Steam路径获取失败: {str(e)}") + sys.exit(1) -async def check_github_api_rate_limit(headers): - """ 检查Github请求数 """ - - if headers != None: - log.info(f"您已配置Github Token") - - url = 'https://api.github.com/rate_limit' +async def download_key(file_path: str, repo: str, sha: str) -> bytes: + """下载密钥文件""" try: - r = await client.get(url, headers=headers) - r_json = r.json() - if r.status_code == 200: - rate_limit = r_json.get('rate', {}) - remaining_requests = rate_limit.get('remaining', 0) - reset_time = rate_limit.get('reset', 0) - reset_time_formatted = time.strftime( - '%Y-%m-%d %H:%M:%S', time.localtime(reset_time)) - log.info(f'剩余请求次数: {remaining_requests}') - if remaining_requests == 0: - log.warning(f'GitHub API 请求数已用尽, 将在 {reset_time_formatted} 重置,建议生成一个填在配置文件里') - else: - log.error('Github请求数检查失败, 网络错误') - except KeyboardInterrupt: - log.info("程序已退出") - except httpx.ConnectError as e: - log.error(f'检查Github API 请求数失败, {stack_error(e)}') - except httpx.ConnectTimeout as e: - log.error(f'检查Github API 请求数超时: {stack_error(e)}') + return await fetch_from_cdn(file_path, repo, sha) except Exception as e: - log.error(f'发生错误: {stack_error(e)}') - - -async def checkcn() -> bool: - try: - req = await client.get('https://mips.kugou.com/check/iscn?&format=json') - body = req.json() - scn = bool(body['flag']) - if (not scn): - log.info( - f"您在非中国大陆地区({body['country']})上使用了项目, 已自动切换回Github官方下载CDN") - os.environ['IS_CN'] = 'no' - return False - else: - os.environ['IS_CN'] = 'yes' - return True - except KeyboardInterrupt: - log.info("程序已退出") - except httpx.ConnectError as e: - os.environ['IS_CN'] = 'yes' - log.warning('检查服务器位置失败,已忽略,自动认为你在中国大陆') - log.warning(stack_error(e)) - return False - - -async def depotkey_merge(config_path: Path, depots_config: dict) -> bool: - if not config_path.exists(): - async with lock: - log.error('Steam默认配置不存在, 可能是没有登录账号') - return False - - try: - async with aiofiles.open(config_path, encoding='utf-8') as f: - content = await f.read() - - config = vdf.loads(content) - steam = config.get('InstallConfigStore', {}).get('Software', {}).get('Valve') or config.get('InstallConfigStore', {}).get('Software', {}).get('valve') - - if steam is None: - log.error('找不到Steam配置, 请检查配置文件') - return False - - depots = steam.setdefault('depots', {}) - depots.update(depots_config.get('depots', {})) - - async with aiofiles.open(config_path, mode='w', encoding='utf-8') as f: - new_context = vdf.dumps(config, pretty=True) - await f.write(new_context) - - log.info('成功合并') - return True - except KeyboardInterrupt: - log.info("程序已退出") - except Exception as e: - async with lock: - log.error(f'合并失败, 原因: {e}') - return False - - -async def get(sha: str, path: str, repo: str): - if os.environ.get('IS_CN') == 'yes': - url_list = [ - f'https://jsdelivr.pai233.top/gh/{repo}@{sha}/{path}', - f'https://cdn.jsdmirror.com/gh/{repo}@{sha}/{path}', - f'https://raw.gitmirror.com/{repo}/{sha}/{path}', - f'https://raw.dgithub.xyz/{repo}/{sha}/{path}', - f'https://gh.akass.cn/{repo}/{sha}/{path}' - ] - else: - url_list = [ - f'https://raw.githubusercontent.com/{repo}/{sha}/{path}' - ] - retry = 3 - while retry > 0: - for url in url_list: - try: - r = await client.get(url, timeout=30) - if r.status_code == 200: - return r.read() - else: - log.error(f'获取失败: {path} - 状态码: {r.status_code}') - except KeyboardInterrupt: - log.info("程序已退出") - except httpx.ConnectError as e: - log.error(f'获取失败: {path} - 连接错误: {str(e)}') - except httpx.ConnectTimeout as e: - log.error(f'连接超时: {url} - 错误: {str(e)}') - - retry -= 1 - log.warning(f'重试剩余次数: {retry} - {path}') - - log.error(f'超过最大重试次数: {path}') - raise Exception(f'无法下载: {path}') - - -async def get_manifest(sha: str, path: str, steam_path: Path, repo: str) -> list: - collected_depots = [] - depot_cache_path = steam_path / 'depotcache' - try: - depot_cache_path.mkdir(exist_ok=True) - if path.endswith('.manifest'): - save_path = depot_cache_path / path - if save_path.exists(): - log.warning(f'已存在清单: {save_path}') - return collected_depots - content = await get(sha, path, repo) - log.info(f'清单下载成功: {path}') - async with aiofiles.open(save_path, 'wb') as f: - await f.write(content) - elif path == 'Key.vdf': - content = await get(sha, path, repo) - log.info(f'密钥下载成功: {path}') - depots_config = vdf.loads(content.decode('utf-8')) - depots = dict(depots_config.get('depots')) - collected_depots = [ - (depot_id, depot_info['DecryptionKey']) - for depot_id, depot_info in depots.items() - ] - except KeyboardInterrupt: - log.info("程序已退出") - except Exception as e: - log.error(f'处理失败: {path} - {stack_error(e)}') + log.error(f"密钥下载失败: {str(e)}") raise - return collected_depots -def get_steam_path() -> Path: +async def handle_depot_files( + repo: str, app_id: str, steam_path: Path +) -> List[Tuple[str, str]]: + """处理清单文件和密钥""" + collected = [] try: - key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Valve\Steam') - steam_path = Path(winreg.QueryValueEx(key, 'SteamPath')[0]) + async with httpx.AsyncClient() as client: + branch_url = f"https://api.github.com/repos/{repo}/branches/{app_id}" + branch_res = await client.get(branch_url) + branch_res.raise_for_status() - custom_steam_path = config.get("Custom_Steam_Path", "").strip() - return Path(custom_steam_path) if custom_steam_path else steam_path - except KeyboardInterrupt: - log.info("程序已退出") + tree_url = branch_res.json()["commit"]["commit"]["tree"]["url"] + tree_res = await client.get(tree_url) + tree_res.raise_for_status() + + depot_cache = steam_path / "depotcache" + depot_cache.mkdir(exist_ok=True) + + for item in tree_res.json()["tree"]: + file_path = item["path"] + if file_path.endswith(".manifest"): + await download_manifest( + file_path, depot_cache, repo, branch_res.json()["commit"]["sha"] + ) + elif "key.vdf" in file_path.lower(): + key_content = await download_key( + file_path, repo, branch_res.json()["commit"]["sha"] + ) + collected.extend(parse_key_vdf(key_content)) + except httpx.HTTPStatusError as e: + log.error(f"HTTP错误: {e.response.status_code}") except Exception as e: - log.error(f'Steam路径获取失败, {stack_error(e)}, 请检查是否正确安装Steam') - os.system('pause') - return Path() + log.error(f"文件处理失败: {str(e)}") + return collected -SP = get_steam_path() -GL = any((SP / dll).exists() for dll in ['GreenLuma_2024_x86.dll', 'GreenLuma_2024_x64.dll', 'User32.dll']) -ST = (SP / 'config' / 'stUI').is_dir() -ST_PT = Path(SP) / "config" / "stplug-in" -TP = Path('./temp') -ST_STP_URL = 'https://steamtools.net/res/SteamtoolsSetup.exe' -STP_FILE = TP / 'SteamtoolsSetup.exe' +async def download_manifest(path: str, save_dir: Path, repo: str, sha: str) -> None: + """下载清单文件""" + save_path = save_dir / path + if save_path.exists(): + log.warning(f"清单已存在: {path}") + return + + content = await fetch_from_cdn(path, repo, sha) + async with aiofiles.open(save_path, "wb") as f: + await f.write(content) + log.info(f"清单下载成功: {path}") -async def download_setup_file() -> None: - log.info('开始下载 SteamTools 安装程序...') - try: - r = await client.get(ST_STP_URL, timeout=30) - if r.status_code == 200: - async with aiofiles.open(STP_FILE, mode='wb') as f: - await f.write(r.read()) - log.info('安装程序下载完成') - else: - log.error(f'网络错误,无法下载安装程序,状态码: {r.status_code}') - except KeyboardInterrupt: - log.info("程序已退出") - except httpx.ConnectTimeout: - log.error('下载时超时') - except Exception as e: - log.error(f'下载失败: {e}') +async def fetch_from_cdn(path: str, repo: str, sha: str) -> bytes: + """从CDN获取资源""" + mirrors = ( + [ + f"https://jsdelivr.pai233.top/gh/{repo}@{sha}/{path}", + f"https://cdn.jsdmirror.com/gh/{repo}@{sha}/{path}", + f"https://raw.gitmirror.com/{repo}/{sha}/{path}", + ] + if os.environ.get("IS_CN") == "yes" + else [f"https://raw.githubusercontent.com/{repo}/{sha}/{path}"] + ) - -async def migrate() -> None: - try: - log.info('检测到你正在使用 SteamTools,尝试迁移旧文件') - if SP.exists(): - for file in SP.iterdir(): - if file.is_file() and file.name.startswith("Onekey_unlock_"): - new_filename = file.name[len("Onekey_unlock_"):] - try: - file.rename(SP / new_filename) - log.info(f'Renamed: {file.name} -> {new_filename}') - except Exception as e: - log.error( - f'重命名失败 {file.name} -> {new_filename}: {e}') - else: - log.error('故障,正在重新安装 SteamTools') - TP.mkdir(parents=True, exist_ok=True) - await download_setup_file(client) - subprocess.run(str(STP_FILE), check=True) - for file in TP.iterdir(): - file.unlink() - TP.rmdir() - except KeyboardInterrupt: - log.info("程序已退出") - - -async def stool_add(depot_data: list, app_id: str) -> bool: - lua_filename = f"{app_id}.lua" - lua_filepath = SP / "config" / "stplug-in" / lua_filename - async with lock: - log.info(f'SteamTools 解锁文件生成: {lua_filepath}') + for url in mirrors: try: - async with aiofiles.open(lua_filepath, mode="w", encoding="utf-8") as lua_file: - await lua_file.write(f'addappid({app_id}, 1, "None")\n') - for depot_id, depot_key in depot_data: - await lua_file.write(f'addappid({depot_id}, 1, "{depot_key}")\n') - luapacka_path = SP / "config" / "stplug-in" / "luapacka.exe" - log.info(f'正在处理文件: {lua_filepath}') - result = subprocess.run( - [str(luapacka_path), str(lua_filepath)], - capture_output=True - ) - if result.returncode != 0: - log.error(f'调用失败: {result.stderr.decode()}') - return False - log.info('处理完成') - except KeyboardInterrupt: - log.info("程序已退出") - except Exception as e: - log.error(f'处理过程出现错误: {e}') - return False - finally: - if lua_filepath.exists(): - os.remove(lua_filepath) - log.info(f'删除临时文件: {lua_filepath}') + res = await CLIENT.get(url) + res.raise_for_status() + return res.content + except httpx.HTTPError: + continue + raise Exception("所有镜像源均不可用") + + +def parse_key_vdf(content: bytes) -> List[Tuple[str, str]]: + """解析密钥文件""" + try: + depots = vdf.loads(content.decode("utf-8"))["depots"] + return [(d_id, d_info["DecryptionKey"]) for d_id, d_info in depots.items()] + except Exception as e: + log.error(f"密钥解析失败: {str(e)}") + return [] + + +async def setup_unlock_tool( + config: Dict, depot_data: List[Tuple[str, str]], app_id: str, tool_choice: int +) -> bool: + """配置解锁工具""" + if tool_choice == 1: + return await setup_steamtools(config, depot_data, app_id) + elif tool_choice == 2: + return await setup_greenluma(config, depot_data) + else: + log.error("无效的工具选择") + return False + + +async def setup_steamtools( + config: Dict, depot_data: List[Tuple[str, str]], app_id: str +) -> bool: + """配置SteamTools""" + steam_path = ( + Path(config["Custom_Steam_Path"]) + if config.get("Custom_Steam_Path") + else get_steam_path(config) + ) + st_path = steam_path / "config" / "stplug-in" + st_path.mkdir(exist_ok=True) + + lua_content = f'addappid({app_id}, 1, "None")\n' + for d_id, d_key in depot_data: + lua_content += f'addappid({d_id}, 1, "{d_key}")\n' + + lua_file = st_path / f"{app_id}.lua" + async with aiofiles.open(lua_file, "w") as f: + await f.write(lua_content) + + proc = await asyncio.create_subprocess_exec( + str(st_path / "luapacka.exe"), + str(lua_file), + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE, + ) + await proc.wait() + + if proc.returncode != 0: + log.error(f"Lua编译失败: {await proc.stderr.read()}") + return False return True -async def greenluma_add(depot_id_list: list) -> bool: - app_list_path = SP / 'AppList' - try: - app_list_path.mkdir(parents=True, exist_ok=True) - for file in app_list_path.glob('*.txt'): - file.unlink(missing_ok=True) - depot_dict = { - int(i.stem): int(i.read_text(encoding='utf-8').strip()) - for i in app_list_path.iterdir() if i.is_file() and i.stem.isdecimal() and i.suffix == '.txt' - } - for depot_id in map(int, depot_id_list): - if depot_id not in depot_dict.values(): - index = max(depot_dict.keys(), default=-1) + 1 - while index in depot_dict: - index += 1 - (app_list_path / - f'{index}.txt').write_text(str(depot_id), encoding='utf-8') - depot_dict[index] = depot_id - return True - except Exception as e: - print(f'处理时出错: {e}') - return False +async def setup_greenluma(config: Dict, depot_data: List[Tuple[str, str]]) -> bool: + """配置GreenLuma""" + steam_path = ( + Path(config["Custom_Steam_Path"]) + if config.get("Custom_Steam_Path") + else get_steam_path(config) + ) + applist_dir = steam_path / "AppList" + applist_dir.mkdir(exist_ok=True) + + for f in applist_dir.glob("*.txt"): + f.unlink() + + for idx, (d_id, _) in enumerate(depot_data, 1): + (applist_dir / f"{idx}.txt").write_text(str(d_id)) + + config_path = steam_path / "config" / "config.vdf" + async with aiofiles.open(config_path, "r+") as f: + content = vdf.loads(await f.read()) + content.setdefault("depots", {}).update( + {d_id: {"DecryptionKey": d_key} for d_id, d_key in depot_data} + ) + await f.seek(0) + await f.write(vdf.dumps(content)) + return True -async def fetch_branch_info(url, headers) -> str | None: - try: - r = await client.get(url, headers=headers) - return r.json() - except KeyboardInterrupt: - log.info("程序已退出") - except Exception as e: - log.error(f'获取信息失败: {stack_error(e)}') - return None - except httpx.ConnectTimeout as e: - log.error(f'获取信息时超时: {stack_error(e)}') - return None - - -async def get_latest_repo_info(repos: list, app_id: str, headers) -> Any | None: - latest_date = None - selected_repo = None - for repo in repos: - url = f'https://api.github.com/repos/{repo}/branches/{app_id}' - r_json = await fetch_branch_info(url, headers) - if r_json and 'commit' in r_json: - date = r_json['commit']['commit']['author']['date'] - if (latest_date is None) or (date > latest_date): - latest_date = date - selected_repo = repo - - return selected_repo, latest_date - - -async def main(app_id: str, repos: list) -> bool: - app_id_list = list(filter(str.isdecimal, app_id.strip().split('-'))) - if not app_id_list: - log.error(f'App ID无效') - return False - app_id = app_id_list[0] - github_token = config.get("Github_Personal_Token", "") - headers = {'Authorization': f'Bearer {github_token}'} if github_token else None - await checkcn() - await check_github_api_rate_limit(headers) - selected_repo, latest_date = await get_latest_repo_info(repos, app_id, headers) - if (selected_repo): - log.info(f'选择清单仓库: {selected_repo}') - url = f'https://api.github.com/repos/{selected_repo}/branches/{app_id}' - r_json = await fetch_branch_info(url, headers) - if (r_json) and ('commit' in r_json): - sha = r_json['commit']['sha'] - url = r_json['commit']['commit']['tree']['url'] - r2_json = await fetch_branch_info(url, headers) - if (r2_json) and ('tree' in r2_json): - collected_depots = [] - for item in r2_json['tree']: - result = await get_manifest(sha, item['path'], SP, selected_repo) - collected_depots.extend(result) - if collected_depots: - if ST: - await migrate() - await stool_add(collected_depots, app_id) - log.info('找到SteamTools, 已添加解锁文件') - elif GL: - await greenluma_add([app_id]) - depot_config = {'depots': {depot_id: {'DecryptionKey': depot_key} for depot_id, depot_key in collected_depots}} - await depotkey_merge(SP / 'config' / 'config.vdf', depot_config) - if await greenluma_add([int(i) for i in depot_config['depots'] if i.isdecimal()]): - log.info('找到GreenLuma, 已添加解锁文件') - log.info(f'清单最后更新时间: {latest_date}') - log.info(f'入库成功: {app_id}') - await client.aclose() - os.system('pause') - return True - log.error(f'清单下载或生成失败: {app_id}') - await client.aclose() - os.system('pause') - return False - - -if __name__ == '__main__': +async def main_flow(): + """主流程控制""" + validate_windows_version() init() + try: - repos = [ - 'ikun0014/ManifestHub', - 'Auiowu/ManifestAutoUpdate', - ] - app_id = input(f"{Fore.CYAN}{Back.BLACK}{Style.BRIGHT}请输入游戏AppID: {Style.RESET_ALL}").strip() - asyncio.run(main(app_id, repos)) - except KeyboardInterrupt: - log.info("程序已退出") - except SystemExit: - sys.exit() + app_id = input("请输入游戏AppID: ").strip() + if not app_id.isdigit(): + raise ValueError("无效的AppID") + + print( + "\n".join( + [f"{idx+1}. {item.value[1]}" for idx, item in enumerate(RepoChoice)] + ) + ) + repo_choice = int(input("请选择清单仓库 (默认3): ") or 3) + selected_repo = list(RepoChoice)[repo_choice - 1].value[0] + + tool_choice = int(input("请选择解锁工具 (1.SteamTools 2.GreenLuma): ")) + + config = await load_config() + steam_path = get_steam_path(config) + depot_data = await handle_depot_files(selected_repo, app_id, steam_path) + + if await setup_unlock_tool(config, depot_data, app_id, tool_choice): + log.info("游戏解锁配置成功!") + if tool_choice == 1: + log.info("请重启SteamTools生效") + elif tool_choice == 2: + log.info("请重启GreenLuma生效") + else: + log.error("配置失败,请检查日志") + except Exception as e: + log.error(f"运行错误: {str(e)}") + log.debug(traceback.format_exc()) + finally: + await CLIENT.aclose() + + +if __name__ == "__main__": + asyncio.run(main_flow()) + os.system("pause") diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..b0bcc7e --- /dev/null +++ b/poetry.lock @@ -0,0 +1,336 @@ +# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. + +[[package]] +name = "aiofiles" +version = "24.1.0" +description = "File support for asyncio." +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "aiofiles-24.1.0-py3-none-any.whl", hash = "sha256:b4ec55f4195e3eb5d7abd1bf7e061763e864dd4954231fb8539a0ef8bb8260e5"}, + {file = "aiofiles-24.1.0.tar.gz", hash = "sha256:22a075c9e5a3810f0c2e48f3008c94d68c65d763b9b03857924c99e57355166c"}, +] + +[[package]] +name = "anyio" +version = "4.8.0" +description = "High level compatibility layer for multiple asynchronous event loop implementations" +optional = false +python-versions = ">=3.9" +groups = ["main"] +files = [ + {file = "anyio-4.8.0-py3-none-any.whl", hash = "sha256:b5011f270ab5eb0abf13385f851315585cc37ef330dd88e27ec3d34d651fd47a"}, + {file = "anyio-4.8.0.tar.gz", hash = "sha256:1d9fe889df5212298c0c0723fa20479d1b94883a2df44bd3897aa91083316f7a"}, +] + +[package.dependencies] +idna = ">=2.8" +sniffio = ">=1.1" + +[package.extras] +doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx_rtd_theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "trustme", "truststore (>=0.9.1) ; python_version >= \"3.10\"", "uvloop (>=0.21) ; platform_python_implementation == \"CPython\" and platform_system != \"Windows\" and python_version < \"3.14\""] +trio = ["trio (>=0.26.1)"] + +[[package]] +name = "certifi" +version = "2025.1.31" +description = "Python package for providing Mozilla's CA Bundle." +optional = false +python-versions = ">=3.6" +groups = ["main"] +files = [ + {file = "certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe"}, + {file = "certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651"}, +] + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["main"] +markers = "sys_platform == \"win32\"" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "h11" +version = "0.14.0" +description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" +optional = false +python-versions = ">=3.7" +groups = ["main"] +files = [ + {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, + {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, +] + +[[package]] +name = "httpcore" +version = "1.0.7" +description = "A minimal low-level HTTP client." +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd"}, + {file = "httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c"}, +] + +[package.dependencies] +certifi = "*" +h11 = ">=0.13,<0.15" + +[package.extras] +asyncio = ["anyio (>=4.0,<5.0)"] +http2 = ["h2 (>=3,<5)"] +socks = ["socksio (==1.*)"] +trio = ["trio (>=0.22.0,<1.0)"] + +[[package]] +name = "httpx" +version = "0.28.1" +description = "The next generation HTTP client." +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"}, + {file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"}, +] + +[package.dependencies] +anyio = "*" +certifi = "*" +httpcore = "==1.*" +idna = "*" + +[package.extras] +brotli = ["brotli ; platform_python_implementation == \"CPython\"", "brotlicffi ; platform_python_implementation != \"CPython\""] +cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"] +http2 = ["h2 (>=3,<5)"] +socks = ["socksio (==1.*)"] +zstd = ["zstandard (>=0.18.0)"] + +[[package]] +name = "idna" +version = "3.10" +description = "Internationalized Domain Names in Applications (IDNA)" +optional = false +python-versions = ">=3.6" +groups = ["main"] +files = [ + {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, + {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, +] + +[package.extras] +all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] + +[[package]] +name = "logzero" +version = "1.7.0" +description = "Robust and effective logging for Python 2 and 3" +optional = false +python-versions = "*" +groups = ["main"] +files = [ + {file = "logzero-1.7.0-py2.py3-none-any.whl", hash = "sha256:23eb1f717a2736f9ab91ca0d43160fd2c996ad49ae6bad34652d47aba908769d"}, + {file = "logzero-1.7.0.tar.gz", hash = "sha256:7f73ddd3ae393457236f081ffebd044a3aa2e423a47ae6ddb5179ab90d0ad082"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} + +[[package]] +name = "markdown-it-py" +version = "3.0.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, + {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, +] + +[package.dependencies] +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark"] +code-style = ["pre-commit (>=3.0,<4.0)"] +compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] +linkify = ["linkify-it-py (>=1,<3)"] +plugins = ["mdit-py-plugins"] +profiling = ["gprof2dot"] +rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +optional = false +python-versions = ">=3.7" +groups = ["main"] +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, +] + +[[package]] +name = "pygments" +version = "2.19.1" +description = "Pygments is a syntax highlighting package written in Python." +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"}, + {file = "pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"}, +] + +[package.extras] +windows-terminal = ["colorama (>=0.4.6)"] + +[[package]] +name = "rich" +version = "13.9.4" +description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" +optional = false +python-versions = ">=3.8.0" +groups = ["main"] +files = [ + {file = "rich-13.9.4-py3-none-any.whl", hash = "sha256:6049d5e6ec054bf2779ab3358186963bac2ea89175919d699e378b99738c2a90"}, + {file = "rich-13.9.4.tar.gz", hash = "sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098"}, +] + +[package.dependencies] +markdown-it-py = ">=2.2.0" +pygments = ">=2.13.0,<3.0.0" + +[package.extras] +jupyter = ["ipywidgets (>=7.5.1,<9)"] + +[[package]] +name = "sniffio" +version = "1.3.1" +description = "Sniff out which async library your code is running under" +optional = false +python-versions = ">=3.7" +groups = ["main"] +files = [ + {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, + {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, +] + +[[package]] +name = "ujson" +version = "5.10.0" +description = "Ultra fast JSON encoder and decoder for Python" +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "ujson-5.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2601aa9ecdbee1118a1c2065323bda35e2c5a2cf0797ef4522d485f9d3ef65bd"}, + {file = "ujson-5.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:348898dd702fc1c4f1051bc3aacbf894caa0927fe2c53e68679c073375f732cf"}, + {file = "ujson-5.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22cffecf73391e8abd65ef5f4e4dd523162a3399d5e84faa6aebbf9583df86d6"}, + {file = "ujson-5.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:26b0e2d2366543c1bb4fbd457446f00b0187a2bddf93148ac2da07a53fe51569"}, + {file = "ujson-5.10.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:caf270c6dba1be7a41125cd1e4fc7ba384bf564650beef0df2dd21a00b7f5770"}, + {file = "ujson-5.10.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a245d59f2ffe750446292b0094244df163c3dc96b3ce152a2c837a44e7cda9d1"}, + {file = "ujson-5.10.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:94a87f6e151c5f483d7d54ceef83b45d3a9cca7a9cb453dbdbb3f5a6f64033f5"}, + {file = "ujson-5.10.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:29b443c4c0a113bcbb792c88bea67b675c7ca3ca80c3474784e08bba01c18d51"}, + {file = "ujson-5.10.0-cp310-cp310-win32.whl", hash = "sha256:c18610b9ccd2874950faf474692deee4223a994251bc0a083c114671b64e6518"}, + {file = "ujson-5.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:924f7318c31874d6bb44d9ee1900167ca32aa9b69389b98ecbde34c1698a250f"}, + {file = "ujson-5.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a5b366812c90e69d0f379a53648be10a5db38f9d4ad212b60af00bd4048d0f00"}, + {file = "ujson-5.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:502bf475781e8167f0f9d0e41cd32879d120a524b22358e7f205294224c71126"}, + {file = "ujson-5.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5b91b5d0d9d283e085e821651184a647699430705b15bf274c7896f23fe9c9d8"}, + {file = "ujson-5.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:129e39af3a6d85b9c26d5577169c21d53821d8cf68e079060602e861c6e5da1b"}, + {file = "ujson-5.10.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f77b74475c462cb8b88680471193064d3e715c7c6074b1c8c412cb526466efe9"}, + {file = "ujson-5.10.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:7ec0ca8c415e81aa4123501fee7f761abf4b7f386aad348501a26940beb1860f"}, + {file = "ujson-5.10.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:ab13a2a9e0b2865a6c6db9271f4b46af1c7476bfd51af1f64585e919b7c07fd4"}, + {file = "ujson-5.10.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:57aaf98b92d72fc70886b5a0e1a1ca52c2320377360341715dd3933a18e827b1"}, + {file = "ujson-5.10.0-cp311-cp311-win32.whl", hash = "sha256:2987713a490ceb27edff77fb184ed09acdc565db700ee852823c3dc3cffe455f"}, + {file = "ujson-5.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:f00ea7e00447918ee0eff2422c4add4c5752b1b60e88fcb3c067d4a21049a720"}, + {file = "ujson-5.10.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:98ba15d8cbc481ce55695beee9f063189dce91a4b08bc1d03e7f0152cd4bbdd5"}, + {file = "ujson-5.10.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a9d2edbf1556e4f56e50fab7d8ff993dbad7f54bac68eacdd27a8f55f433578e"}, + {file = "ujson-5.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6627029ae4f52d0e1a2451768c2c37c0c814ffc04f796eb36244cf16b8e57043"}, + {file = "ujson-5.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f8ccb77b3e40b151e20519c6ae6d89bfe3f4c14e8e210d910287f778368bb3d1"}, + {file = "ujson-5.10.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f3caf9cd64abfeb11a3b661329085c5e167abbe15256b3b68cb5d914ba7396f3"}, + {file = "ujson-5.10.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6e32abdce572e3a8c3d02c886c704a38a1b015a1fb858004e03d20ca7cecbb21"}, + {file = "ujson-5.10.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:a65b6af4d903103ee7b6f4f5b85f1bfd0c90ba4eeac6421aae436c9988aa64a2"}, + {file = "ujson-5.10.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:604a046d966457b6cdcacc5aa2ec5314f0e8c42bae52842c1e6fa02ea4bda42e"}, + {file = "ujson-5.10.0-cp312-cp312-win32.whl", hash = "sha256:6dea1c8b4fc921bf78a8ff00bbd2bfe166345f5536c510671bccececb187c80e"}, + {file = "ujson-5.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:38665e7d8290188b1e0d57d584eb8110951a9591363316dd41cf8686ab1d0abc"}, + {file = "ujson-5.10.0-cp313-cp313-macosx_10_9_x86_64.whl", hash = "sha256:618efd84dc1acbd6bff8eaa736bb6c074bfa8b8a98f55b61c38d4ca2c1f7f287"}, + {file = "ujson-5.10.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:38d5d36b4aedfe81dfe251f76c0467399d575d1395a1755de391e58985ab1c2e"}, + {file = "ujson-5.10.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:67079b1f9fb29ed9a2914acf4ef6c02844b3153913eb735d4bf287ee1db6e557"}, + {file = "ujson-5.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7d0e0ceeb8fe2468c70ec0c37b439dd554e2aa539a8a56365fd761edb418988"}, + {file = "ujson-5.10.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:59e02cd37bc7c44d587a0ba45347cc815fb7a5fe48de16bf05caa5f7d0d2e816"}, + {file = "ujson-5.10.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:2a890b706b64e0065f02577bf6d8ca3b66c11a5e81fb75d757233a38c07a1f20"}, + {file = "ujson-5.10.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:621e34b4632c740ecb491efc7f1fcb4f74b48ddb55e65221995e74e2d00bbff0"}, + {file = "ujson-5.10.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b9500e61fce0cfc86168b248104e954fead61f9be213087153d272e817ec7b4f"}, + {file = "ujson-5.10.0-cp313-cp313-win32.whl", hash = "sha256:4c4fc16f11ac1612f05b6f5781b384716719547e142cfd67b65d035bd85af165"}, + {file = "ujson-5.10.0-cp313-cp313-win_amd64.whl", hash = "sha256:4573fd1695932d4f619928fd09d5d03d917274381649ade4328091ceca175539"}, + {file = "ujson-5.10.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:a984a3131da7f07563057db1c3020b1350a3e27a8ec46ccbfbf21e5928a43050"}, + {file = "ujson-5.10.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:73814cd1b9db6fc3270e9d8fe3b19f9f89e78ee9d71e8bd6c9a626aeaeaf16bd"}, + {file = "ujson-5.10.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:61e1591ed9376e5eddda202ec229eddc56c612b61ac6ad07f96b91460bb6c2fb"}, + {file = "ujson-5.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2c75269f8205b2690db4572a4a36fe47cd1338e4368bc73a7a0e48789e2e35a"}, + {file = "ujson-5.10.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7223f41e5bf1f919cd8d073e35b229295aa8e0f7b5de07ed1c8fddac63a6bc5d"}, + {file = "ujson-5.10.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:d4dc2fd6b3067c0782e7002ac3b38cf48608ee6366ff176bbd02cf969c9c20fe"}, + {file = "ujson-5.10.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:232cc85f8ee3c454c115455195a205074a56ff42608fd6b942aa4c378ac14dd7"}, + {file = "ujson-5.10.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:cc6139531f13148055d691e442e4bc6601f6dba1e6d521b1585d4788ab0bfad4"}, + {file = "ujson-5.10.0-cp38-cp38-win32.whl", hash = "sha256:e7ce306a42b6b93ca47ac4a3b96683ca554f6d35dd8adc5acfcd55096c8dfcb8"}, + {file = "ujson-5.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:e82d4bb2138ab05e18f089a83b6564fee28048771eb63cdecf4b9b549de8a2cc"}, + {file = "ujson-5.10.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:dfef2814c6b3291c3c5f10065f745a1307d86019dbd7ea50e83504950136ed5b"}, + {file = "ujson-5.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4734ee0745d5928d0ba3a213647f1c4a74a2a28edc6d27b2d6d5bd9fa4319e27"}, + {file = "ujson-5.10.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d47ebb01bd865fdea43da56254a3930a413f0c5590372a1241514abae8aa7c76"}, + {file = "ujson-5.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dee5e97c2496874acbf1d3e37b521dd1f307349ed955e62d1d2f05382bc36dd5"}, + {file = "ujson-5.10.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7490655a2272a2d0b072ef16b0b58ee462f4973a8f6bbe64917ce5e0a256f9c0"}, + {file = "ujson-5.10.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:ba17799fcddaddf5c1f75a4ba3fd6441f6a4f1e9173f8a786b42450851bd74f1"}, + {file = "ujson-5.10.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:2aff2985cef314f21d0fecc56027505804bc78802c0121343874741650a4d3d1"}, + {file = "ujson-5.10.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:ad88ac75c432674d05b61184178635d44901eb749786c8eb08c102330e6e8996"}, + {file = "ujson-5.10.0-cp39-cp39-win32.whl", hash = "sha256:2544912a71da4ff8c4f7ab5606f947d7299971bdd25a45e008e467ca638d13c9"}, + {file = "ujson-5.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:3ff201d62b1b177a46f113bb43ad300b424b7847f9c5d38b1b4ad8f75d4a282a"}, + {file = "ujson-5.10.0-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:5b6fee72fa77dc172a28f21693f64d93166534c263adb3f96c413ccc85ef6e64"}, + {file = "ujson-5.10.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:61d0af13a9af01d9f26d2331ce49bb5ac1fb9c814964018ac8df605b5422dcb3"}, + {file = "ujson-5.10.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ecb24f0bdd899d368b715c9e6664166cf694d1e57be73f17759573a6986dd95a"}, + {file = "ujson-5.10.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fbd8fd427f57a03cff3ad6574b5e299131585d9727c8c366da4624a9069ed746"}, + {file = "ujson-5.10.0-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:beeaf1c48e32f07d8820c705ff8e645f8afa690cca1544adba4ebfa067efdc88"}, + {file = "ujson-5.10.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:baed37ea46d756aca2955e99525cc02d9181de67f25515c468856c38d52b5f3b"}, + {file = "ujson-5.10.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:7663960f08cd5a2bb152f5ee3992e1af7690a64c0e26d31ba7b3ff5b2ee66337"}, + {file = "ujson-5.10.0-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:d8640fb4072d36b08e95a3a380ba65779d356b2fee8696afeb7794cf0902d0a1"}, + {file = "ujson-5.10.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78778a3aa7aafb11e7ddca4e29f46bc5139131037ad628cc10936764282d6753"}, + {file = "ujson-5.10.0-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b0111b27f2d5c820e7f2dbad7d48e3338c824e7ac4d2a12da3dc6061cc39c8e6"}, + {file = "ujson-5.10.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:c66962ca7565605b355a9ed478292da628b8f18c0f2793021ca4425abf8b01e5"}, + {file = "ujson-5.10.0-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:ba43cc34cce49cf2d4bc76401a754a81202d8aa926d0e2b79f0ee258cb15d3a4"}, + {file = "ujson-5.10.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:ac56eb983edce27e7f51d05bc8dd820586c6e6be1c5216a6809b0c668bb312b8"}, + {file = "ujson-5.10.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f44bd4b23a0e723bf8b10628288c2c7c335161d6840013d4d5de20e48551773b"}, + {file = "ujson-5.10.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7c10f4654e5326ec14a46bcdeb2b685d4ada6911050aa8baaf3501e57024b804"}, + {file = "ujson-5.10.0-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0de4971a89a762398006e844ae394bd46991f7c385d7a6a3b93ba229e6dac17e"}, + {file = "ujson-5.10.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:e1402f0564a97d2a52310ae10a64d25bcef94f8dd643fcf5d310219d915484f7"}, + {file = "ujson-5.10.0.tar.gz", hash = "sha256:b3cd8f3c5d8c7738257f1018880444f7b7d9b66232c64649f562d7ba86ad4bc1"}, +] + +[[package]] +name = "vdf" +version = "3.4" +description = "Library for working with Valve's VDF text format" +optional = false +python-versions = "*" +groups = ["main"] +files = [ + {file = "vdf-3.4-py2.py3-none-any.whl", hash = "sha256:68c1a125cc49e343d535af2dd25074e9cb0908c6607f073947c4a04bbe234534"}, + {file = "vdf-3.4.tar.gz", hash = "sha256:fd5419f41e07a1009e5ffd027c7dcbe43d1f7e8ef453aeaa90d9d04b807de2af"}, +] + +[metadata] +lock-version = "2.1" +python-versions = ">=3.13" +content-hash = "2f0829e2043d12d54b37941d1a7395b27c8d4793b5f921b6b39b743b08553287" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..660e450 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[project] +name = "onekey" +version = "0.1.0" +description = "A Steam Depot Cache Downloader" +authors = [ + {name = "ikun0014",email = "ikun0014@qq.com"} +] +readme = "README.md" +requires-python = ">=3.13" +dependencies = [ + "aiofiles (>=24.1.0,<25.0.0)", + "logzero (>=1.7.0,<2.0.0)", + "httpx (>=0.28.1,<0.29.0)", + "rich (>=13.9.4,<14.0.0)", + "ujson (>=5.10.0,<6.0.0)", + "vdf (>=3.4,<4.0)" +] + +[tool.poetry] +packages = [{include = "onekey", from = "."}] + + +[build-system] +requires = ["poetry-core>=2.0.0,<3.0.0"] +build-backend = "poetry.core.masonry.api"