From fe43bd552aaacd649b0e00afada01d07ad8dae9a Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Fri, 21 Oct 2022 21:42:56 +0200 Subject: [proxy] facilitate injecting non-payload script to all pages --- src/hydrilla/proxy/state_impl/base.py | 8 ++++---- src/hydrilla/proxy/state_impl/concrete_state.py | 11 ++++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/hydrilla/proxy/state_impl') diff --git a/src/hydrilla/proxy/state_impl/base.py b/src/hydrilla/proxy/state_impl/base.py index 7437d52..f8291d8 100644 --- a/src/hydrilla/proxy/state_impl/base.py +++ b/src/hydrilla/proxy/state_impl/base.py @@ -210,15 +210,15 @@ class HaketiloStateWithFields(st.HaketiloState): best_priority = policy.priority best_policy = policy except Exception as e: - return policies.ErrorBlockPolicy(error=e) + return policies.ErrorBlockPolicy(self.settings, error=e) if best_policy is not None: return best_policy - if self.get_settings().default_allow_scripts: - return policies.FallbackAllowPolicy() + if self.settings.default_allow_scripts: + return policies.FallbackAllowPolicy(self.settings) else: - return policies.FallbackBlockPolicy() + return policies.FallbackBlockPolicy(self.settings) @abstractmethod def import_items(self, malcontent_path: Path, repo_id: int = 1) -> None: diff --git a/src/hydrilla/proxy/state_impl/concrete_state.py b/src/hydrilla/proxy/state_impl/concrete_state.py index c28e360..2dd8810 100644 --- a/src/hydrilla/proxy/state_impl/concrete_state.py +++ b/src/hydrilla/proxy/state_impl/concrete_state.py @@ -113,11 +113,20 @@ def load_settings(cursor: sqlite3.Cursor) -> st.HaketiloGlobalSettings: (default_allow_scripts, advanced_user, repo_refresh_seconds, mapping_use_mode), = cursor.fetchall() + default_popup_settings = st.PopupSettings( + keyboard_trigger = True, + style = st.PopupStyle.TAB + ) + return st.HaketiloGlobalSettings( default_allow_scripts = default_allow_scripts, advanced_user = advanced_user, repo_refresh_seconds = repo_refresh_seconds, - mapping_use_mode = st.MappingUseMode(mapping_use_mode) + mapping_use_mode = st.MappingUseMode(mapping_use_mode), + + default_popup_jsallowed = default_popup_settings, + default_popup_jsblocked = default_popup_settings, + default_popup_payloadon = default_popup_settings ) @dc.dataclass -- cgit v1.2.3