Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: allow cross-origin requests for models

Brad Barbin14a6e15fc5b8
diff --git a/apps/carbon/app/routes/file+/model+/public.$.tsx b/apps/carbon/app/routes/file+/model+/public.$.tsx
index 7991f9a13c..9bbb55e4e4 100644
--- a/apps/carbon/app/routes/file+/model+/public.$.tsx
+++ b/apps/carbon/app/routes/file+/model+/public.$.tsx
@@ -65,6 +65,9 @@ export let loader = async ({ params }: LoaderFunctionArgs) => {
const headers = new Headers({
"Content-Type": contentType,
"Cache-Control": "private, max-age=31536000, immutable", // Cache for a year
+ "Access-Control-Allow-Origin": "*", // Allow cross-origin requests
+ "Access-Control-Allow-Methods": "GET", // Only allow GET requests
+ "Access-Control-Allow-Headers": "Content-Type", // Allow Content-Type header
});
return new Response(fileData, { status: 200, headers });
};
diff --git a/ci/src/client.ts b/ci/src/client.ts
index cc0a7d07e7..ad1fefc2c2 100644
--- a/ci/src/client.ts
+++ b/ci/src/client.ts
@@ -2,19 +2,3 @@ import { createClient } from "@supabase/supabase-js";
import { SUPABASE_SERVICE_ROLE, SUPABASE_URL } from "./env";
export const client = createClient(SUPABASE_URL, SUPABASE_SERVICE_ROLE);
-
-export type Customer = {
- id: number;
- name: string;
- slug: string;
- active: boolean;
- seeded: boolean;
- database_url: string | null;
- project_id: string | null;
- decrypted_access_token: string | null;
- decrypted_anon_key: string | null;
- decrypted_database_password: string | null;
- decrypted_jwt_key: string | null;
- decrypted_service_role_key: string | null;
- latest_migration: string | null;
-};
diff --git a/ci/src/migrations.ts b/ci/src/migrations.ts
index ffa3953a65..db9eb123bf 100644
--- a/ci/src/migrations.ts
+++ b/ci/src/migrations.ts
@@ -1,8 +1,24 @@
import { $ } from "execa";
-import type { Customer } from "./client";
+
import { client } from "./client";
import { SUPABASE_ACCESS_TOKEN } from "./env";
+export type Customer = {
+ id: number;
+ name: string;
+ slug: string;
+ active: boolean;
+ seeded: boolean;
+ database_url: string | null;
+ project_id: string | null;
+ decrypted_access_token: string | null;
+ decrypted_anon_key: string | null;
+ decrypted_database_password: string | null;
+ decrypted_jwt_key: string | null;
+ decrypted_service_role_key: string | null;
+ latest_migration: string | null;
+};
+
async function migrate(): Promise<void> {
console.log("✅ 🌱 Starting migrations");