mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
fix(desktop): route register-interest to cloud when sidecar lacks CONVEX_URL (#639)
* fix(desktop): route register-interest to cloud when sidecar lacks CONVEX_URL The waitlist registration endpoint needs Convex (cloud-only dependency). The sidecar handler returned 503 without cloud fallback, and getRemoteApiBaseUrl() returned '' on desktop (VITE_WS_API_URL unset), so the settings window fetch resolved to tauri://localhost → 404. Three-layer fix: 1. Sidecar: tryCloudFallback() when CONVEX_URL missing (proxies to https://worldmonitor.app via remoteBase) 2. runtime.ts: getRemoteApiBaseUrl() defaults to https://worldmonitor.app on desktop when VITE_WS_API_URL is unset 3. CI: add VITE_WS_API_URL=https://worldmonitor.app to all 4 desktop build steps * chore(deps): bump posthog-js to fix pre-push typecheck
This commit is contained in:
4
.github/workflows/build-desktop.yml
vendored
4
.github/workflows/build-desktop.yml
vendored
@@ -207,6 +207,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VITE_VARIANT: full
|
||||
VITE_DESKTOP_RUNTIME: '1'
|
||||
VITE_WS_API_URL: https://worldmonitor.app
|
||||
CONVEX_URL: ${{ secrets.CONVEX_URL }}
|
||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||
@@ -231,6 +232,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VITE_VARIANT: full
|
||||
VITE_DESKTOP_RUNTIME: '1'
|
||||
VITE_WS_API_URL: https://worldmonitor.app
|
||||
CONVEX_URL: ${{ secrets.CONVEX_URL }}
|
||||
with:
|
||||
tagName: v__VERSION__
|
||||
@@ -249,6 +251,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VITE_VARIANT: tech
|
||||
VITE_DESKTOP_RUNTIME: '1'
|
||||
VITE_WS_API_URL: https://worldmonitor.app
|
||||
CONVEX_URL: ${{ secrets.CONVEX_URL }}
|
||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||
@@ -274,6 +277,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VITE_VARIANT: tech
|
||||
VITE_DESKTOP_RUNTIME: '1'
|
||||
VITE_WS_API_URL: https://worldmonitor.app
|
||||
CONVEX_URL: ${{ secrets.CONVEX_URL }}
|
||||
with:
|
||||
tagName: v__VERSION__-tech
|
||||
|
||||
20
package-lock.json
generated
20
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "world-monitor",
|
||||
"version": "2.5.20",
|
||||
"version": "2.5.21",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "world-monitor",
|
||||
"version": "2.5.20",
|
||||
"version": "2.5.21",
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@deck.gl/aggregation-layers": "^9.2.6",
|
||||
@@ -29,7 +29,7 @@
|
||||
"maplibre-gl": "^5.16.0",
|
||||
"onnxruntime-web": "^1.23.2",
|
||||
"papaparse": "^5.5.3",
|
||||
"posthog-js": "^1.352.0",
|
||||
"posthog-js": "^1.356.1",
|
||||
"telegram": "^2.26.22",
|
||||
"topojson-client": "^3.1.0",
|
||||
"ws": "^8.19.0",
|
||||
@@ -3661,9 +3661,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@posthog/types": {
|
||||
"version": "1.352.0",
|
||||
"resolved": "https://registry.npmjs.org/@posthog/types/-/types-1.352.0.tgz",
|
||||
"integrity": "sha512-pp7VBMlkhlLmv2TyOoss028lPPD4ElnZlX5y3hqq6oijK5BMZbjVuTAgvFYNLiKbuze/i5ndFGyXTtfCwlMQeA==",
|
||||
"version": "1.356.1",
|
||||
"resolved": "https://registry.npmjs.org/@posthog/types/-/types-1.356.1.tgz",
|
||||
"integrity": "sha512-miIUjs4LiBDMOxKkC87HEJLIih0pNGMAjxx+mW4X7jLpN41n0PLMW7swRE6uuxcMV0z3H6MllRSCYmsokkyfuQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@probe.gl/env": {
|
||||
@@ -11120,9 +11120,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/posthog-js": {
|
||||
"version": "1.352.0",
|
||||
"resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.352.0.tgz",
|
||||
"integrity": "sha512-LxLKyoE+Y2z+WQ8CTO3PqQQDBuz64mHLJUoRuAYNXmp3vtxzrygZEz7UNnCT+BZ4/G44Qeq6JDYk1TRS7pIRDA==",
|
||||
"version": "1.356.1",
|
||||
"resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.356.1.tgz",
|
||||
"integrity": "sha512-4EQliSyTp3j/xOaWpZmu7fk1b4S+J3qy4JOu5Xy3/MYFxv1SlAylgifRdCbXZxCQWb6PViaNvwRf4EmburgfWA==",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
@@ -11131,7 +11131,7 @@
|
||||
"@opentelemetry/resources": "^2.2.0",
|
||||
"@opentelemetry/sdk-logs": "^0.208.0",
|
||||
"@posthog/core": "1.23.1",
|
||||
"@posthog/types": "1.352.0",
|
||||
"@posthog/types": "1.356.1",
|
||||
"core-js": "^3.38.1",
|
||||
"dompurify": "^3.3.1",
|
||||
"fflate": "^0.4.8",
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
"maplibre-gl": "^5.16.0",
|
||||
"onnxruntime-web": "^1.23.2",
|
||||
"papaparse": "^5.5.3",
|
||||
"posthog-js": "^1.352.0",
|
||||
"posthog-js": "^1.356.1",
|
||||
"telegram": "^2.26.22",
|
||||
"topojson-client": "^3.1.0",
|
||||
"ws": "^8.19.0",
|
||||
|
||||
@@ -1002,12 +1002,14 @@ async function dispatch(requestUrl, req, routes, context) {
|
||||
}
|
||||
return json({ verboseMode });
|
||||
}
|
||||
// Registration — call Convex directly (desktop frontend bypasses sidecar for this endpoint;
|
||||
// this handler only runs when CONVEX_URL is available, e.g. self-hosted deployments)
|
||||
// Registration — call Convex directly when CONVEX_URL is available (self-hosted),
|
||||
// otherwise proxy to cloud (desktop sidecar never has CONVEX_URL).
|
||||
if (requestUrl.pathname === '/api/register-interest' && req.method === 'POST') {
|
||||
const convexUrl = process.env.CONVEX_URL;
|
||||
if (!convexUrl) {
|
||||
return json({ error: 'Registration service not configured — use cloud endpoint directly' }, 503);
|
||||
const cloudResponse = await tryCloudFallback(requestUrl, req, context, 'no CONVEX_URL');
|
||||
if (cloudResponse) return cloudResponse;
|
||||
return json({ error: 'Registration service unavailable' }, 503);
|
||||
}
|
||||
try {
|
||||
const body = await new Promise((resolve, reject) => {
|
||||
|
||||
@@ -113,7 +113,12 @@ export function getRemoteApiBaseUrl(): string {
|
||||
}
|
||||
|
||||
const variant = import.meta.env.VITE_VARIANT || 'full';
|
||||
return DEFAULT_REMOTE_HOSTS[variant] ?? DEFAULT_REMOTE_HOSTS.full ?? '';
|
||||
const fromHosts = DEFAULT_REMOTE_HOSTS[variant] ?? DEFAULT_REMOTE_HOSTS.full ?? '';
|
||||
if (fromHosts) return fromHosts;
|
||||
|
||||
// Desktop builds may not set VITE_WS_API_URL; default to production.
|
||||
if (isDesktopRuntime()) return 'https://worldmonitor.app';
|
||||
return '';
|
||||
}
|
||||
|
||||
export function toRuntimeUrl(path: string): string {
|
||||
|
||||
Reference in New Issue
Block a user