Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): extend desktop API CORS and PATCH export

Richie McIlroy0a6789c700b7
diff --git a/apps/web/app/api/desktop/[...route]/route.ts b/apps/web/app/api/desktop/[...route]/route.ts
index d1a156d4d..9255bc7eb 100644
--- a/apps/web/app/api/desktop/[...route]/route.ts
+++ b/apps/web/app/api/desktop/[...route]/route.ts
@@ -18,5 +18,6 @@ const app = new Hono()
export const GET = handle(app);
export const POST = handle(app);
+export const PATCH = handle(app);
export const OPTIONS = handle(app);
export const DELETE = handle(app);
diff --git a/apps/web/app/api/utils.ts b/apps/web/app/api/utils.ts
index 1feeb4db9..3d25b5167 100644
--- a/apps/web/app/api/utils.ts
+++ b/apps/web/app/api/utils.ts
@@ -70,7 +70,7 @@ function debouncedLastUsedUpdate(keyHash: string) {
async function getAuth(c: Context) {
const authHeader = c.req.header("authorization")?.split(" ")[1];
- let user;
+ let user: Awaited<ReturnType<typeof getCurrentUser>> | undefined;
if (authHeader?.length === 36) {
const res = await db()
@@ -124,7 +124,7 @@ export const allowedOrigins = [
export const corsMiddleware = cors({
origin: allowedOrigins,
credentials: true,
- allowMethods: ["POST", "OPTIONS"],
+ allowMethods: ["GET", "POST", "PATCH", "DELETE", "OPTIONS"],
allowHeaders: ["Content-Type", "Authorization", "sentry-trace", "baggage"],
});