fix: dashboard auto-detects datasette URL from browser location

Dashboard now calculates datasette URL as same-host:port+1, works for
both localhost and remote access via Tailscale.
This commit is contained in:
Zeus 2026-02-22 10:54:30 +00:00
parent 91b7bc3ec1
commit f73136d83b

View file

@ -220,7 +220,10 @@
</div>
<script>
const API_BASE = 'http://localhost:8100';
// Auto-detect datasette URL: same host, port+1
const dashboardPort = parseInt(window.location.port) || 8100;
const datasettePort = dashboardPort + 1;
const API_BASE = `${window.location.protocol}//${window.location.hostname}:${datasettePort}`;
async function fetchData(table, sql) {
const url = `${API_BASE}/argus.json?sql=${encodeURIComponent(sql)}&_shape=array`;