From 799f7145f82eb3f0f506e089a6da983d746b4102 Mon Sep 17 00:00:00 2001 From: syui Date: Mon, 16 Feb 2026 04:51:20 +0900 Subject: [PATCH] support at.syu.is oauth --- .../ai.syui.log.chat/index.json | 12 +--------- .../ai.syui.log.chat/index.json | 22 +++++++++---------- src/web/lib/auth.ts | 9 ++++++++ src/web/main.ts | 10 +++++++++ 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/public/content/did:plc:6qyecktefllvenje24fcxnie/ai.syui.log.chat/index.json b/public/content/did:plc:6qyecktefllvenje24fcxnie/ai.syui.log.chat/index.json index 5df2474..fb5c070 100644 --- a/public/content/did:plc:6qyecktefllvenje24fcxnie/ai.syui.log.chat/index.json +++ b/public/content/did:plc:6qyecktefllvenje24fcxnie/ai.syui.log.chat/index.json @@ -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", diff --git a/public/content/did:plc:vzsvtbtbnwn22xjqhcu3vd6y/ai.syui.log.chat/index.json b/public/content/did:plc:vzsvtbtbnwn22xjqhcu3vd6y/ai.syui.log.chat/index.json index 92df85c..9587ed4 100644 --- a/public/content/did:plc:vzsvtbtbnwn22xjqhcu3vd6y/ai.syui.log.chat/index.json +++ b/public/content/did:plc:vzsvtbtbnwn22xjqhcu3vd6y/ai.syui.log.chat/index.json @@ -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", diff --git a/src/web/lib/auth.ts b/src/web/lib/auth.ts index a38b55c..2d580ce 100644 --- a/src/web/lib/auth.ts +++ b/src/web/lib/auth.ts @@ -65,8 +65,17 @@ async function initOAuthClient(): Promise { return oauthClient } +// Primary OAuth domain +const OAUTH_ORIGIN = 'https://syui.ai' + // Login with handle export async function login(handle: string): Promise { + // 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 { diff --git a/src/web/main.ts b/src/web/main.ts index 4170f9b..04bd7fa 100644 --- a/src/web/main.ts +++ b/src/web/main.ts @@ -91,6 +91,16 @@ async function render(route: Route): Promise { 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()