Sign-in: request the email scope and keep the address in the private ledger only
Browse files- README.md +2 -0
- app.py +38 -1
- index.html +1 -1
README.md
CHANGED
|
@@ -8,6 +8,8 @@ app_port: 7860
|
|
| 8 |
pinned: false
|
| 9 |
license: mit
|
| 10 |
hf_oauth: true
|
|
|
|
|
|
|
| 11 |
short_description: GPU + harness only. Two quantum seasons, $1000 each.
|
| 12 |
---
|
| 13 |
|
|
|
|
| 8 |
pinned: false
|
| 9 |
license: mit
|
| 10 |
hf_oauth: true
|
| 11 |
+
hf_oauth_scopes:
|
| 12 |
+
- email
|
| 13 |
short_description: GPU + harness only. Two quantum seasons, $1000 each.
|
| 14 |
---
|
| 15 |
|
app.py
CHANGED
|
@@ -117,6 +117,42 @@ def me(request: Request):
|
|
| 117 |
"oauth_configured": bool(OAUTH_ID and OAUTH_SECRET)}
|
| 118 |
|
| 119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
@app.get("/login")
|
| 121 |
def login(request: Request):
|
| 122 |
if not (OAUTH_ID and OAUTH_SECRET):
|
|
@@ -124,7 +160,7 @@ def login(request: Request):
|
|
| 124 |
state = secrets.token_urlsafe(16)
|
| 125 |
q = urllib.parse.urlencode({
|
| 126 |
"client_id": OAUTH_ID, "redirect_uri": _redirect_uri(request),
|
| 127 |
-
"response_type": "code", "scope": "openid profile", "state": state})
|
| 128 |
r = RedirectResponse("%s/oauth/authorize?%s" % (OAUTH_ISS.rstrip("/"), q))
|
| 129 |
r.set_cookie("oqc_state", state, max_age=600, httponly=True, **COOKIE_KW)
|
| 130 |
return r
|
|
@@ -149,6 +185,7 @@ def callback(request: Request, code: str = "", state: str = ""):
|
|
| 149 |
ui = json.loads(r.read().decode())
|
| 150 |
user = {"name": ui.get("preferred_username") or ui.get("name"),
|
| 151 |
"picture": ui.get("picture"), "at": int(time.time())}
|
|
|
|
| 152 |
resp = RedirectResponse("/")
|
| 153 |
resp.set_cookie(COOKIE, _sign(user), max_age=60 * 60 * 24 * 14, httponly=True, **COOKIE_KW)
|
| 154 |
resp.delete_cookie("oqc_state")
|
|
|
|
| 117 |
"oauth_configured": bool(OAUTH_ID and OAUTH_SECRET)}
|
| 118 |
|
| 119 |
|
| 120 |
+
# ---- contact email (2026-11-17): kept only in the private ledger. It is never put in the
|
| 121 |
+
# session cookie and never returned by any API. Used for contest notices and prize contact.
|
| 122 |
+
import re as _ct_re
|
| 123 |
+
import threading as _ct_th
|
| 124 |
+
_CT_SEEN = {}
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
def _ct_write(path, rec):
|
| 128 |
+
store.write(path, rec, "contact")
|
| 129 |
+
|
| 130 |
+
def _save_contact(name, email, verified):
|
| 131 |
+
def _w():
|
| 132 |
+
try:
|
| 133 |
+
if not (name and email) or _CT_SEEN.get(name) == email:
|
| 134 |
+
return
|
| 135 |
+
_ct_write("contacts/%s.json" % _ct_re.sub(r"[^A-Za-z0-9_.-]", "_", str(name)),
|
| 136 |
+
{"user": name, "email": email, "email_verified": bool(verified), "challenge": "OQC",
|
| 137 |
+
"updated": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())})
|
| 138 |
+
_CT_SEEN[name] = email
|
| 139 |
+
except Exception:
|
| 140 |
+
pass
|
| 141 |
+
_ct_th.Thread(target=_w, daemon=True).start()
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def _ct_probe():
|
| 145 |
+
try:
|
| 146 |
+
_ct_write("contacts/_probe.json", {"challenge": "OQC", "at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())})
|
| 147 |
+
except Exception:
|
| 148 |
+
pass
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
_ct_t = _ct_th.Timer(25, _ct_probe)
|
| 152 |
+
_ct_t.daemon = True
|
| 153 |
+
_ct_t.start()
|
| 154 |
+
|
| 155 |
+
|
| 156 |
@app.get("/login")
|
| 157 |
def login(request: Request):
|
| 158 |
if not (OAUTH_ID and OAUTH_SECRET):
|
|
|
|
| 160 |
state = secrets.token_urlsafe(16)
|
| 161 |
q = urllib.parse.urlencode({
|
| 162 |
"client_id": OAUTH_ID, "redirect_uri": _redirect_uri(request),
|
| 163 |
+
"response_type": "code", "scope": "openid profile email", "state": state})
|
| 164 |
r = RedirectResponse("%s/oauth/authorize?%s" % (OAUTH_ISS.rstrip("/"), q))
|
| 165 |
r.set_cookie("oqc_state", state, max_age=600, httponly=True, **COOKIE_KW)
|
| 166 |
return r
|
|
|
|
| 185 |
ui = json.loads(r.read().decode())
|
| 186 |
user = {"name": ui.get("preferred_username") or ui.get("name"),
|
| 187 |
"picture": ui.get("picture"), "at": int(time.time())}
|
| 188 |
+
_save_contact(user["name"], ui.get("email"), ui.get("email_verified"))
|
| 189 |
resp = RedirectResponse("/")
|
| 190 |
resp.set_cookie(COOKIE, _sign(user), max_age=60 * 60 * 24 * 14, httponly=True, **COOKIE_KW)
|
| 191 |
resp.delete_cookie("oqc_state")
|
index.html
CHANGED
|
@@ -74,7 +74,7 @@ textarea{min-height:120px;font-family:ui-monospace,monospace;font-size:12px}
|
|
| 74 |
.hf-user:hover{text-decoration:underline}
|
| 75 |
</style>
|
| 76 |
</head>
|
| 77 |
-
<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><span class="vxb-me">⚛️ Quantum · OQC</span><a href="https://huggingface.co/spaces/FINAL-Bench/leadboard" target="_blank" rel="noopener" style="--c:#15803D">📏 LEADBOARD</a><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 -->
|
| 78 |
<div id="daily-cap-notice" style="background:#0f7b6c;color:#fff;padding:12px 16px;font-size:14px;line-height:1.55;text-align:center">
|
| 79 |
안내: 지금부터 모든 챌린지의 제출은 계정당 하루 5건으로 제한됩니다. 한 챌린지 안의 시즌과 부문은 모두 합쳐 5건입니다. 같은 날 6번째 제출부터는 접수되지 않으며, 한도는 매일 0시(한국시간)에 초기화됩니다. 이미 접수된 제출은 그대로 채점됩니다.<br>
|
| 80 |
Notice: Effective immediately, each account may submit up to 5 entries per day to each challenge. All seasons and tracks within a challenge count toward the same 5. The 6th submission of the day will not be accepted. The limit resets daily at 00:00 KST. Submissions already received will be scored as usual.
|
|
|
|
| 74 |
.hf-user:hover{text-decoration:underline}
|
| 75 |
</style>
|
| 76 |
</head>
|
| 77 |
+
<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><span class="vxb-me">⚛️ Quantum · OQC</span><a href="https://huggingface.co/spaces/FINAL-Bench/leadboard" target="_blank" rel="noopener" style="--c:#15803D">📏 LEADBOARD</a><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 -->
|
| 78 |
<div id="daily-cap-notice" style="background:#0f7b6c;color:#fff;padding:12px 16px;font-size:14px;line-height:1.55;text-align:center">
|
| 79 |
안내: 지금부터 모든 챌린지의 제출은 계정당 하루 5건으로 제한됩니다. 한 챌린지 안의 시즌과 부문은 모두 합쳐 5건입니다. 같은 날 6번째 제출부터는 접수되지 않으며, 한도는 매일 0시(한국시간)에 초기화됩니다. 이미 접수된 제출은 그대로 채점됩니다.<br>
|
| 80 |
Notice: Effective immediately, each account may submit up to 5 entries per day to each challenge. All seasons and tracks within a challenge count toward the same 5. The 6th submission of the day will not be accepted. The limit resets daily at 00:00 KST. Submissions already received will be scored as usual.
|