SeaWolf-AI commited on
Commit
2251587
ยท
verified ยท
1 Parent(s): 0e5f24e

Sign-in: request the email scope and keep the address in the private ledger only

Browse files
Files changed (3) hide show
  1. README.md +2 -0
  2. app.py +38 -1
  3. index.html +1 -1
README.md CHANGED
@@ -7,6 +7,8 @@ sdk: docker
7
  app_port: 7860
8
  # hf_oauth ๋ฅผ ์ผœ์•ผ ํ”Œ๋žซํผ์ด OAUTH_CLIENT_ID/SECRET ๋ฅผ ์ปจํ…Œ์ด๋„ˆ์— ๋„ฃ์–ด์ค€๋‹ค.
9
  hf_oauth: true
 
 
10
  pinned: false
11
  short_description: Benchmark for drug prediction tools - ADMET, kinase, tox
12
  tags:
 
7
  app_port: 7860
8
  # hf_oauth ๋ฅผ ์ผœ์•ผ ํ”Œ๋žซํผ์ด OAUTH_CLIENT_ID/SECRET ๋ฅผ ์ปจํ…Œ์ด๋„ˆ์— ๋„ฃ์–ด์ค€๋‹ค.
9
  hf_oauth: true
10
+ hf_oauth_scopes:
11
+ - email
12
  pinned: false
13
  short_description: Benchmark for drug prediction tools - ADMET, kinase, tox
14
  tags:
app.py CHANGED
@@ -501,6 +501,42 @@ def api_leaderboard(name: str):
501
 
502
 
503
  # ------------------------------------------------------------------ ๋กœ๊ทธ์ธ
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
  @app.get("/login")
505
  def login(request: Request):
506
  if not (OAUTH_ID and OAUTH_SECRET):
@@ -509,7 +545,7 @@ def login(request: Request):
509
  st = base64.urlsafe_b64encode(json.dumps({"n": nxt, "r": secrets.token_hex(8)}).encode()).decode()
510
  q = urllib.parse.urlencode({
511
  "client_id": OAUTH_ID, "redirect_uri": _redirect(request),
512
- "response_type": "code", "scope": "openid profile", "state": st})
513
  return RedirectResponse("%s/oauth/authorize?%s" % (OAUTH_ISS, q))
514
 
515
 
@@ -571,6 +607,7 @@ def auth(request: Request):
571
  except Exception as e:
572
  return _err_page("์ธ์ฆ ์ค‘ ํ†ต์‹ ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ์ž ์‹œ ํ›„ ๋‹ค์‹œ ์‹œ๋„ํ•ด ์ฃผ์‹ญ์‹œ์˜ค.",
573
  "%s: %s" % (type(e).__name__, e))
 
574
  resp = RedirectResponse(nxt)
575
  set_session(resp, {"user": ui.get("preferred_username") or ui.get("sub"),
576
  "name": ui.get("name", ""), "pic": ui.get("picture", "")})
 
501
 
502
 
503
  # ------------------------------------------------------------------ ๋กœ๊ทธ์ธ
504
+ # ---- contact email (2026-11-17): kept only in the private ledger. It is never put in the
505
+ # session cookie and never returned by any API. Used for contest notices and prize contact.
506
+ import re as _ct_re
507
+ import threading as _ct_th
508
+ _CT_SEEN = {}
509
+
510
+
511
+ def _ct_write(path, rec):
512
+ ledger_write(path, rec, "contact")
513
+
514
+ def _save_contact(name, email, verified):
515
+ def _w():
516
+ try:
517
+ if not (name and email) or _CT_SEEN.get(name) == email:
518
+ return
519
+ _ct_write("contacts/%s.json" % _ct_re.sub(r"[^A-Za-z0-9_.-]", "_", str(name)),
520
+ {"user": name, "email": email, "email_verified": bool(verified), "challenge": "LEADBOARD",
521
+ "updated": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())})
522
+ _CT_SEEN[name] = email
523
+ except Exception:
524
+ pass
525
+ _ct_th.Thread(target=_w, daemon=True).start()
526
+
527
+
528
+ def _ct_probe():
529
+ try:
530
+ _ct_write("contacts/_probe.json", {"challenge": "LEADBOARD", "at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())})
531
+ except Exception:
532
+ pass
533
+
534
+
535
+ _ct_t = _ct_th.Timer(25, _ct_probe)
536
+ _ct_t.daemon = True
537
+ _ct_t.start()
538
+
539
+
540
  @app.get("/login")
541
  def login(request: Request):
542
  if not (OAUTH_ID and OAUTH_SECRET):
 
545
  st = base64.urlsafe_b64encode(json.dumps({"n": nxt, "r": secrets.token_hex(8)}).encode()).decode()
546
  q = urllib.parse.urlencode({
547
  "client_id": OAUTH_ID, "redirect_uri": _redirect(request),
548
+ "response_type": "code", "scope": "openid profile email", "state": st})
549
  return RedirectResponse("%s/oauth/authorize?%s" % (OAUTH_ISS, q))
550
 
551
 
 
607
  except Exception as e:
608
  return _err_page("์ธ์ฆ ์ค‘ ํ†ต์‹ ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ์ž ์‹œ ํ›„ ๋‹ค์‹œ ์‹œ๋„ํ•ด ์ฃผ์‹ญ์‹œ์˜ค.",
609
  "%s: %s" % (type(e).__name__, e))
610
+ _save_contact(ui.get("preferred_username") or ui.get("sub"), ui.get("email"), ui.get("email_verified"))
611
  resp = RedirectResponse(nxt)
612
  set_session(resp, {"user": ui.get("preferred_username") or ui.get("sub"),
613
  "name": ui.get("name", ""), "pic": ui.get("picture", "")})
index.html CHANGED
@@ -230,7 +230,7 @@
230
  .trow,.taxis{grid-template-columns:78px 1fr 48px;gap:8px;font-size:12px}}
231
  </style>
232
  </head>
233
- <body><!-- xbadge 2026-11-17 --><style>#vxb{display:flex;align-items:center;gap:7px;flex-wrap:wrap;padding:8px 14px;background:#0B1020;color:#CBD5E1;font:600 12px/1.3 system-ui,-apple-system,"Segoe UI","Apple SD Gothic Neo","Malgun Gothic",sans-serif;position:relative;z-index:5}#vxb .vxb-l{font-weight:800;letter-spacing:.06em;color:#94A3B8;margin-right:4px;white-space:nowrap}#vxb a,#vxb .vxb-me{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;border-radius:999px;text-decoration:none;white-space:nowrap;color:#fff;background:var(--c);border:1px solid rgba(255,255,255,.18)}#vxb a:hover{filter:brightness(1.15)}#vxb .vxb-me{background:transparent;color:#E2E8F0;border-color:#475569}</style><nav id="vxb" aria-label="VIDRAFT open challenges"><span class="vxb-l">VIDRAFT OPEN CHALLENGES</span><a href="https://huggingface.co/spaces/FINAL-Bench/open-discovery-challenge" target="_blank" rel="noopener" style="--c:#0D9488">๐Ÿงช Drug Discovery ยท ODC</a><a href="https://huggingface.co/spaces/FINAL-Bench/open-materials-challenge" target="_blank" rel="noopener" style="--c:#7C3AED">๐Ÿ”‹ Materials ยท OMC</a><a href="https://huggingface.co/spaces/FINAL-Bench/OSC-Leaderboard" target="_blank" rel="noopener" style="--c:#0F7B6C">๐Ÿงฒ Superconductor ยท OSC</a><a href="https://huggingface.co/spaces/FINAL-Bench/open-quantum-challenge" target="_blank" rel="noopener" style="--c:#2563EB">โš›๏ธ Quantum ยท OQC</a><span class="vxb-me">๐Ÿ“ LEADBOARD</span><a href="https://huggingface.co/spaces/FINAL-Bench/ViKernel-RedTeam" target="_blank" rel="noopener" style="--c:#DC2626">๐Ÿ›ก๏ธ AI Hacking Hackathon</a><a href="https://huggingface.co/spaces/FINAL-Bench/finchal" target="_blank" rel="noopener" style="--c:#B45309">๐Ÿ“ˆ Finance ยท FINCHAL</a></nav><!-- /xbadge -->
234
 
235
  <nav><div class="in">
236
  <a class="lg" href="#/">LEAD<i>BOARD</i></a>
 
230
  .trow,.taxis{grid-template-columns:78px 1fr 48px;gap:8px;font-size:12px}}
231
  </style>
232
  </head>
233
+ <body><!-- xbadge 2026-11-17 --><style>#vxb{display:flex;align-items:center;gap:7px;flex-wrap:wrap;padding:8px 14px;background:#0B1020;color:#CBD5E1;font:600 12px/1.3 system-ui,-apple-system,"Segoe UI","Apple SD Gothic Neo","Malgun Gothic",sans-serif;position:relative;z-index:5}#vxb .vxb-l{font-weight:800;letter-spacing:.06em;color:#94A3B8;margin-right:4px;white-space:nowrap}#vxb a,#vxb .vxb-me{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;border-radius:999px;text-decoration:none;white-space:nowrap;color:#fff;background:var(--c);border:1px solid rgba(255,255,255,.18)}#vxb a:hover{filter:brightness(1.15)}#vxb .vxb-me{background:transparent;color:#E2E8F0;border-color:#475569}</style><nav id="vxb" aria-label="VIDRAFT open challenges"><span class="vxb-l">VIDRAFT OPEN CHALLENGES</span><a href="https://huggingface.co/spaces/FINAL-Bench/open-discovery-challenge" target="_blank" rel="noopener" style="--c:#0D9488">๐Ÿงช Drug Discovery ยท ODC</a><a href="https://huggingface.co/spaces/FINAL-Bench/open-materials-challenge" target="_blank" rel="noopener" style="--c:#7C3AED">๐Ÿ”‹ Materials ยท OMC</a><a href="https://huggingface.co/spaces/FINAL-Bench/OSC-Leaderboard" target="_blank" rel="noopener" style="--c:#0F7B6C">๐Ÿงฒ Superconductor ยท OSC</a><a href="https://huggingface.co/spaces/FINAL-Bench/open-quantum-challenge" target="_blank" rel="noopener" style="--c:#2563EB">โš›๏ธ Quantum ยท OQC</a><span class="vxb-me">๐Ÿ“ LEADBOARD</span><a href="https://huggingface.co/spaces/FINAL-Bench/ViKernel-RedTeam" target="_blank" rel="noopener" style="--c:#DC2626">๐Ÿ›ก๏ธ AI Hacking Hackathon</a><a href="https://huggingface.co/spaces/FINAL-Bench/finchal" target="_blank" rel="noopener" style="--c:#B45309">๐Ÿ“ˆ Finance ยท FINCHAL</a></nav><!-- /xbadge --><!-- emailnote 2026-11-17 --><div id="vxb-note" style="padding:6px 14px;background:#111827;color:#CBD5E1;font:500 11.5px/1.5 system-ui,-apple-system,'Segoe UI','Apple SD Gothic Neo','Malgun Gothic',sans-serif;position:relative;z-index:5">Sign-in shares your Hugging Face account name and email with the organizer. We use the email only for contest notices and prize contact. ยท ๋กœ๊ทธ์ธํ•˜๋ฉด ํ—ˆ๊น…ํŽ˜์ด์Šค ๊ณ„์ • ์ด๋ฆ„๊ณผ ์ด๋ฉ”์ผ์ด ์ฃผ์ตœ ์ธก์— ์ „๋‹ฌ๋ฉ๋‹ˆ๋‹ค. ์ด๋ฉ”์ผ์€ ๋Œ€ํšŒ ๊ณต์ง€์™€ ์ƒ๊ธˆ ์•ˆ๋‚ด์—๋งŒ ์”๋‹ˆ๋‹ค.</div><!-- /emailnote -->
234
 
235
  <nav><div class="in">
236
  <a class="lg" href="#/">LEAD<i>BOARD</i></a>