diff --git a/artifacts/api-server/src/app.ts b/artifacts/api-server/src/app.ts index 992833b..9d88983 100644 --- a/artifacts/api-server/src/app.ts +++ b/artifacts/api-server/src/app.ts @@ -1,6 +1,7 @@ import express, { type Express } from "express"; import cors from "cors"; import path from "path"; +import { fileURLToPath } from "url"; import router from "./routes/index.js"; import adminRelayPanelRouter from "./routes/admin-relay-panel.js"; import { responseTimeMiddleware } from "./middlewares/response-time.js"; @@ -58,8 +59,13 @@ app.use(adminRelayPanelRouter); // ── Tower (Matrix 3D frontend) ─────────────────────────────────────────────── // Serve the pre-built Three.js world at /tower. WS client auto-connects to -// /api/ws on the same host. process.cwd() = workspace root at runtime. -const towerDist = path.resolve(process.cwd(), "the-matrix", "dist"); +// /api/ws on the same host. +// Use import.meta.url so the path is correct whether the server is started from +// artifacts/api-server (dev) or the workspace root (production build). +// From src/ or dist/ (both 3 levels inside workspace), three "../" steps reach +// the workspace root where the-matrix/ lives. +const __dirname_app = path.dirname(fileURLToPath(import.meta.url)); +const towerDist = path.resolve(__dirname_app, "../../..", "the-matrix", "dist"); app.use("/tower", express.static(towerDist)); app.get("/tower/*splat", (_req, res) => res.sendFile(path.join(towerDist, "index.html"))); diff --git a/artifacts/mobile/app/(tabs)/matrix.tsx b/artifacts/mobile/app/(tabs)/matrix.tsx index 64c0c41..3f11690 100644 --- a/artifacts/mobile/app/(tabs)/matrix.tsx +++ b/artifacts/mobile/app/(tabs)/matrix.tsx @@ -17,10 +17,10 @@ const C = Colors.dark; function getMatrixUrl(): string { const domain = process.env.EXPO_PUBLIC_DOMAIN ?? ""; - if (!domain) return "http://localhost:8080/"; + if (!domain) return "http://localhost:8080/tower"; const stripped = domain.replace(/^https?:\/\//, "").replace(/\/$/, ""); const proto = stripped.startsWith("localhost") ? "http" : "https"; - return `${proto}://${stripped}/`; + return `${proto}://${stripped}/tower`; } export default function MatrixScreen() { diff --git a/attached_assets/IMG_6360_1773967437854.jpeg b/attached_assets/IMG_6360_1773967437854.jpeg new file mode 100644 index 0000000..eaf6200 Binary files /dev/null and b/attached_assets/IMG_6360_1773967437854.jpeg differ