mirror of
https://github.com/ikunshare/Onekey.git
synced 2026-01-15 17:43:22 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e38af1675c | ||
|
|
50194cf7de | ||
|
|
7063f2f5dc | ||
|
|
2c6b3bebe1 |
56
main.py
56
main.py
@@ -69,12 +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.7')
|
||||
log.info('版本:1.0.9')
|
||||
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')
|
||||
log.warning('本项目完全开源免费,如果你在淘宝,QQ群内通过购买方式获得,赶紧回去骂商家死全家\n交流群组:\n点击链接加入群聊【𝗶𝗸𝘂𝗻分享】:https://qm.qq.com/q/d7sWovfAGI\nhttps://t.me/ikunshare_group')
|
||||
|
||||
|
||||
# 通过注册表获取Steam安装路径
|
||||
@@ -102,14 +100,11 @@ def stack_error(exception):
|
||||
# 下载清单
|
||||
async def get(sha, path):
|
||||
url_list = [
|
||||
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://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}'
|
||||
f'https://gh.jiasu.in/https://raw.githubusercontent.com/{repo}/{sha}/{path}'
|
||||
]
|
||||
retry = 3
|
||||
async with ClientSession() as session:
|
||||
@@ -230,24 +225,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 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']):
|
||||
@@ -258,17 +235,36 @@ 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'
|
||||
|
||||
url = f'https://api.github.com/repos/{repo}/branches/{app_id}'
|
||||
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 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']
|
||||
url = r_json['commit']['commit']['tree']['url']
|
||||
|
||||
Reference in New Issue
Block a user