Skip to content

feat: add localUrl fallback with background reachability probe (#1313)#2205

Open
Troublesis wants to merge 1 commit into
lissy93:masterfrom
Troublesis:feat/local-url-remote-access
Open

feat: add localUrl fallback with background reachability probe (#1313)#2205
Troublesis wants to merge 1 commit into
lissy93:masterfrom
Troublesis:feat/local-url-remote-access

Conversation

@Troublesis

Copy link
Copy Markdown

What this does

Adds an optional localUrl to dashboard items: an alternative URL (typically a LAN address) that is used only when it is reachable from the visitor's browser, otherwise the item falls back to the regular url.

This solves the long-standing local-vs-remote access problem described in #1313: when you reach Dashy over a VPN/Tailscale/remote tunnel, LAN addresses and local DNS don't resolve, so a single hard-coded URL can't serve both contexts. With localUrl, the same item "just works" on LAN (direct, fast) and remotely (falls back to the public/proxied URL) — no manual switching.

How it works

  • On mount, if an item has a localUrl, Dashy probes it in the background with a no-cors fetch (we only care whether the request settles vs. aborts/errors — not its contents, so cross-origin LAN services don't trip CORS).
  • The result drives a new effectiveUrl computed, which is already bound to the anchor href before the user clicks — so the probe never delays a click. Until the probe confirms reachability, the regular url is used.
  • Re-probes when the tab regains visibility (e.g. the user changed networks), and optionally on a configurable interval.

New item options

Key Type Default Description
localUrl string Alternative URL preferred when reachable from the browser
localUrlTimeout number 1500 Probe timeout in ms, clamped 3005000
localUrlCheckInterval number 0 Seconds between background re-checks; 0 = only on load + tab focus, clamped to 300 max

All three are optional and fully backwards-compatible — items without localUrl behave exactly as before.

Changes

  • src/mixins/ItemMixin.js — probe logic, effectiveUrl computed, timers/listener lifecycle
  • src/components/LinkItems/Item.vue — bind effectiveUrl, start/stop probing on mount/unmount
  • src/components/LinkItems/SubItem.vue — same lifecycle hooks for sub-items
  • src/utils/config/ConfigSchema.json — schema for the three new properties
  • docs/configuring.md — documents the new options

Example

- title: Home Assistant
  url: https://ha.example.com        # used when remote
  localUrl: http://192.168.0.10:8123 # preferred when on the LAN
  localUrlTimeout: 1500
  localUrlCheckInterval: 0

Notes

Closes the use case in #1313 (the issue was closed as not planned; opening this in case the maintainers reconsider, since the implementation is self-contained and opt-in). Timers and the visibilitychange listener are cleaned up in beforeUnmount to avoid leaks in multi-page navigation.

Introduce an optional per-item localUrl (e.g. a LAN address) that is
preferred over the regular url when reachable from the browser. A
background probe (default 10s interval, 5s timeout) checks
reachability of localUrl and falls back to url when unreachable,
enabling seamless remote/LAN switching without manual config changes.

- ItemMixin: add effectiveUrl computed + probe lifecycle (mount/destroy)
- Item/SubItem: expose localUrl-driven effective url to templates
- ConfigSchema: add localUrl, localUrlTimeout, localUrlCheckInterval
- docs/configuring.md: document the new properties

Closes lissy93#1313
@Troublesis Troublesis requested a review from lissy93 as a code owner June 14, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant