From 14eeee3fbc0a839d918149765d2134d05cd14601 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 18 Oct 2022 17:18:32 +0200 Subject: [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. --- src/hydrilla/proxy/web_ui/_app.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/hydrilla/proxy/web_ui/_app.py') 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 -- cgit v1.2.3