feat: add captive portal detection#60
Open
mkarim1378 wants to merge 1 commit into
Open
Conversation
Probes connectivitycheck.gstatic.com/generate_204 before opening listeners. Any non-204 response (redirect, HTML) is treated as a captive portal and logged as a clear warning with the portal URL. A background task re-probes every 30s and logs state transitions. - src/core/captive_portal.py: async probe(), startup_check(), monitor() - main.py: --skip-captive-check flag; wires startup check and monitor task into _run() before server.start(); respects captive_portal.enabled - config.example.json: adds captive_portal section (enabled, open_browser, check_interval)
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.
Summary
src/core/captive_portal.py: asyncprobe()hitsconnectivitycheck.gstatic.com/generate_204before listeners open;any non-204 response is treated as a captive portal
startup_check(): logs a clear warning with the portal URL so usersknow exactly why the relay won't work
monitor()task: re-probes every 30s and logs statetransitions (portal active / cleared) during the session
main.py: new--skip-captive-checkflag; wires both functions into_run()beforeserver.start(); respectscaptive_portal.enabledconfig.example.json: documents the newcaptive_portalsectionMotivation
When behind a hotel/café/office captive portal, all relay requests fail
silently with opaque 502 errors. This gives an immediate, actionable
warning instead.