ginipick commited on
Commit
8d5e73b
ยท
verified ยท
1 Parent(s): f1821c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -15
app.py CHANGED
@@ -29,34 +29,36 @@ def _load_best():
29
  PAT = re.compile(r"^[a-z0-9]{6}\.vercel\.app$", re.I)
30
 
31
  def fetch_all(limit=200):
32
- """READY ๋ฐฐํฌ ์ค‘ alias ์ค‘์— 6๊ธ€์ž.vercel.app ์ด ์žˆ๋Š” ๊ฒƒ๋งŒ ์ˆ˜์ง‘"""
 
 
 
33
  try:
34
  params = {"limit": limit}
35
  if TEAM:
36
  params["teamId"] = TEAM
37
 
38
- r = requests.get(f"{API}/v6/deployments",
39
- headers=HEAD, params=params, timeout=30)
40
- r.raise_for_status()
41
 
42
  games = []
43
- for d in r.json().get("deployments", []):
44
  if d.get("state") != "READY":
45
  continue
46
 
47
- # โ”€โ”€ alias ๋ฐฐ์—ด์—์„œ ๊ทœ์น™์— ๋งž๋Š” ๋„๋ฉ”์ธ ์ฐพ๊ธฐ
48
- six_domain = None
49
- for dom in d.get("alias", []):
50
- if PAT.match(dom):
51
- six_domain = dom
52
- break
53
- if six_domain is None:
54
- continue # 6๊ธ€์ž ๋„๋ฉ”์ธ ์—†์œผ๋ฉด ๊ฑด๋„ˆ๋œ€
55
 
56
  games.append({
57
  "title": d.get("name", "(์ œ๋ชฉ ์—†์Œ)"),
58
- "url" : f"https://{six_domain}",
59
- "ts" : int(d.get("created", time.time()*1000) / 1000)
60
  })
61
 
62
  return sorted(games, key=lambda x: x["ts"], reverse=True)
 
29
  PAT = re.compile(r"^[a-z0-9]{6}\.vercel\.app$", re.I)
30
 
31
  def fetch_all(limit=200):
32
+ """
33
+ READY ๋ฐฐํฌ ์ค‘ 'tmkdop.vercel.app' ์ฒ˜๋Ÿผ 6๊ธ€์ž ๋„๋ฉ”์ธ์ด ๋‹ฌ๋ฆฐ ๊ฒƒ๋งŒ ์ˆ˜์ง‘
34
+ ยท url ํ•„๋“œ์™€ alias ๋ฐฐ์—ด์„ ๋ชจ๋‘ ๊ฒ€์ƒ‰
35
+ """
36
  try:
37
  params = {"limit": limit}
38
  if TEAM:
39
  params["teamId"] = TEAM
40
 
41
+ resp = requests.get(f"{API}/v6/deployments",
42
+ headers=HEAD, params=params, timeout=30)
43
+ resp.raise_for_status()
44
 
45
  games = []
46
+ for d in resp.json().get("deployments", []):
47
  if d.get("state") != "READY":
48
  continue
49
 
50
+ # โ”€โ”€ url + alias ๋ฐฐ์—ด ํ†ตํ•ฉ ๊ฒ€์‚ฌ
51
+ candidates = [d.get("url", "")]
52
+ candidates.extend(d.get("alias", []))
53
+
54
+ six = next((dom for dom in candidates if PAT.match(dom)), None)
55
+ if not six:
56
+ continue
 
57
 
58
  games.append({
59
  "title": d.get("name", "(์ œ๋ชฉ ์—†์Œ)"),
60
+ "url": f"https://{six}",
61
+ "ts": int(d.get("created", time.time() * 1000) / 1000)
62
  })
63
 
64
  return sorted(games, key=lambda x: x["ts"], reverse=True)