diff --git a/app/(chat)/ai-cad/page.tsx b/app/(chat)/ai-cad/page.tsx
index 514994dd6..54294f17d 100644
--- a/app/(chat)/ai-cad/page.tsx
+++ b/app/(chat)/ai-cad/page.tsx
@@ -4,7 +4,8 @@ import type { Metadata } from "next";
import { redirect } from "next/navigation";
import { auth } from "@/app/(auth)/auth";
-const ZOO_MODELING_APP_SRC = "/vendor/zoo-modeling-app/index.html";
+const ZOO_MODELING_APP_SRC =
+ "/vendor/zoo-modeling-app/index.html?v=f2b345db";
export const dynamic = "force-dynamic";
export const metadata: Metadata = {
diff --git a/scripts/vendor-zoo-modeling-app.mjs b/scripts/vendor-zoo-modeling-app.mjs
index 494b5c55c..544d6c0da 100644
--- a/scripts/vendor-zoo-modeling-app.mjs
+++ b/scripts/vendor-zoo-modeling-app.mjs
@@ -31,6 +31,8 @@ const outputDir = path.join(root, "public/vendor/zoo-modeling-app");
const customizationDir = path.join(root, "vendor/zoo-modeling-app");
const proxyToken = "hicad-session";
const brandedFaviconUrl = "/api/favicon?surface=hicad";
+const enableManufacturingExtension =
+ process.env.HICAD_MANUFACTURING_EXTENSION === "1";
function run(command, args, options = {}) {
const result = spawnSync(command, args, {
@@ -134,18 +136,20 @@ function patchOfficialSource() {
path.join(customizationDir, "Logo.tsx"),
path.join(sourceDir, "src/components/Logo.tsx")
);
- copyFileSync(
- path.join(customizationDir, "manufacturing.ts"),
- path.join(sourceDir, "src/components/manufacturing.ts")
- );
- copyFileSync(
- path.join(customizationDir, "HicadManufacturingPanel.tsx"),
- path.join(sourceDir, "src/components/HicadManufacturingPanel.tsx")
- );
- copyFileSync(
- path.join(customizationDir, "HicadManufacturingLauncher.tsx"),
- path.join(sourceDir, "src/components/HicadManufacturingLauncher.tsx")
- );
+ if (enableManufacturingExtension) {
+ copyFileSync(
+ path.join(customizationDir, "manufacturing.ts"),
+ path.join(sourceDir, "src/components/manufacturing.ts")
+ );
+ copyFileSync(
+ path.join(customizationDir, "HicadManufacturingPanel.tsx"),
+ path.join(sourceDir, "src/components/HicadManufacturingPanel.tsx")
+ );
+ copyFileSync(
+ path.join(customizationDir, "HicadManufacturingLauncher.tsx"),
+ path.join(sourceDir, "src/components/HicadManufacturingLauncher.tsx")
+ );
+ }
copyFileSync(
path.join(customizationDir, "localization.ts"),
path.join(sourceDir, "src/lib/hicadLocalization.ts")
@@ -211,16 +215,29 @@ function patchOfficialSource() {
" \n",
""
);
- replaceSource(
- "src/components/OpenedProject.tsx",
- "import { AppHeader } from '@src/components/AppHeader'\n",
- "import { AppHeader } from '@src/components/AppHeader'\nimport { HicadManufacturingLauncher } from '@src/components/HicadManufacturingLauncher'\n"
- );
- replaceSource(
- "src/components/OpenedProject.tsx",
- " \n \n \n",
+ ""
+ );
+ }
replaceSource(
"src/lib/socket.ts",
` ws.addEventListener('open', () => {\n ws.send(\n JSON.stringify({\n type: 'headers',\n headers: {\n Authorization: 'Bearer ' + token,\n },\n })\n )\n resolve(ws)\n })`,
diff --git a/tests/routes/hicad-manufacturing-extension.test.ts b/tests/routes/hicad-manufacturing-extension.test.ts
index 8c9a613f6..4a879a793 100644
--- a/tests/routes/hicad-manufacturing-extension.test.ts
+++ b/tests/routes/hicad-manufacturing-extension.test.ts
@@ -44,6 +44,9 @@ test.describe('HiCAD manufacturing extension', () => {
'utf8'
)
+ expect(vendorScript).toContain(
+ 'process.env.HICAD_MANUFACTURING_EXTENSION === "1"'
+ )
expect(vendorScript).toContain(
'vendor/zoo-modeling-app/HicadManufacturingLauncher.tsx'
.split('/')