diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-10-21 21:42:56 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-10-21 21:42:56 +0200 |
commit | fe43bd552aaacd649b0e00afada01d07ad8dae9a (patch) | |
tree | 6244f66250706ec0d4a7dae23e270aefc97b02dd /src/hydrilla/proxy/state_impl | |
parent | d4895218cf8a3a16b74f42c530d78106062cf95b (diff) | |
download | haketilo-hydrilla-fe43bd552aaacd649b0e00afada01d07ad8dae9a.tar.gz haketilo-hydrilla-fe43bd552aaacd649b0e00afada01d07ad8dae9a.zip |
[proxy] facilitate injecting non-payload script to all pages
Diffstat (limited to 'src/hydrilla/proxy/state_impl')
-rw-r--r-- | src/hydrilla/proxy/state_impl/base.py | 8 | ||||
-rw-r--r-- | src/hydrilla/proxy/state_impl/concrete_state.py | 11 |
2 files changed, 14 insertions, 5 deletions
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 |