diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-10-18 17:18:32 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-10-18 20:13:45 +0200 |
commit | 14eeee3fbc0a839d918149765d2134d05cd14601 (patch) | |
tree | dec1ca7dbc8668120e53e8ea45328246313199d1 /src/hydrilla/proxy/web_ui/_app.py | |
parent | 76f4b6769d0acaeffbd8e8a003fcbb3e2fbea107 (diff) | |
download | haketilo-hydrilla-14eeee3fbc0a839d918149765d2134d05cd14601.tar.gz haketilo-hydrilla-14eeee3fbc0a839d918149765d2134d05cd14601.zip |
[proxy] upon Haketilo launch automatically open Haketilo landing page in user's default web browser
* The landing page instructs user to configure browser's proxy settings.
* It is now possible to choose the IP address to listen on via command line parameter.
* The browser launching behavior can be switched off via command line parameter.
Diffstat (limited to 'src/hydrilla/proxy/web_ui/_app.py')
-rw-r--r-- | src/hydrilla/proxy/web_ui/_app.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/hydrilla/proxy/web_ui/_app.py b/src/hydrilla/proxy/web_ui/_app.py index ab15918..f54f72e 100644 --- a/src/hydrilla/proxy/web_ui/_app.py +++ b/src/hydrilla/proxy/web_ui/_app.py @@ -4,6 +4,8 @@ # # Available under the terms of Creative Commons Zero v1.0 Universal. +import enum +import dataclasses as dc import typing as t import flask @@ -11,8 +13,17 @@ import flask from .. import state as st +class UIDomain(enum.Enum): + MAIN = enum.auto() + LANDING_PAGE = enum.auto() + +@dc.dataclass(init=False) class WebUIApp(flask.Flask): - _haketilo_state: st.HaketiloState + _haketilo_state: st.HaketiloState + _haketilo_ui_domain: t.ClassVar[UIDomain] def get_haketilo_state() -> st.HaketiloState: return t.cast(WebUIApp, flask.current_app)._haketilo_state + +def get_haketilo_ui_domain() -> UIDomain: + return t.cast(WebUIApp, flask.current_app)._haketilo_ui_domain |