diff options
| author | Frank <[email protected]> | 2025-09-18 01:32:40 -0400 |
|---|---|---|
| committer | Frank <[email protected]> | 2025-09-18 01:32:40 -0400 |
| commit | fc4f281408c56ab12db571a470456212a479edf5 (patch) | |
| tree | 309d23b0c497bc61af6f8e650a6036fa41d7cbdb /cloud/app/src/routes/auth | |
| parent | f8c4f713a5b48892899d0ac195c3470ab7ef764c (diff) | |
| download | opencode-fc4f281408c56ab12db571a470456212a479edf5.tar.gz opencode-fc4f281408c56ab12db571a470456212a479edf5.zip | |
wip: zen
Diffstat (limited to 'cloud/app/src/routes/auth')
| -rw-r--r-- | cloud/app/src/routes/auth/authorize.ts | 7 | ||||
| -rw-r--r-- | cloud/app/src/routes/auth/callback.ts | 31 | ||||
| -rw-r--r-- | cloud/app/src/routes/auth/index.ts | 13 |
3 files changed, 0 insertions, 51 deletions
diff --git a/cloud/app/src/routes/auth/authorize.ts b/cloud/app/src/routes/auth/authorize.ts deleted file mode 100644 index 166466ef8..000000000 --- a/cloud/app/src/routes/auth/authorize.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { APIEvent } from "@solidjs/start/server" -import { AuthClient } from "~/context/auth" - -export async function GET(input: APIEvent) { - const result = await AuthClient.authorize(new URL("./callback", input.request.url).toString(), "code") - return Response.redirect(result.url, 302) -} diff --git a/cloud/app/src/routes/auth/callback.ts b/cloud/app/src/routes/auth/callback.ts deleted file mode 100644 index 23025b54d..000000000 --- a/cloud/app/src/routes/auth/callback.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { redirect } from "@solidjs/router" -import type { APIEvent } from "@solidjs/start/server" -import { AuthClient } from "~/context/auth" -import { useAuthSession } from "~/context/auth.session" - -export async function GET(input: APIEvent) { - const url = new URL(input.request.url) - const code = url.searchParams.get("code") - if (!code) throw new Error("No code found") - const result = await AuthClient.exchange(code, `${url.origin}${url.pathname}`) - if (result.err) { - throw new Error(result.err.message) - } - const decoded = AuthClient.decode(result.tokens.access, {} as any) - if (decoded.err) throw new Error(decoded.err.message) - const session = await useAuthSession() - const id = decoded.subject.properties.accountID - await session.update((value) => { - return { - ...value, - account: { - [id]: { - id, - email: decoded.subject.properties.email, - }, - }, - current: id, - } - }) - return redirect("/auth") -} diff --git a/cloud/app/src/routes/auth/index.ts b/cloud/app/src/routes/auth/index.ts deleted file mode 100644 index 308ae2d1d..000000000 --- a/cloud/app/src/routes/auth/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Account } from "@opencode/cloud-core/account.js" -import { redirect } from "@solidjs/router" -import type { APIEvent } from "@solidjs/start/server" -import { withActor } from "~/context/auth.withActor" - -export async function GET(input: APIEvent) { - try { - const workspaces = await withActor(async () => Account.workspaces()) - return redirect(`/workspace/${workspaces[0].id}`) - } catch { - return redirect("/auth/authorize") - } -} |
