wip: cloud

This commit is contained in:
Frank
2025-08-29 19:34:56 -04:00
parent b40c02e258
commit c3a25eff78
18 changed files with 83 additions and 51 deletions

View File

@@ -1 +1,2 @@
/// <reference types="@solidjs/start/env" />
declare module "cloudflare:workers"

View File

@@ -1,6 +1,7 @@
import { redirect } from "@solidjs/router"
import type { APIEvent } from "@solidjs/start/server"
import { AuthClient, useAuthSession } from "~/context/auth"
import { AuthClient } from "~/context/auth"
import { useAuthSession } from "~/context/auth.session"
export async function GET(input: APIEvent) {
const url = new URL(input.request.url)

View File

@@ -1,4 +1,4 @@
import { Resource } from "sst"
import { Resource } from "@opencode/cloud-core/util/resource.js"
import { Billing } from "@opencode/cloud-core/billing.js"
import type { APIEvent } from "@solidjs/start/server"
import { Database, eq, sql } from "@opencode/cloud-core/drizzle/index.js"

View File

@@ -31,8 +31,6 @@ const isLoggedIn = query(async () => {
return false
}, "isLoggedIn")
export default function Home() {
createAsync(() => isLoggedIn(), {
deferStream: true,
@@ -83,7 +81,9 @@ export default function Home() {
</button>
</div>
<div data-slot="right">
<a href="/auth/authorize" target="_self">Login</a>
<a href="/auth/authorize" target="_self">
Login
</a>
</div>
</section>

View File

@@ -1,4 +1,3 @@
import { Resource } from "sst"
import { Billing } from "@opencode/cloud-core/billing.js"
import type { APIEvent } from "@solidjs/start/server"
import { Database, eq, sql } from "@opencode/cloud-core/drizzle/index.js"
@@ -6,6 +5,7 @@ import { BillingTable, PaymentTable } from "@opencode/cloud-core/schema/billing.
import { Identifier } from "@opencode/cloud-core/identifier.js"
import { centsToMicroCents } from "@opencode/cloud-core/util/price.js"
import { Actor } from "@opencode/cloud-core/actor.js"
import { Resource } from "@opencode/cloud-core/util/resource.js"
export async function POST(input: APIEvent) {
const body = await Billing.stripe().webhooks.constructEventAsync(