mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-20 22:02:19 +03:00
* fix(runtime): eliminate hardcoded 20128 port remnants and make loopback URLs dynamic
- Make model assessment probe base URL resolve dynamically from getRuntimePorts() / env
- Support dynamic loopback in traffic inspector replay route and MITM handlers
- Make WebSocket live server allowlist dynamically include runtime PORT/DASHBOARD_PORT loopback origins
- Update CLI tools config/apply/letta-settings and tool-detector to adapt to configured runtime port
- Update client UI components (EndpointPageClient, ApiExplorerClient, RelayProxyClient) to use current window origin or dynamic port
- Make resolveOmniRouteBaseUrl, useDisplayBaseUrl, and wellKnown.ts respect configured port
- Update package.json electron:dev wait-on to use ${PORT:-20128}
- Add test coverage for custom port in resolveOmniRouteBaseUrl and liveServerAllowList
- Add changelog fragment for PR #13533
* fix(runtime): complete the truncated fallback comment in wellKnown.ts
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
---------
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import {
|
|
DEFAULT_OMNIROUTE_BASE_URL,
|
|
resolveOmniRouteBaseUrl,
|
|
} from "../../src/shared/utils/resolveOmniRouteBaseUrl.ts";
|
|
|
|
test("resolveOmniRouteBaseUrl prefers OMNIROUTE_BASE_URL", () => {
|
|
assert.equal(
|
|
resolveOmniRouteBaseUrl({
|
|
OMNIROUTE_BASE_URL: "https://internal.example.com/",
|
|
BASE_URL: "https://base.example.com",
|
|
NEXT_PUBLIC_BASE_URL: "https://public.example.com",
|
|
}),
|
|
"https://internal.example.com"
|
|
);
|
|
});
|
|
|
|
test("resolveOmniRouteBaseUrl falls back to BASE_URL", () => {
|
|
assert.equal(
|
|
resolveOmniRouteBaseUrl({
|
|
BASE_URL: "https://base.example.com/",
|
|
NEXT_PUBLIC_BASE_URL: "https://public.example.com",
|
|
}),
|
|
"https://base.example.com"
|
|
);
|
|
});
|
|
|
|
test("resolveOmniRouteBaseUrl falls back to NEXT_PUBLIC_BASE_URL", () => {
|
|
assert.equal(
|
|
resolveOmniRouteBaseUrl({
|
|
NEXT_PUBLIC_BASE_URL: "https://public.example.com/",
|
|
}),
|
|
"https://public.example.com"
|
|
);
|
|
});
|
|
|
|
test("resolveOmniRouteBaseUrl ignores blank values", () => {
|
|
assert.equal(
|
|
resolveOmniRouteBaseUrl({
|
|
OMNIROUTE_BASE_URL: " ",
|
|
BASE_URL: "",
|
|
NEXT_PUBLIC_BASE_URL: " https://public.example.com/ ",
|
|
}),
|
|
"https://public.example.com"
|
|
);
|
|
});
|
|
|
|
test("resolveOmniRouteBaseUrl uses the default localhost fallback", () => {
|
|
assert.equal(resolveOmniRouteBaseUrl({}), DEFAULT_OMNIROUTE_BASE_URL);
|
|
});
|
|
|
|
test("resolveOmniRouteBaseUrl uses custom port when PORT env is set", () => {
|
|
assert.equal(resolveOmniRouteBaseUrl({ PORT: 37128 }), "http://localhost:37128");
|
|
});
|