diff options
Diffstat (limited to 'public')
| -rw-r--r-- | public/app.css | 13 | ||||
| -rw-r--r-- | public/app.js | 16 | ||||
| -rw-r--r-- | public/index.html | 5 |
3 files changed, 32 insertions, 2 deletions
diff --git a/public/app.css b/public/app.css index 153c334..a0cde93 100644 --- a/public/app.css +++ b/public/app.css @@ -146,6 +146,19 @@ html, body { } #import-state[hidden] { display: none; } +.direct-hint { + margin-top: 8px; + font-size: 12px; + letter-spacing: .03em; + color: var(--muted); +} +.direct-hint a { + color: var(--ring); + text-decoration: none; + border-bottom: 1px solid rgba(125, 211, 252, .3); +} +.direct-hint a:hover { border-bottom-color: var(--ring); } + #file { position: absolute; width: 1px; 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 diff --git a/public/index.html b/public/index.html index ae56eea..736d446 100644 --- a/public/index.html +++ b/public/index.html @@ -5,7 +5,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="color-scheme" content="dark"> <title>pathways</title> - <link rel="stylesheet" href="/app.css?v=44"> + <link rel="stylesheet" href="/app.css?v=45"> </head> <body> <main id="stage"> @@ -19,6 +19,7 @@ </svg> <span>import photos</span> </label> + <p id="direct-hint" class="direct-hint" hidden>upload slow? use the direct link <a id="direct-link" href="#"></a></p> </div> </main> <input id="file" type="file" accept="image/jpeg,image/png,image/webp" multiple> @@ -28,6 +29,6 @@ <span id="progress-text"></span> </div> <div id="toast" role="status" aria-live="polite"></div> - <script src="/app.js?v=44"></script> + <script src="/app.js?v=45"></script> </body> </html> |
