feat(desktop): show a welcome page when the server is unreachable #114
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/desktop-welcome-page"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix the blank-window screenshot the user just hit: without a fallback,
lets-chat-desktopopens, Wry tries to loadLETS_CHAT_SERVER_URL(defaulthttp://localhost:8080), gets a connection-refused / DNS / TLS / timeout failure, and renders a blank window with no hint at what went wrong. Title bar sayslets-chat v0.1.0 (unknown), the rest is empty.Probe the configured URL at startup with a 3s
ureq::getand choose what Wry loads:with_url(&url)exactly like before.with_html(...)against a small embedded welcome page.Welcome page
Single-card layout, system font, plain inline CSS, no external assets. Contents:
LETS_CHAT_SERVER_URL-> restart.lets-chat-desktop <version> · <git-hash>for support.include_str!'d into the binary so the page works on a freshly-installed standalone.exewith no network. Every substituted value (URL, reason, version, git-hash) goes through a smallhtml_escapeso a hostile server URL can't inject markup.Files
desktop/src/welcome.rs- probe + HTML render.desktop/src/welcome.html- the page template.desktop/src/main.rs- wire the probe betweenset_linux_gtk_env()andevent_loop.run. CLI subcommands (--version,--check-update,--update) exit before the probe runs, so they are unaffected and don't pay the network cost.Test plan
just check-desktop,just check-fmt, and./dev/cargo-desktop clippy -p lets-chat-desktop -- -D warningsare all green; the only warnings are the pre-existingCargo.toml: file /work/server/src/main.rs found to be present in multiple build targetsfrom the workspace, untouched.--versionstill prints the banner.LETS_CHAT_SERVER_URL=http://localhost:55555 lets-chat-desktop) and confirm the welcome card renders with the failing URL and a connection-refused reason instead of a blank window.