ZHIWEI666 commited on
Commit
16cd41c
·
verified ·
1 Parent(s): 97b8a9a

Upload 2 files

Browse files
云端_定时版本检测引擎.py CHANGED
@@ -57,7 +57,7 @@ async def fetch_latest_github_hash(repo_url, token):
57
  api_url = f"https://api.github.com/repos/{owner}/{repo}/commits"
58
  headers = {"Accept": "application/vnd.github.v3+json", "User-Agent": "ComfyUI-Hub"}
59
  if token:
60
- headers["Authorization"] = f"token {token}"
61
 
62
  # 🛡️ 稳定性优化:超时 + 重试
63
  async with httpx.AsyncClient(follow_redirects=True, timeout=httpx.Timeout(15.0, connect=5.0)) as client:
 
57
  api_url = f"https://api.github.com/repos/{owner}/{repo}/commits"
58
  headers = {"Accept": "application/vnd.github.v3+json", "User-Agent": "ComfyUI-Hub"}
59
  if token:
60
+ headers["Authorization"] = f"Bearer {token}"
61
 
62
  # 🛡️ 稳定性优化:超时 + 重试
63
  async with httpx.AsyncClient(follow_redirects=True, timeout=httpx.Timeout(15.0, connect=5.0)) as client:
安全认证.py CHANGED
@@ -302,13 +302,12 @@ async def require_auth(authorization: str = Header(None, alias="Authorization"))
302
 
303
  token = parts[1]
304
 
305
- # 验证 Token
306
- is_valid, payload, error_msg = verify_token(token)
307
 
308
  if not is_valid:
309
  raise HTTPException(status_code=401, detail=error_msg)
310
 
311
- account = payload.get("sub")
312
  if not account:
313
  raise HTTPException(status_code=401, detail="Token 中缺少用户信息")
314
 
 
302
 
303
  token = parts[1]
304
 
305
+ # 验证 Token(使用 fallback 兼容旧版 mock_token)
306
+ is_valid, account, error_msg = verify_token_with_fallback(token)
307
 
308
  if not is_valid:
309
  raise HTTPException(status_code=401, detail=error_msg)
310
 
 
311
  if not account:
312
  raise HTTPException(status_code=401, detail="Token 中缺少用户信息")
313