Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: Send original origin
Richie McIlroy8f441c088d1e
diff --git a/apps/desktop/src/components/windows/inner/Recorder.tsx b/apps/desktop/src/components/windows/inner/Recorder.tsxindex 9c4f976df..0e872c443 100644--- a/apps/desktop/src/components/windows/inner/Recorder.tsx+++ b/apps/desktop/src/components/windows/inner/Recorder.tsx@@ -81,7 +81,7 @@ export const Recorder = () => {const session = JSON.parse(localStorage.getItem("session"));const token = session?.token;const res = await authFetch(- `${process.env.NEXT_PUBLIC_URL}/api/desktop/video/create`,+ `${process.env.NEXT_PUBLIC_URL}/api/desktop/video/create?origin=${window.location.origin}`,{method: "GET",credentials: "include",diff --git a/apps/web/app/api/desktop/video/create/route.ts b/apps/web/app/api/desktop/video/create/route.tsindex 40b4c2e4a..8bc9728c0 100644--- a/apps/web/app/api/desktop/video/create/route.ts+++ b/apps/web/app/api/desktop/video/create/route.ts@@ -4,22 +4,28 @@ import { videos } from "@cap/database/schema";import { getCurrentUser } from "@cap/database/auth/session";import { nanoId } from "@cap/database/helpers";-const allowedOrigins = [- process.env.NEXT_PUBLIC_URL,- "http://localhost:3001",- "tauri://localhost",- "http://tauri.localhost",-];-export async function OPTIONS(req: NextRequest) {- const origin = req.nextUrl.origin;+ const params = req.nextUrl.searchParams;+ const origin = params.get("origin") || null;+ const originalOrigin = req.nextUrl.origin;++ const allowedOrigins = [+ process.env.NEXT_PUBLIC_URL,+ "http://localhost:3001",+ "tauri://localhost",+ "http://tauri.localhost",+ "https://tauri.localhost",+ ];return new Response(null, {status: 200,headers: {- "Access-Control-Allow-Origin": allowedOrigins.includes(origin)- ? origin- : "null",+ "Access-Control-Allow-Origin":+ origin && allowedOrigins.includes(origin)+ ? origin+ : allowedOrigins.includes(originalOrigin)+ ? originalOrigin+ : "null","Access-Control-Allow-Credentials": "true","Access-Control-Allow-Methods": "GET, OPTIONS","Access-Control-Allow-Headers": "Authorization",