feat: add localUrl fallback with background reachability probe (#1313)#2205
Open
Troublesis wants to merge 1 commit into
Open
feat: add localUrl fallback with background reachability probe (#1313)#2205Troublesis wants to merge 1 commit into
Troublesis wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds an optional
localUrlto 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 regularurl.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
localUrl, Dashy probes it in the background with ano-corsfetch (we only care whether the request settles vs. aborts/errors — not its contents, so cross-origin LAN services don't trip CORS).effectiveUrlcomputed, which is already bound to the anchorhrefbefore the user clicks — so the probe never delays a click. Until the probe confirms reachability, the regularurlis used.New item options
localUrllocalUrlTimeout1500300–5000localUrlCheckInterval00= only on load + tab focus, clamped to300maxAll three are optional and fully backwards-compatible — items without
localUrlbehave exactly as before.Changes
src/mixins/ItemMixin.js— probe logic,effectiveUrlcomputed, timers/listener lifecyclesrc/components/LinkItems/Item.vue— bindeffectiveUrl, start/stop probing on mount/unmountsrc/components/LinkItems/SubItem.vue— same lifecycle hooks for sub-itemssrc/utils/config/ConfigSchema.json— schema for the three new propertiesdocs/configuring.md— documents the new optionsExample
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
visibilitychangelistener are cleaned up inbeforeUnmountto avoid leaks in multi-page navigation.