Skip to content

Commit 6fe265e

Browse files
committed
Merge branch 'zen-black' into dev
2 parents f242541 + 2aed4d2 commit 6fe265e

22 files changed

Lines changed: 3730 additions & 267 deletions

bun.lock

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infra/console.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ const ZEN_MODELS = [
122122
]
123123
const ZEN_BLACK = new sst.Secret("ZEN_BLACK")
124124
const STRIPE_SECRET_KEY = new sst.Secret("STRIPE_SECRET_KEY")
125+
const STRIPE_PUBLISHABLE_KEY = new sst.Secret("STRIPE_PUBLISHABLE_KEY")
125126
const AUTH_API_URL = new sst.Linkable("AUTH_API_URL", {
126127
properties: { value: auth.url.apply((url) => url!) },
127128
})
@@ -177,6 +178,7 @@ new sst.cloudflare.x.SolidStart("Console", {
177178
//VITE_DOCS_URL: web.url.apply((url) => url!),
178179
//VITE_API_URL: gateway.url.apply((url) => url!),
179180
VITE_AUTH_URL: auth.url.apply((url) => url!),
181+
VITE_STRIPE_PUBLISHABLE_KEY: STRIPE_PUBLISHABLE_KEY.value,
180182
},
181183
transform: {
182184
server: {

packages/console/app/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"typecheck": "tsgo --noEmit",
88
"dev": "vite dev --host 0.0.0.0",
9-
"dev:remote": "VITE_AUTH_URL=https://auth.dev.opencode.ai bun sst shell --stage=dev bun dev",
9+
"dev:remote": "VITE_AUTH_URL=https://auth.dev.opencode.ai VITE_STRIPE_PUBLISHABLE_KEY=pk_test_51RtuLNE7fOCwHSD4mewwzFejyytjdGoSDK7CAvhbffwaZnPbNb2rwJICw6LTOXCmWO320fSNXvb5NzI08RZVkAxd00syfqrW7t bun sst shell --stage=dev bun dev",
1010
"build": "./script/generate-sitemap.ts && vite build && ../../opencode/script/schema.ts ./.output/public/config.json",
1111
"start": "vite start"
1212
},
@@ -23,10 +23,12 @@
2323
"@solidjs/meta": "catalog:",
2424
"@solidjs/router": "catalog:",
2525
"@solidjs/start": "catalog:",
26+
"@stripe/stripe-js": "8.6.1",
2627
"chart.js": "4.5.1",
2728
"nitro": "3.0.1-alpha.1",
2829
"solid-js": "catalog:",
2930
"solid-list": "0.3.0",
31+
"solid-stripe": "0.8.1",
3032
"vite": "catalog:",
3133
"zod": "catalog:"
3234
},

packages/console/app/src/routes/auth/callback.ts renamed to packages/console/app/src/routes/auth/[...callback].ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useAuthSession } from "~/context/auth"
55

66
export async function GET(input: APIEvent) {
77
const url = new URL(input.request.url)
8+
89
try {
910
const code = url.searchParams.get("code")
1011
if (!code) throw new Error("No code found")
@@ -27,7 +28,7 @@ export async function GET(input: APIEvent) {
2728
current: id,
2829
}
2930
})
30-
return redirect("/auth")
31+
return redirect(url.pathname === "/auth/callback" ? "/auth" : url.pathname.replace("/auth/callback", ""))
3132
} catch (e: any) {
3233
return new Response(
3334
JSON.stringify({

packages/console/app/src/routes/auth/authorize.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import type { APIEvent } from "@solidjs/start/server"
22
import { AuthClient } from "~/context/auth"
33

44
export async function GET(input: APIEvent) {
5-
const result = await AuthClient.authorize(new URL("./callback", input.request.url).toString(), "code")
5+
const url = new URL(input.request.url)
6+
const cont = url.searchParams.get("continue") ?? ""
7+
const callbackUrl = new URL(`./callback${cont}`, input.request.url)
8+
const result = await AuthClient.authorize(callbackUrl.toString(), "code")
69
return Response.redirect(result.url, 302)
710
}

0 commit comments

Comments
 (0)