aboutsummaryrefslogtreecommitdiff
path: root/public/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/app.js')
-rw-r--r--public/app.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/public/app.js b/public/app.js
index 78584bf..780bc98 100644
--- a/public/app.js
+++ b/public/app.js
@@ -661,6 +661,21 @@ function hideImportState() {
stage.classList.remove("blocked")
}
+async function initDirectHint() {
+ try {
+ const r = await fetch("/api/health")
+ const data = await r.json()
+ const d = data.direct || {}
+ const urls = [d.magic, d.lan, d.tailscale].filter(Boolean)
+ if (!urls.length) return
+ if (urls.some((u) => { try { return new URL(u).host === location.host } catch { return false } })) return
+ const link = $("#direct-link")
+ link.textContent = d.magic
+ link.href = d.magic
+ $("#direct-hint").hidden = false
+ } catch { /* ignore */ }
+}
+
async function beginWalk() {
if (started) return
started = true
@@ -695,6 +710,7 @@ async function beginWalk() {
} catch {
showImportState()
}
+ initDirectHint()
})()
let toastTimer = 0