From fc039791070ebbf04481b02d6b8297696557a6e5 Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Fri, 11 Oct 2024 20:04:42 +0800 Subject: [PATCH 1/9] =?UTF-8?q?chore:=20=E4=B8=9D=E6=BB=91=E5=88=B7?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 15 +++++++++++++++ common/config.py | 2 +- common/dkey_merge.py | 2 +- common/get_manifest_info.py | 2 +- common/get_steam_path.py | 2 +- common/gl_unlock.py | 2 +- common/init_text.py | 4 ++-- common/manifest_down.py | 5 ++--- common/migration.py | 1 - common/st_unlock.py | 2 +- main.py | 18 ++++++++++++++++-- 11 files changed, 41 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e89bec0..a427e84 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,3 +70,18 @@ jobs: build/Onekey---v${{ env.PACKAGE_VERSION }}.exe env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload to Telegram Channel + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + ${{ github.actor }} created commit: + Commit message: ${{ github.event.commits[0].message }} + + Repository: ${{ github.repository }} + + See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} + document: | + build/Onekey---v${{ env.PACKAGE_VERSION }}.exe diff --git a/common/config.py b/common/config.py index c96b32a..c0e5ccf 100644 --- a/common/config.py +++ b/common/config.py @@ -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'): diff --git a/common/dkey_merge.py b/common/dkey_merge.py index f5752fd..1fee7e4 100644 --- a/common/dkey_merge.py +++ b/common/dkey_merge.py @@ -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 diff --git a/common/get_manifest_info.py b/common/get_manifest_info.py index fec2006..e97b251 100644 --- a/common/get_manifest_info.py +++ b/common/get_manifest_info.py @@ -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 diff --git a/common/get_steam_path.py b/common/get_steam_path.py index eaa20fc..bfe113e 100644 --- a/common/get_steam_path.py +++ b/common/get_steam_path.py @@ -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() diff --git a/common/gl_unlock.py b/common/gl_unlock.py index 98b4057..43d0362 100644 --- a/common/gl_unlock.py +++ b/common/gl_unlock.py @@ -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 diff --git a/common/init_text.py b/common/init_text.py index 368b27b..943e195 100644 --- a/common/init_text.py +++ b/common/init_text.py @@ -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') diff --git a/common/manifest_down.py b/common/manifest_down.py index 6cd0463..8471728 100644 --- a/common/manifest_down.py +++ b/common/manifest_down.py @@ -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)) diff --git a/common/migration.py b/common/migration.py index d017987..f9f1043 100644 --- a/common/migration.py +++ b/common/migration.py @@ -1,4 +1,3 @@ -import os import subprocess import aiofiles from pathlib import Path diff --git a/common/st_unlock.py b/common/st_unlock.py index 882f03f..7d44f0a 100644 --- a/common/st_unlock.py +++ b/common/st_unlock.py @@ -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(): diff --git a/main.py b/main.py index 33d9912..346fc1f 100644 --- a/main.py +++ b/main.py @@ -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,20 @@ repos = [ 'tymolu233/ManifestAutoUpdate', ] +def check_system_msg(): + os_type = platform.system() + try: + if not os_type == 'Windows': + log.error(f'❌ 不用Windows你想上天?{os_type}') + except Exception as e: + log.error(f'❌ 获取系统类型失败:{stack_error(e)}') + os_version = sys.getwindowsversion().major + try: + if os_version < 10: + log.error(f'❌ 低于Windows10就别用了买台新电脑吧!当前版本:Windows {os_version}') + except Exception as e: + log.error(f'❌ 获取系统版本失败:{stack_error(e)}') + 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 +64,7 @@ async def run(): if __name__ == '__main__': try: + check_system_msg() asyncio.run(run()) except SystemExit: sys.exit() From b87867088bafc9cad9046d70a791ffe2632a3299 Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Fri, 11 Oct 2024 20:05:01 +0800 Subject: [PATCH 2/9] 1.2.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5fd850b..bf9610f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onekey", - "version": "1.2.4", + "version": "1.2.5", "description": "一个Steam仓库清单下载器", "main": "index.js", "scripts": { From 7135e13fd787d699f9e318ba3876e9da978342ca Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Fri, 11 Oct 2024 20:12:30 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20build.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a427e84..d3b1992 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,8 @@ on: jobs: build: + permissions: + contents: write runs-on: windows-2019 steps: - name: Check out git repository From f8bc9ace699efbe2e47942417796c02a5f5839bb Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Fri, 11 Oct 2024 21:21:25 +0800 Subject: [PATCH 4/9] =?UTF-8?q?chore:=20=E8=AE=A9=E6=88=91=E5=BE=AE?= =?UTF-8?q?=E8=B0=83=E4=B8=80=E4=B8=8B=EF=BC=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 20 +++++++------------- main.py | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3b1992..06228f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,16 +74,10 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload to Telegram Channel - uses: appleboy/telegram-action@master - with: - to: ${{ secrets.TELEGRAM_TO }} - token: ${{ secrets.TELEGRAM_TOKEN }} - message: | - ${{ github.actor }} created commit: - Commit message: ${{ github.event.commits[0].message }} - - Repository: ${{ github.repository }} - - See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} - document: | - build/Onekey---v${{ env.PACKAGE_VERSION }}.exe + run: | + curl -F chat_id=${{ secrets.TELEGRAM_TO }} \ + -F document=@build/Onekey---v${{ env.PACKAGE_VERSION }}.exe \ + -F caption="${{ github.actor }} created commit:\nCommit message: ${{ github.event.commits[0].message }}\n\nRepository: ${{ github.repository }}\n\nSee changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}" \ + -F parse_mode=Markdown \ + https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument + diff --git a/main.py b/main.py index 346fc1f..1df60fb 100644 --- a/main.py +++ b/main.py @@ -24,7 +24,7 @@ repos = [ def check_system_msg(): os_type = platform.system() try: - if not os_type == 'Windows': + if os_type != 'Windows': log.error(f'❌ 不用Windows你想上天?{os_type}') except Exception as e: log.error(f'❌ 获取系统类型失败:{stack_error(e)}') From afdcc5d51ec45497342c36a496e8f4e8ec807c89 Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Fri, 11 Oct 2024 21:48:18 +0800 Subject: [PATCH 5/9] fix --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06228f6..cc912be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,4 +80,5 @@ jobs: -F caption="${{ github.actor }} created commit:\nCommit message: ${{ github.event.commits[0].message }}\n\nRepository: ${{ github.repository }}\n\nSee changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}" \ -F parse_mode=Markdown \ https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument + shell: cmd From 57f285af37fb16da68e69b4d2a9bce0f4ad3bee7 Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Sat, 12 Oct 2024 15:57:10 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20=E8=BF=99=E6=AC=A1=E6=80=BB=E8=83=BD?= =?UTF-8?q?=E7=94=A8=E4=BA=86=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc912be..9416369 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,10 +75,4 @@ jobs: - name: Upload to Telegram Channel run: | - curl -F chat_id=${{ secrets.TELEGRAM_TO }} \ - -F document=@build/Onekey---v${{ env.PACKAGE_VERSION }}.exe \ - -F caption="${{ github.actor }} created commit:\nCommit message: ${{ github.event.commits[0].message }}\n\nRepository: ${{ github.repository }}\n\nSee changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}" \ - -F parse_mode=Markdown \ - https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument - shell: cmd - + curl -F chat_id=${{ secrets.TELEGRAM_TO }} \ -F document=@build/Onekey---v${{ env.PACKAGE_VERSION }}.exe \ -F caption="${{ github.actor }} created commit:\nCommit message: ${{ github.event.commits[0].message }}\n\nRepository: ${{ github.repository }}\n\nSee changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}" \ -F parse_mode=Markdown \ https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument From 59bcd7bcdc29a19d71341a1889371bd9f8eda3fb Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Sat, 12 Oct 2024 15:58:06 +0800 Subject: [PATCH 7/9] =?UTF-8?q?chore:=20=E5=86=8D=E5=8A=A0=E7=82=B9?= =?UTF-8?q?=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.py b/main.py index 1df60fb..9a2721f 100644 --- a/main.py +++ b/main.py @@ -26,14 +26,18 @@ def check_system_msg(): 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() From cec2d0fedbe79cd8d652d8d928353b9a5dfacea9 Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Sat, 12 Oct 2024 16:19:11 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20=E5=86=8D=E4=BF=AE=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9416369..2e7e21c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,4 +75,4 @@ jobs: - name: Upload to Telegram Channel run: | - curl -F chat_id=${{ secrets.TELEGRAM_TO }} \ -F document=@build/Onekey---v${{ env.PACKAGE_VERSION }}.exe \ -F caption="${{ github.actor }} created commit:\nCommit message: ${{ github.event.commits[0].message }}\n\nRepository: ${{ github.repository }}\n\nSee changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}" \ -F parse_mode=Markdown \ https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument + curl -F chat_id=${{ secrets.TELEGRAM_TO }} \ -F document=@build/Onekey---v${{ env.PACKAGE_VERSION }}.exe \ -F caption="${{ github.actor }} created commit:%0ACommit message: ${{ github.event.commits[0].message }}%0A%0ARepository: ${{ github.repository }}%0A%0ASee changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}" \ -F parse_mode=Markdown \ https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument From 3642dbde3089f81248aede604f0d5801f0b2d716 Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Sat, 12 Oct 2024 16:31:34 +0800 Subject: [PATCH 9/9] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E4=B8=80?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2e7e21c..05e4240 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,4 +75,4 @@ jobs: - name: Upload to Telegram Channel run: | - curl -F chat_id=${{ secrets.TELEGRAM_TO }} \ -F document=@build/Onekey---v${{ env.PACKAGE_VERSION }}.exe \ -F caption="${{ github.actor }} created commit:%0ACommit message: ${{ github.event.commits[0].message }}%0A%0ARepository: ${{ github.repository }}%0A%0ASee changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}" \ -F parse_mode=Markdown \ https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument + 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