Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: Allow any origin for /api/desktop

Richie McIlroy306175130322
diff --git a/apps/desktop/src/components/windows/inner/Recorder.tsx b/apps/desktop/src/components/windows/inner/Recorder.tsx
index d5eaff086..2dc781df5 100644
--- a/apps/desktop/src/components/windows/inner/Recorder.tsx
+++ b/apps/desktop/src/components/windows/inner/Recorder.tsx
@@ -83,7 +83,6 @@ export const Recorder = () => {
const res = await authFetch(
`${process.env.NEXT_PUBLIC_URL}/api/desktop/video/create`,
{
- credentials: "include",
cache: "no-store",
headers: {
Authorization: `Bearer ${token}`,
diff --git a/apps/web/app/api/desktop/video/create/route.ts b/apps/web/app/api/desktop/video/create/route.ts
index cb64c6496..7b32ca050 100644
--- a/apps/web/app/api/desktop/video/create/route.ts
+++ b/apps/web/app/api/desktop/video/create/route.ts
@@ -4,17 +4,6 @@ import { videos } from "@cap/database/schema";
import { getCurrentUser } from "@cap/database/auth/session";
import { nanoId } from "@cap/database/helpers";
-export async function OPTIONS(req: NextRequest) {
- return new Response(null, {
- status: 200,
- headers: {
- "Access-Control-Allow-Origin": "*",
- "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
- "Access-Control-Allow-Headers": "Content-Type, Authorization",
- },
- });
-}
-
export async function GET(req: NextRequest) {
const user = await getCurrentUser();
const awsRegion = process.env.CAP_AWS_REGION;
@@ -25,9 +14,6 @@ export async function GET(req: NextRequest) {
status: 401,
headers: {
"Content-Type": "application/json",
- "Access-Control-Allow-Origin": "*",
- "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
- "Access-Control-Allow-Headers": "Content-Type, Authorization",
},
});
}
@@ -52,9 +38,6 @@ export async function GET(req: NextRequest) {
status: 200,
headers: {
"Content-Type": "application/json",
- "Access-Control-Allow-Origin": "*",
- "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
- "Access-Control-Allow-Headers": "Content-Type, Authorization",
},
}
);
diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs
index 3542bf459..8af1118e9 100644
--- a/apps/web/next.config.mjs
+++ b/apps/web/next.config.mjs
@@ -81,70 +81,7 @@ const nextConfig = {
headers: [
{
key: "Access-Control-Allow-Origin",
- value: "https://tauri.localhost",
- },
- {
- key: "Access-Control-Allow-Methods",
- value: "GET, POST, PUT, DELETE, OPTIONS",
- },
- {
- key: "Access-Control-Allow-Headers",
- value: "Content-Type, Authorization",
- },
- {
- key: "Access-Control-Allow-Credentials",
- value: "true",
- },
- ],
- },
- {
- 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: "Content-Type, 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: "Content-Type, Authorization",
- },
- {
- key: "Access-Control-Allow-Credentials",
- value: "true",
- },
- ],
- },
- {
- source: "/api/desktop/(.*)",
- headers: [
- {
- key: "Access-Control-Allow-Origin",
- value: "http://localhost:3001",
+ value: "*",
},
{
key: "Access-Control-Allow-Methods",
@@ -154,10 +91,6 @@ const nextConfig = {
key: "Access-Control-Allow-Headers",
value: "Content-Type, Authorization",
},
- {
- key: "Access-Control-Allow-Credentials",
- value: "true",
- },
],
},
];