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:
parent
91b7bc3ec1
commit
f73136d83b
1 changed files with 4 additions and 1 deletions
|
|
@ -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`;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue