mirror of
https://github.com/ikunshare/Onekey.git
synced 2026-01-16 01:53:02 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c6b3bebe1 | ||
|
|
5c74940702 | ||
|
|
dc64d2a9be |
@@ -25,7 +25,7 @@
|
||||
使用本项目的过程中可能会产生版权数据,对于这些版权数据,本项目不拥有它们的所有权,为了避免造成侵权,使用者务必在24 小时内清除使用本项目的过程中所产生的版权数据。
|
||||
由于使用本项目产生的包括由于本协议或由于使用或无法使用本项目而引起的任何性质的任何直接、间接、特殊、偶然或结果性损害(包括但不限于因商誉损失、停工、计算机故障或故障引起的损害赔偿,或任何及所有其他商业损害或损失)由使用者负责。
|
||||
本项目完全免费,且开源发布于 GitHub 面向全世界人用作对技术的学习交流,本项目不对项目内的技术可能存在违反当地法律法规的行为作保证,禁止在违反当地法律法规的情况下使用本项目,对于使用者在明知或不知当地法律法规不允许的情况下使用本项目所造成的任何违法违规行为由使用者承担,本项目不承担由此造成的任何直接、间接、特殊、偶然或结果性责任。
|
||||
而且,本项目已禁止使用于商业用途。
|
||||
而且,本项目已禁止使用于商业用途,以及不得进行未经允许的二次修改,否则必须同时发布源代码。
|
||||
若你使用了本项目,将代表你接受以上协议。
|
||||
|
||||
Steam正版平台不易,请尊重版权,支持正版。
|
||||
|
||||
60
main.py
60
main.py
@@ -13,6 +13,7 @@ import time
|
||||
import sys
|
||||
import psutil
|
||||
import asyncio
|
||||
from aiohttp import ClientSession, ClientError
|
||||
from pathlib import Path
|
||||
|
||||
# 初始化日志记录器
|
||||
@@ -68,9 +69,10 @@ print('\033[1;32;40m | |_| | | | \\ | | |___ | | \\ \\ | |___ / /' + '\033
|
||||
print('\033[1;32;40m \\_____/ |_| \\_| |_____| |_| \\_\\ |_____| /_/' + '\033[0m')
|
||||
log.info('作者ikun0014')
|
||||
log.info('本项目基于wxy1343/ManifestAutoUpdate进行修改,采用GPL V3许可证')
|
||||
log.info('版本:1.0.5')
|
||||
log.info('版本:1.0.8')
|
||||
log.info('项目仓库:https://github.com/ikunshare/Onekey')
|
||||
log.debug('官网:ikunshare.com')
|
||||
log.warning('倒卖本工具的臭傻逼:https://space.bilibili.com/3546655638948756,好嚣张哦')
|
||||
log.warning('注意:据传Steam新版本对部分解锁工具进行了检测,但目前未发现问题,如果你被封号可以issue反馈')
|
||||
log.warning('本项目完全免费,如果你在淘宝,QQ群内通过购买方式获得,赶紧回去骂商家死全家\n交流群组:\n点击链接加入群聊【ikun分享】:https://qm.qq.com/q/D9Uiva3RVS\nhttps://t.me/ikunshare_group')
|
||||
|
||||
@@ -103,11 +105,14 @@ async def get(sha, path):
|
||||
f'https://gcore.jsdelivr.net/gh/{repo}@{sha}/{path}',
|
||||
f'https://fastly.jsdelivr.net/gh/{repo}@{sha}/{path}',
|
||||
f'https://cdn.jsdelivr.net/gh/{repo}@{sha}/{path}',
|
||||
f'https://ghproxy.org/https://raw.githubusercontent.com/{repo}/{sha}/{path}',
|
||||
f'https://raw.dgithub.xyz/{repo}/{sha}/{path}'
|
||||
f'https://raw.dgithub.xyz/{repo}/{sha}/{path}',
|
||||
f'https://gh.api.99988866.xyz/https://raw.githubusercontent.com/{repo}/{sha}/{path}',
|
||||
f'https://mirror.ghproxy.com/https://raw.githubusercontent.com/{repo}/{sha}/{path}',
|
||||
f'https://raw.githubusercontent.com/{repo}/{sha}/{path}',
|
||||
f'https://gh.jiasu.in/https://github.com/{repo}/{sha}/{path}'
|
||||
]
|
||||
retry = 3
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with ClientSession() as session:
|
||||
while retry:
|
||||
for url in url_list:
|
||||
try:
|
||||
@@ -116,7 +121,7 @@ async def get(sha, path):
|
||||
return await r.read()
|
||||
else:
|
||||
log.error(f' 🔄 获取失败: {path} - 状态码: {r.status}')
|
||||
except aiohttp.ClientError:
|
||||
except ClientError():
|
||||
log.error(f' 🔄 获取失败: {path} - 连接错误')
|
||||
retry -= 1
|
||||
log.warning(f' 🔄 重试剩余次数: {retry} - {path}')
|
||||
@@ -225,24 +230,6 @@ async def greenluma_add(depot_id_list):
|
||||
return True
|
||||
|
||||
|
||||
# 检测Github Api请求数量
|
||||
async def check_github_api_limit(headers):
|
||||
url = 'https://api.github.com/rate_limit'
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(url, headers=headers, ssl=False) as r:
|
||||
r_json = await r.json()
|
||||
remain_limit = r_json['rate']['remaining']
|
||||
use_limit = r_json['rate']['used']
|
||||
reset_time = r_json['rate']['reset']
|
||||
f_reset_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(reset_time))
|
||||
log.info(f' 🔄 已用Github请求数:{use_limit}')
|
||||
log.info(f' 🔄 剩余Github请求数:{remain_limit}')
|
||||
if r.status == 429:
|
||||
log.info(f' 🔄 你的Github Api请求数已超限,请尝试增加Persoal Token')
|
||||
log.info(f' 🔄 请求数重置时间:{f_reset_time}')
|
||||
return True
|
||||
|
||||
|
||||
# 检查进程是否运行
|
||||
def check_process_running(process_name):
|
||||
for process in psutil.process_iter(['name']):
|
||||
@@ -253,16 +240,35 @@ def check_process_running(process_name):
|
||||
|
||||
# 主函数
|
||||
async def main(app_id):
|
||||
app_id_list = list(filter(str.isdecimal, app_id.strip().split('-')))
|
||||
app_id = app_id_list[0]
|
||||
if not app_id == None:
|
||||
app_id_list = list(filter(str.isdecimal, app_id.strip().split('-')))
|
||||
app_id = app_id_list[0]
|
||||
|
||||
github_token = config.get("Github_Persoal_Token", "")
|
||||
headers = {'Authorization': f'Bearer {github_token}'} if github_token else None
|
||||
|
||||
await check_github_api_limit(headers)
|
||||
url = 'https://api.github.com/rate_limit'
|
||||
|
||||
async with ClientSession() as session:
|
||||
async with session.get(url, headers=headers, ssl=False) as r:
|
||||
r_json = await r.json()
|
||||
remain_limit = r_json['rate']['remaining']
|
||||
use_limit = r_json['rate']['used']
|
||||
reset_time = r_json['rate']['reset']
|
||||
f_reset_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(reset_time))
|
||||
log.info(f' 🔄 已用Github请求数:{use_limit}')
|
||||
log.info(f' 🔄 剩余Github请求数:{remain_limit}')
|
||||
if r.status == 403:
|
||||
log.info(f' 🔄 你的Github Api请求数已超限,请尝试增加Persoal Token')
|
||||
log.info(f' 🔄 请求数重置时间:{f_reset_time}')
|
||||
|
||||
url = f'https://api.github.com/repos/{repo}/branches/{app_id}'
|
||||
async with aiohttp.ClientSession() as session:
|
||||
|
||||
async with ClientSession() as session:
|
||||
async with session.get(url, headers=headers, ssl=False) as r:
|
||||
if r.status == 403:
|
||||
log.info(f' 🔄 你的Github Api请求数已超限,请尝试增加Persoal Token')
|
||||
log.info(f' 🔄 请求数重置时间:{reset_time}')
|
||||
r_json = await r.json()
|
||||
if 'commit' in r_json:
|
||||
sha = r_json['commit']['sha']
|
||||
|
||||
Reference in New Issue
Block a user