mirror of
https://github.com/ikunshare/Onekey.git
synced 2026-01-16 01:53:02 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea3aedbab3 | ||
|
|
51ccc579f4 | ||
|
|
17e654a68e |
33
main.py
33
main.py
@@ -7,7 +7,7 @@ import traceback
|
||||
import subprocess
|
||||
import colorlog
|
||||
import logging
|
||||
import json
|
||||
import ujson as json
|
||||
import time
|
||||
import sys
|
||||
import psutil
|
||||
@@ -37,9 +37,16 @@ def init_log():
|
||||
|
||||
# 生成配置文件
|
||||
def gen_config_file():
|
||||
default_config = {"Github_Persoal_Token": "", "Custom_Steam_Path": ""}
|
||||
with open('./config.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(default_config, f)
|
||||
default_config ={
|
||||
"Github_Personal_Token": "",
|
||||
"Custom_Steam_Path": "",
|
||||
"QA1": "温馨提示:Github_Personal_Token可在Github设置的最底下开发者选项找到,详情看教程",
|
||||
"教程": "https://lyvx-my.sharepoint.com/:w:/g/personal/ikun_ikunshare_com/EWqIqyCElLNLo_CKfLbqix0BWU_O03HLzEHQKHdJYrUz-Q?e=79MZjw"
|
||||
}
|
||||
with open("./config.json", "w", encoding="utf-8") as f:
|
||||
f.write(json.dumps(default_config, indent=2, ensure_ascii=False,
|
||||
escape_forward_slashes=False))
|
||||
f.close()
|
||||
log.info(' 🖱️ 程序可能为第一次启动,请填写配置文件后重新启动程序')
|
||||
|
||||
|
||||
@@ -50,8 +57,8 @@ def load_config():
|
||||
os.system('pause')
|
||||
sys.exit()
|
||||
else:
|
||||
with open('./config.json', 'r', encoding='utf-8') as f:
|
||||
config = json.load(f)
|
||||
with open("./config.json", "r", encoding="utf-8") as f:
|
||||
config = json.loads(f.read())
|
||||
return config
|
||||
|
||||
|
||||
@@ -68,7 +75,7 @@ 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.1.0')
|
||||
log.info('版本:1.1.1')
|
||||
log.info('项目仓库:https://github.com/ikunshare/Onekey')
|
||||
log.debug('官网:ikunshare.com')
|
||||
log.warning('本项目完全开源免费,如果你在淘宝,QQ群内通过购买方式获得,赶紧回去骂商家死全家\n交流群组:\n点击链接加入群聊【𝗶𝗸𝘂𝗻分享】:https://qm.qq.com/q/d7sWovfAGI\nhttps://t.me/ikunshare_group')
|
||||
@@ -229,7 +236,11 @@ async def check_github_api_rate_limit(headers, session):
|
||||
url = 'https://api.github.com/rate_limit'
|
||||
|
||||
async with session.get(url, headers=headers, ssl=False) as r:
|
||||
r_json = await r.json()
|
||||
if not r == None:
|
||||
r_json = await r.json()
|
||||
else:
|
||||
log.error('孩子,你怎么做到的?')
|
||||
os.system('pause')
|
||||
|
||||
if r.status == 200:
|
||||
rate_limit = r_json['rate']
|
||||
@@ -245,7 +256,7 @@ async def check_github_api_rate_limit(headers, session):
|
||||
# 主函数
|
||||
async def main(app_id):
|
||||
async with ClientSession() as session:
|
||||
github_token = config.get("Github_Persoal_Token", "")
|
||||
github_token = config.get("Github_Personal_Token", "")
|
||||
headers = {'Authorization': f'Bearer {github_token}'} if github_token else None
|
||||
latest_date = None
|
||||
selected_repo = None
|
||||
@@ -303,7 +314,9 @@ parser.add_argument('-a', '--app-id')
|
||||
args = parser.parse_args()
|
||||
repos = [
|
||||
'ManifestHub/ManifestHub',
|
||||
'ikun0014/ManifestHub'
|
||||
'ikun0014/ManifestHub',
|
||||
'Auiowu/ManifestAutoUpdate',
|
||||
'tymolu233/ManifestAutoUpdate'
|
||||
]
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user