Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
wip: Auth cors fix
Richie McIlroy81db713e6fe2
diff --git a/apps/desktop/src/components/windows/inner/Recorder.tsx b/apps/desktop/src/components/windows/inner/Recorder.tsxindex 634764faf..9c4f976df 100644--- a/apps/desktop/src/components/windows/inner/Recorder.tsx+++ b/apps/desktop/src/components/windows/inner/Recorder.tsx@@ -84,6 +84,7 @@ export const Recorder = () => {`${process.env.NEXT_PUBLIC_URL}/api/desktop/video/create`,{method: "GET",+ credentials: "include",cache: "no-store",headers: {Authorization: `Bearer ${token}`,diff --git a/apps/web/middleware.ts b/apps/web/middleware.tsindex 292123ef4..bbac8932e 100644--- a/apps/web/middleware.ts+++ b/apps/web/middleware.ts@@ -1,7 +1,7 @@import { NextRequest, NextResponse } from "next/server";export function middleware(request: NextRequest) {- if (request.nextUrl.pathname.startsWith("/api/desktop/")) {+ if (request.nextUrl.pathname.includes("/api/desktop/")) {const token = request.headers.get("authorization")?.split(" ")[1];const cookieIsSet = request.cookies.get("next-auth.session-token");diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjsindex 6f09f7b0b..d9a6920dc 100644--- a/apps/web/next.config.mjs+++ b/apps/web/next.config.mjs@@ -59,6 +59,48 @@ const nextConfig = {},],},+ {+ source: "/api/desktop/(.*)",+ headers: [+ {+ key: "Access-Control-Allow-Origin",+ value: "http://tauri.localhost",+ },+ {+ key: "Access-Control-Allow-Methods",+ value: "GET, POST, PUT, DELETE, OPTIONS",+ },+ {+ key: "Access-Control-Allow-Headers",+ value: "Authorization",+ },+ {+ key: "Access-Control-Allow-Credentials",+ value: "true",+ },+ ],+ },+ {+ source: "/api/desktop/(.*)",+ headers: [+ {+ key: "Access-Control-Allow-Origin",+ value: "tauri://localhost/",+ },+ {+ key: "Access-Control-Allow-Methods",+ value: "GET, POST, PUT, DELETE, OPTIONS",+ },+ {+ key: "Access-Control-Allow-Headers",+ value: "Authorization",+ },+ {+ key: "Access-Control-Allow-Credentials",+ value: "true",+ },+ ],+ },{source: "/api/desktop/(.*)",headers: [@@ -72,7 +114,11 @@ const nextConfig = {},{key: "Access-Control-Allow-Headers",- value: "Content-Type, Authorization",+ value: "Authorization",+ },+ {+ key: "Access-Control-Allow-Credentials",+ value: "true",},],},@@ -89,7 +135,11 @@ const nextConfig = {},{key: "Access-Control-Allow-Headers",- value: "Content-Type, Authorization",+ value: "Authorization",+ },+ {+ key: "Access-Control-Allow-Credentials",+ value: "true",},],},