add configurable cloud api url and subpath routing support for reverse proxies

This commit is contained in:
2026-09-19 12:00:48 +05:30
parent ce16210525
commit cc45a2f270
10 changed files with 106 additions and 50 deletions
+9 -2
View File
@@ -3432,9 +3432,16 @@
}
// === Configuration ===
const API_BASE = window.location.origin + '/api';
function getAppPrefix() {
const p = window.location.pathname;
if (p.includes('/api/')) return p.substring(0, p.indexOf('/api/'));
if (p.includes('/dashboard')) return p.substring(0, p.indexOf('/dashboard'));
return '';
}
const APP_PREFIX = getAppPrefix();
const API_BASE = window.location.origin + APP_PREFIX + '/api';
const POLL_INTERVAL = 2000; // 2 seconds
const WS_URL = `${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}/ws/vitals`;
const WS_URL = `${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}${APP_PREFIX}/ws/vitals`;
// === Vital ranges for status calculation ===
const VITAL_RANGES = {