This commit is contained in:
WangXianming
2024-10-12 19:23:41 +08:00
12 changed files with 37 additions and 15 deletions

View File

@@ -7,6 +7,8 @@ on:
jobs:
build:
permissions:
contents: write
runs-on: windows-2019
steps:
- name: Check out git repository
@@ -70,3 +72,7 @@ jobs:
build/Onekey---v${{ env.PACKAGE_VERSION }}.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to Telegram Channel
run: |
curl -F chat_id=${{ secrets.TELEGRAM_TO }} \ -F document=@build/Onekey---v${{ env.PACKAGE_VERSION }}.exe \ -F caption="Onekey 's New Update ${{ env.PACKAGE_VERSION }}" \ -F parse_mode=Markdown \ https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument

View File

@@ -28,7 +28,7 @@ async def gen_config_file():
log.info('🖱️ 程序可能为第一次启动或配置重置,请填写配置文件后重新启动程序')
except Exception as e:
log.error(f' 配置文件生成失败,{stack_error(e)}')
log.error(f' 配置文件生成失败,{stack_error(e)}')
async def load_config():
if not os.path.exists('./config.json'):

View File

@@ -36,5 +36,5 @@ async def depotkey_merge(config_path: Path, depots_config: dict) -> bool:
except Exception as e:
async with lock:
log.error(f' 合并失败,原因: {e}')
log.error(f' 合并失败,原因: {e}')
return False

View File

@@ -37,7 +37,7 @@ async def get_manifest(sha: str, path: str, steam_path: Path, repo: str, session
]
except Exception as e:
log.error(f' 处理失败: {path} - {stack_error(e)}')
log.error(f' 处理失败: {path} - {stack_error(e)}')
raise
return collected_depots

View File

@@ -13,7 +13,7 @@ def get_steam_path() -> Path:
custom_steam_path = config.get("Custom_Steam_Path", "").strip()
return Path(custom_steam_path) if custom_steam_path else steam_path
except Exception as e:
log.error(f'Steam路径获取失败, {stack_error(e)}')
log.error(f'Steam路径获取失败, {stack_error(e)}, 请检查是否正确安装Steam')
os.system('pause')
return Path()

View File

@@ -28,5 +28,5 @@ async def greenluma_add(depot_id_list: list) -> bool:
return True
except Exception as e:
print(f' 处理时出错: {e}')
print(f' 处理时出错: {e}')
return False

View File

@@ -18,7 +18,7 @@ def init():
log.info('作者ikun0014')
log.info('本项目采用GNU General Public License v3开源许可证')
log.info('版本1.2.4')
log.info('版本1.2.5')
log.info('项目仓库https://github.com/ikunshare/Onekey')
log.info('官网ikunshare.com')
log.warning('本项目完全开源免费如果你在淘宝QQ群内通过购买方式获得赶紧回去骂商家死全家\n交流群组:\nhttps://qm.qq.com/q/d7sWovfAGI\nhttps://t.me/ikunshare_group')
log.warning('本项目完全开源免费如果你在淘宝QQ群内通过购买方式获得赶紧回去骂商家死全家\n交流群组:\nhttps://qm.qq.com/q/d7sWovfAGI\nhttps://t.me/ikunshare_qun')

View File

@@ -1,6 +1,5 @@
from aiohttp import ClientError, ClientResponse
from aiohttp import ClientError
from tqdm.asyncio import tqdm_asyncio
from typing import Union
from .log import log
@@ -37,7 +36,7 @@ async def get(sha: str, path: str, repo: str, session, chunk_size: int = 1024) -
total_size = int(response.headers.get('Content-Length', 0))
content = bytearray()
with tqdm_asyncio(total=total_size, unit='B', unit_scale=True, desc=f'下载 {path}', colour='#ffadad') as pbar:
with tqdm_asyncio(total=total_size, unit='B', unit_scale=True, desc=f'🔄 下载 {path}', colour='#ffadad') as pbar:
async for chunk in response.content.iter_chunked(chunk_size):
content.extend(chunk)
pbar.update(len(chunk))

View File

@@ -1,4 +1,3 @@
import os
import subprocess
import aiofiles
from pathlib import Path

View File

@@ -34,7 +34,7 @@ async def stool_add(depot_data: list, app_id: str) -> bool:
log.info('✅ 处理完成')
except Exception as e:
log.error(f' 处理过程出现错误: {e}')
log.error(f' 处理过程出现错误: {e}')
return False
finally:
if lua_filepath.exists():

22
main.py
View File

@@ -1,8 +1,7 @@
import os
import time
import sys
import asyncio
import re
import platform
from colorama import Fore, Back, Style
from colorama import init as cinit
@@ -22,6 +21,24 @@ repos = [
'tymolu233/ManifestAutoUpdate',
]
def check_system_msg():
os_type = platform.system()
try:
if os_type != 'Windows':
log.error(f'❌ 不用Windows你想上天{os_type}')
sys.quit()
except Exception as e:
log.error(f'❌ 获取系统类型失败:{stack_error(e)}')
sys.quit()
os_version = sys.getwindowsversion().major
try:
if os_version < 10:
log.error(f'❌ 低于Windows10就别用了买台新电脑吧当前版本Windows {os_version}')
sys.quit()
except Exception as e:
log.error(f'❌ 获取系统版本失败:{stack_error(e)}')
sys.quit()
def prompt_app_id():
app_id = input(f"{Fore.CYAN}{Back.BLACK}{Style.BRIGHT}🤔 请输入游戏AppID{Style.RESET_ALL}").strip()
if re.match(r'^\d+$', app_id):
@@ -51,6 +68,7 @@ async def run():
if __name__ == '__main__':
try:
check_system_msg()
asyncio.run(run())
except SystemExit:
sys.exit()

View File

@@ -1,6 +1,6 @@
{
"name": "onekey",
"version": "1.2.4",
"version": "1.2.5",
"description": "一个Steam仓库清单下载器",
"main": "index.js",
"scripts": {