support at.syu.is oauth

This commit is contained in:
2026-02-16 04:51:20 +09:00
parent 5e84ba7b1d
commit 799f7145f8
4 changed files with 31 additions and 22 deletions

View File

@@ -66,32 +66,22 @@
"2ks46vomw4s2i",
"2ivbc5b4um5bu",
"255k3bskheo6j",
"fchqtradcl2qj",
"zs5ejisoztpi5",
"2b56dpd54zr62",
"qu6i2finhb5lp",
"qxfk7tz7gwyti",
"unj7mu3zannj7",
"ys2zviehsfkx5",
"jnq2fh5do5gri",
"ddn2kwscar6oh",
"c6o3ti5zk24yx",
"dzpibec7jitg3",
"pnfvith6eyafv",
"4bgpud3frf6hh",
"m4h6t4vfw7mcb",
"3oejqnlsseply",
"kpimmynstuba7",
"qn2hp5nyk7hep",
"m5sxxcbyfwhzv",
"mraku3adaolx5",
"w72lwimbmb5d2",
"3me6tlrez7l23",
"3me6ttgsk2g25",
"3me6u2g7izx27",
"3me6u76knjf2b",
"3me6uc233ib2d",
"3me6uf4masj2f",
"3me6ttgsk2g25",
"3meb7bdy3ge23",
"3meb7w4vuas25",
"3meb7ykzumg27",

View File

@@ -1,14 +1,4 @@
[
"fchqtradcl2qj",
"2b56dpd54zr62",
"qxfk7tz7gwyti",
"ys2zviehsfkx5",
"ddn2kwscar6oh",
"dzpibec7jitg3",
"4bgpud3frf6hh",
"3oejqnlsseply",
"qn2hp5nyk7hep",
"mraku3adaolx5",
"zi7t34bdc6kqn",
"z42mx3edarpnb",
"y2qobgxho6jte",
@@ -76,12 +66,22 @@
"xjbcakcuv6nva",
"bkjd7d7nhgpxc",
"zxvrfbbtpb6cl",
"2b56dpd54zr62",
"qxfk7tz7gwyti",
"ys2zviehsfkx5",
"ddn2kwscar6oh",
"dzpibec7jitg3",
"4bgpud3frf6hh",
"3oejqnlsseply",
"qn2hp5nyk7hep",
"mraku3adaolx5",
"fchqtradcl2qj",
"3me6tlrexwc22",
"3me6ttgsjlb24",
"3me6u2g7inq26",
"3me6u76kn4p2a",
"3me6uc232xc2c",
"3me6uf4mag22e",
"3me6ttgsjlb24",
"3meb7bdy2w722",
"3meb7w4vtqh24",
"3meb7ykzu2r26",

View File

@@ -65,8 +65,17 @@ async function initOAuthClient(): Promise<BrowserOAuthClient> {
return oauthClient
}
// Primary OAuth domain
const OAUTH_ORIGIN = 'https://syui.ai'
// Login with handle
export async function login(handle: string): Promise<void> {
// Redirect to primary OAuth domain if on a different domain
if (window.location.origin !== OAUTH_ORIGIN) {
window.location.href = `${OAUTH_ORIGIN}${window.location.pathname}?login=${encodeURIComponent(handle)}`
return
}
await setNetworkConfig(handle)
try {

View File

@@ -91,6 +91,16 @@ async function render(route: Route): Promise<void> {
await handleCallback()
}
// Auto-login if redirected from another domain with ?login=handle
if (oauthEnabled && searchParams.has('login')) {
const loginHandle = searchParams.get('login')
if (loginHandle) {
window.history.replaceState({}, '', window.location.pathname)
await login(loginHandle)
return
}
}
// Restore session from storage (skip if oauth disabled)
if (oauthEnabled) {
await restoreSession()