summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam <[email protected]>2026-02-06 12:08:10 -0600
committerAdam <[email protected]>2026-02-06 12:11:02 -0600
commit6a5c1a74f19c81505d5ac33d7668bac94d131a29 (patch)
tree96baee9aeb68e0156786ef49ce573ee90feeb13e
parent6324d1c351618c5f7146a3d31d6b4f78b16f256c (diff)
downloadopencode-6a5c1a74f19c81505d5ac33d7668bac94d131a29.tar.gz
opencode-6a5c1a74f19c81505d5ac33d7668bac94d131a29.zip
fix: auth routing
-rw-r--r--packages/console/app/src/component/header.tsx4
-rw-r--r--packages/console/app/src/routes/auth/[...callback].ts6
-rw-r--r--packages/console/app/src/routes/auth/index.ts8
-rw-r--r--packages/console/app/src/routes/temp.tsx4
-rw-r--r--packages/console/app/src/routes/zen/index.tsx4
5 files changed, 17 insertions, 9 deletions
diff --git a/packages/console/app/src/component/header.tsx b/packages/console/app/src/component/header.tsx
index 50f1b73d3..6fa0f43ad 100644
--- a/packages/console/app/src/component/header.tsx
+++ b/packages/console/app/src/component/header.tsx
@@ -167,7 +167,7 @@ export function Header(props: { zen?: boolean; hideGetStarted?: boolean }) {
<li>
<Switch>
<Match when={props.zen}>
- <a href={language.route("/auth")}>{i18n.t("nav.login")}</a>
+ <a href="/auth">{i18n.t("nav.login")}</a>
</Match>
<Match when={!props.zen}>
<A href={language.route("/zen")}>{i18n.t("nav.zen")}</A>
@@ -263,7 +263,7 @@ export function Header(props: { zen?: boolean; hideGetStarted?: boolean }) {
<li>
<Switch>
<Match when={props.zen}>
- <a href={language.route("/auth")}>{i18n.t("nav.login")}</a>
+ <a href="/auth">{i18n.t("nav.login")}</a>
</Match>
<Match when={!props.zen}>
<A href={language.route("/zen")}>{i18n.t("nav.zen")}</A>
diff --git a/packages/console/app/src/routes/auth/[...callback].ts b/packages/console/app/src/routes/auth/[...callback].ts
index 36a9c5194..fa19b467e 100644
--- a/packages/console/app/src/routes/auth/[...callback].ts
+++ b/packages/console/app/src/routes/auth/[...callback].ts
@@ -2,9 +2,11 @@ import { redirect } from "@solidjs/router"
import type { APIEvent } from "@solidjs/start/server"
import { AuthClient } from "~/context/auth"
import { useAuthSession } from "~/context/auth"
+import { fromPathname, localeFromRequest, route } from "~/lib/language"
export async function GET(input: APIEvent) {
const url = new URL(input.request.url)
+ const locale = localeFromRequest(input.request)
try {
const code = url.searchParams.get("code")
@@ -28,7 +30,9 @@ export async function GET(input: APIEvent) {
current: id,
}
})
- return redirect(url.pathname === "/auth/callback" ? "/auth" : url.pathname.replace("/auth/callback", ""))
+ const next = url.pathname === "/auth/callback" ? "/auth" : url.pathname.replace("/auth/callback", "")
+ if (fromPathname(next)) return redirect(next)
+ return redirect(route(locale, next))
} catch (e: any) {
return new Response(
JSON.stringify({
diff --git a/packages/console/app/src/routes/auth/index.ts b/packages/console/app/src/routes/auth/index.ts
index 5b49db157..842b63e04 100644
--- a/packages/console/app/src/routes/auth/index.ts
+++ b/packages/console/app/src/routes/auth/index.ts
@@ -1,12 +1,16 @@
import { redirect } from "@solidjs/router"
import type { APIEvent } from "@solidjs/start/server"
import { getLastSeenWorkspaceID } from "../workspace/common"
+import { localeFromRequest, route } from "~/lib/language"
export async function GET(input: APIEvent) {
+ const locale = localeFromRequest(input.request)
try {
const workspaceID = await getLastSeenWorkspaceID()
- return redirect(`/workspace/${workspaceID}`)
+ return redirect(route(locale, `/workspace/${workspaceID}`))
} catch {
- return redirect("/auth/authorize")
+ const cont = route(locale, "/auth")
+ if (cont === "/auth") return redirect("/auth/authorize")
+ return redirect(`/auth/authorize?continue=${encodeURIComponent(cont)}`)
}
}
diff --git a/packages/console/app/src/routes/temp.tsx b/packages/console/app/src/routes/temp.tsx
index 0a2447f44..ac506928e 100644
--- a/packages/console/app/src/routes/temp.tsx
+++ b/packages/console/app/src/routes/temp.tsx
@@ -51,7 +51,7 @@ export default function Home() {
<img data-slot="logo dark" src={logoDark} alt="opencode logo dark" />
<h1 data-slot="title">{i18n.t("temp.hero.title")}</h1>
<div data-slot="login">
- <a href={language.route("/auth")}>{i18n.t("temp.zen")}</a>
+ <a href="/auth">{i18n.t("temp.zen")}</a>
</div>
</section>
@@ -60,7 +60,7 @@ export default function Home() {
<a href={language.route("/docs")}>{i18n.t("temp.getStarted")}</a>
</div>
<div data-slot="center">
- <a href={language.route("/auth")}>{i18n.t("temp.zen")}</a>
+ <a href="/auth">{i18n.t("temp.zen")}</a>
</div>
<div data-slot="right">
<button data-copy data-slot="command">
diff --git a/packages/console/app/src/routes/zen/index.tsx b/packages/console/app/src/routes/zen/index.tsx
index d32c1bbaa..5b5581b53 100644
--- a/packages/console/app/src/routes/zen/index.tsx
+++ b/packages/console/app/src/routes/zen/index.tsx
@@ -122,7 +122,7 @@ export default function Home() {
</svg>
</div>
</div>
- <a href={language.route("/auth")}>
+ <a href="/auth">
<span>{i18n.t("zen.cta.start")}</span>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
@@ -304,7 +304,7 @@ export default function Home() {
{i18n.t("zen.faq.a4.p1.beforePricing")}{" "}
<a href={language.route("/docs/zen/#pricing")}>{i18n.t("zen.faq.a4.p1.pricingLink")}</a>{" "}
{i18n.t("zen.faq.a4.p1.afterPricing")} {i18n.t("zen.faq.a4.p2.beforeAccount")}{" "}
- <a href={language.route("/auth")}>{i18n.t("zen.faq.a4.p2.accountLink")}</a>. {i18n.t("zen.faq.a4.p3")}
+ <a href="/auth">{i18n.t("zen.faq.a4.p2.accountLink")}</a>. {i18n.t("zen.faq.a4.p3")}
</Faq>
</li>
<li>