mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-27 21:33:41 +02:00
The create-workspace and onboarding UI hardcoded `multica.ai/` as the workspace slug URL prefix, so self-hosted deployments showed the wrong domain. Add a `workspaceUrlHost` helper that derives the host from the deployment's app URL (`daemon_app_url` from `/api/config`, via the config store) and falls back to the brand host when none is configured, then use it in both views. Fixes #4263. Co-authored-by: J <j@multica.ai> Co-authored-by: multica-agent <github@multica.ai>
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { workspaceUrlHost } from "./workspace-url";
|
|
|
|
describe("workspaceUrlHost", () => {
|
|
it("returns the host of a full app URL", () => {
|
|
expect(workspaceUrlHost("https://multica.example.com")).toBe(
|
|
"multica.example.com",
|
|
);
|
|
});
|
|
|
|
it("ignores scheme, path, and trailing slash", () => {
|
|
expect(workspaceUrlHost("https://multica.example.com/")).toBe(
|
|
"multica.example.com",
|
|
);
|
|
expect(workspaceUrlHost("http://multica.example.com/app/onboarding")).toBe(
|
|
"multica.example.com",
|
|
);
|
|
});
|
|
|
|
it("preserves a non-default port", () => {
|
|
expect(workspaceUrlHost("https://my.host:3000")).toBe("my.host:3000");
|
|
});
|
|
|
|
it("accepts a bare host without a scheme", () => {
|
|
expect(workspaceUrlHost("multica.example.com")).toBe("multica.example.com");
|
|
expect(workspaceUrlHost("multica.example.com/path")).toBe(
|
|
"multica.example.com",
|
|
);
|
|
});
|
|
|
|
it("falls back to the brand host when no app URL is configured", () => {
|
|
expect(workspaceUrlHost("")).toBe("multica.ai");
|
|
expect(workspaceUrlHost(" ")).toBe("multica.ai");
|
|
expect(workspaceUrlHost(null)).toBe("multica.ai");
|
|
expect(workspaceUrlHost(undefined)).toBe("multica.ai");
|
|
});
|
|
});
|