aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-10 16:45:41 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-10 16:45:41 +0200
commit28e2064c86cfb9f35312417192f5b1395b16917c (patch)
tree6c2846ab180b4d2ad6f4c1153d296c8b5c972ee0
parentb880bdc779b800ebde810279d1cf5b9e530000de (diff)
downloadhaketilo-hydrilla-28e2064c86cfb9f35312417192f5b1395b16917c.tar.gz
haketilo-hydrilla-28e2064c86cfb9f35312417192f5b1395b16917c.zip
[proxy] when web UI's home page is accessed through plain HTTP, show link to TLS certs page and tell the user to install mitmproxy cert
-rw-r--r--src/hydrilla/locales/en_US/LC_MESSAGES/messages.po151
-rw-r--r--src/hydrilla/proxy/web_ui/root.py2
-rw-r--r--src/hydrilla/proxy/web_ui/templates/base.html.jinja4
-rw-r--r--src/hydrilla/proxy/web_ui/templates/index.html.jinja16
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja8
5 files changed, 103 insertions, 78 deletions
diff --git a/src/hydrilla/locales/en_US/LC_MESSAGES/messages.po b/src/hydrilla/locales/en_US/LC_MESSAGES/messages.po
index aeff285..b311f8f 100644
--- a/src/hydrilla/locales/en_US/LC_MESSAGES/messages.po
+++ b/src/hydrilla/locales/en_US/LC_MESSAGES/messages.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: hydrilla 2.0\n"
"Report-Msgid-Bugs-To: koszko@koszko.org\n"
-"POT-Creation-Date: 2022-10-08 17:33+0200\n"
+"POT-Creation-Date: 2022-10-10 16:44+0200\n"
"PO-Revision-Date: 2022-02-12 00:00+0000\n"
"Last-Translator: Wojtek Kosior <koszko@koszko.org>\n"
"Language: en_US\n"
@@ -79,9 +79,9 @@ msgid "built_package_files_destination"
msgstr "Destination directory to write built package files to."
#: src/hydrilla/builder/build.py:500
-#: src/hydrilla/mitmproxy_launcher/launch.py:59
-#: src/hydrilla/server/serve.py:203 src/hydrilla/server/serve.py:221
-#: src/hydrilla/server/serve.py:261
+#: src/hydrilla/mitmproxy_launcher/launch.py:65
+#: src/hydrilla/server/serve.py:207 src/hydrilla/server/serve.py:225
+#: src/hydrilla/server/serve.py:265
#, python-format
msgid "%(prog)s_%(version)s_license"
msgstr ""
@@ -92,8 +92,8 @@ msgstr ""
"This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law."
-#: src/hydrilla/builder/build.py:501 src/hydrilla/server/serve.py:222
-#: src/hydrilla/server/serve.py:262
+#: src/hydrilla/builder/build.py:501 src/hydrilla/server/serve.py:226
+#: src/hydrilla/server/serve.py:266
msgid "version_printing"
msgstr "Print version information and exit."
@@ -164,7 +164,7 @@ msgstr "Not a valid JSON file."
msgid "no_schema_number_in_instance"
msgstr "JSON schema number is missing from a document."
-#: src/hydrilla/mitmproxy_launcher/launch.py:52
+#: src/hydrilla/mitmproxy_launcher/launch.py:58
msgid "cli_help.haketilo"
msgstr ""
"Run Haketilo proxy.\n"
@@ -172,25 +172,25 @@ msgstr ""
"This command starts Haketilo as a local HTTP proxy which a web browser "
"can then use."
-#: src/hydrilla/mitmproxy_launcher/launch.py:54
+#: src/hydrilla/mitmproxy_launcher/launch.py:60
msgid "cli_opt.haketilo.port"
msgstr "TCP port number the proxy should listen on (1-65535)."
-#: src/hydrilla/mitmproxy_launcher/launch.py:57
+#: src/hydrilla/mitmproxy_launcher/launch.py:63
msgid "cli_opt.haketilo.dir"
msgstr "Data directory for Haketilo to use."
-#: src/hydrilla/mitmproxy_launcher/launch.py:60
+#: src/hydrilla/mitmproxy_launcher/launch.py:66
msgid "cli_opt.haketilo.version"
msgstr "Print version information and exit"
-#: src/hydrilla/proxy/addon.py:123
+#: src/hydrilla/proxy/addon.py:128
msgid "haketilo_dir_already_configured"
msgstr ""
"Attempt was made to configure Haketilo Mitmproxy addon with data "
"directory path but it has already been configured."
-#: src/hydrilla/proxy/addon.py:173
+#: src/hydrilla/proxy/addon.py:183
msgid "err.proxy.unknown_error_{}_try_again"
msgstr ""
"Haketilo experienced an error. Try again.\n"
@@ -221,27 +221,27 @@ msgstr ""
msgid "web_ui.base.title.haketilo_proxy"
msgstr "Haketilo"
-#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:280
+#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:284
msgid "web_ui.base.nav.home"
msgstr "Home"
-#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:281
+#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:285
msgid "web_ui.base.nav.rules"
msgstr "Script blocking"
-#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:282
+#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:286
msgid "web_ui.base.nav.packages"
msgstr "Packages"
-#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:283
+#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:287
msgid "web_ui.base.nav.libraries"
msgstr "Libraries"
-#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:284
+#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:288
msgid "web_ui.base.nav.repos"
msgstr "Repositories"
-#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:285
+#: src/hydrilla/proxy/web_ui/templates/base.html.jinja:289
msgid "web_ui.base.nav.import"
msgstr "Import"
@@ -344,114 +344,131 @@ msgid "web_ui.home.heading.about_haketilo"
msgstr "About this tool"
#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:41
-msgid "web_ui.home.haketilo_is_blah_blah"
+msgid "web_ui.home.html.haketilo_is_blah_blah"
msgstr ""
"Haketilo is a tool that gives users more control over their web browsing."
" It can block unwanted JavaScript software on web pages as well as add "
"custom logic to them. Haketilo was orignally developed as a browser "
-"extension but has since been made into an HTTP proxy."
+"extension but has since been made into an HTTP proxy. It is built on top "
+"of the popular <a href=\"https://mitmproxy.org/\">mitmproxy</a>."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:47
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:48
+msgid "web_ui.home.heading.configuring_browser_for_haketilo"
+msgstr "Configuring the browser for Haketilo"
+
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:52
+msgid "web_ui.home.html.to_add_certs_do_xyz"
+msgstr ""
+"Haketilo proxy works by modifying data exchanged by your browser and web "
+"servers. This works without problems for http:// URLs. For https:// URLs,"
+" however, the transmitted data is protected from modification using "
+"cryptography. For your browser to trust the data modified by Haketilo, it"
+" needs to be told to recognize proxy's cryptographic certificate. If you "
+"haven't already, download the right certificate from <a "
+"href=\"http://mitm.it\">this page</a> and add it to your operating "
+"system, browser or both."
+
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:59
msgid "web_ui.home.heading.options"
msgstr "Global options"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:50
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:62
msgid "web_ui.home.mapping_usage_mode_label"
msgstr "Package usage mode"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:59
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:71
msgid "web_ui.home.packages_are_used_when_enabled"
msgstr ""
"Hektilo is currently configured to only use packages that were explicitly"
" enabled."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:62
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:74
msgid "web_ui.home.user_gets_asked_whether_to_enable_package"
msgstr ""
"Hektilo is currently configured to ask whenever a package is found that "
"could be used for the current site."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:66
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:78
msgid "web_ui.home.packages_are_used_automatically"
msgstr ""
"Hektilo is currently configured to automatically use packages that are "
"available for the current site."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:73
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:85
msgid "web_ui.home.use_enabled_button"
msgstr "Use when enabled"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:76
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:88
msgid "web_ui.home.use_question_button"
msgstr "Ask whether to use"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:79
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:91
msgid "web_ui.home.use_auto_button"
msgstr "Use automatically"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:86
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:98
msgid "web_ui.home.script_blocking_mode_label"
msgstr "Default scripts treatment"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:94
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:106
msgid "web_ui.home.scripts_are_allowed_by_default"
msgstr ""
"By default Haketilo currently allows JavaScript sent by websites to the "
"browser to execute."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:97
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:109
msgid "web_ui.home.scripts_are_blocked_by_default"
msgstr ""
"By default Haketilo currently blocks JavaScript sent by websites to the "
"browser from executing."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:101
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:113
msgid "web_ui.home.allow_scripts_button"
msgstr "Allow scripts"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:102
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:114
msgid "web_ui.home.block_scripts_button"
msgstr "Block scripts"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:113
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:125
msgid "web_ui.home.advanced_features_label"
msgstr "Advanced features"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:121
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:133
msgid "web_ui.home.user_is_advanced_user"
msgstr "Interface features for advanced users are currently enabled."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:124
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:136
msgid "web_ui.home.user_is_simple_user"
msgstr "Interface features for advanced users are currently disabled."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:131
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:143
msgid "web_ui.home.user_make_advanced_button"
msgstr "Enable"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:134
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:146
msgid "web_ui.home.user_make_simple_button"
msgstr "Disable"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:142
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:154
msgid "web_ui.home.orphans_label"
msgstr "Orphans"
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:148
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:160
msgid "web_ui.home.orphans_to_delete_{mappings}"
msgstr "Haketilo is holding some unused packages that can be removed ({mappings})."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:152
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:164
msgid "web_ui.home.orphans_to_delete_exist"
msgstr "Haketilo is holding some unused libraries that can be removed."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:156
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:168
msgid "web_ui.home.orphans_to_delete_{mappings}_{resources}"
msgstr ""
"Haketilo is holding some unused items that can be removed (packages: "
"{mappings}; libraries: {resources})."
-#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:165
+#: src/hydrilla/proxy/web_ui/templates/index.html.jinja:177
msgid "web_ui.home.prune_orphans_button"
msgstr "Prune orphans"
@@ -471,63 +488,63 @@ msgstr "Item constraints prevent the action from succeeding."
msgid "web_ui.err.repo_communication_error"
msgstr "Couldn't communicate with repository."
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:69
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:61
msgid "web_ui.err.item_not_compatible"
msgstr "This item is not compatible with current Haketilo version."
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:76
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:68
msgid "web_ui.items.single_version.identifier_label"
msgstr "Identifier"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:84
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:76
msgid "web_ui.items.single_version.version_label"
msgstr "Version"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:93
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:85
msgid "web_ui.items.single_version.uuid_label"
msgstr "UUID"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:103
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:95
msgid "web_ui.items.single_version.description_label"
msgstr "Description"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:112
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:104
msgid "web_ui.items.single_version.licenses_label"
msgstr "License and copyright files"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:118
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:110
msgid "web_ui.items.single_version.no_license_files"
msgstr "There are no designated files with legal information."
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:125
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:117
msgid "web_ui.items.single_version.required_mappings_label"
msgstr "Required packages"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:145
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:137
msgid "web_ui.items.single_version.min_haketilo_ver_label"
msgstr "Minimum compatible Haketilo version"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:155
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:147
msgid "web_ui.items.single_version.max_haketilo_ver_label"
msgstr "Maximum compatible Haketilo version"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:172
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:164
msgid "web_ui.items.single_version.install_uninstall_label"
msgstr "Installation status"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:179
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:171
msgid "web_ui.items.single_version.retry_install_button"
msgstr "Retry installation"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:183
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:175
msgid "web_ui.items.single_version.leave_uninstalled_button"
msgstr "Leave uninstalled"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:187
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:179
msgid "web_ui.items.single_version.install_button"
msgstr "Install"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:189
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:181
msgid "web_ui.items.single_version.uninstall_button"
msgstr "Uninstall"
@@ -685,11 +702,11 @@ msgstr "The package is pinned to only use locally installed versions."
msgid "web_ui.items.single.package.pinned_repo_{}"
msgstr "The package is pinned to only use versions from repository '{}'."
-#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:110
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:111
msgid "web_ui.items.single.package.pinned_ver"
msgstr "The package is pinned to a specific version."
-#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:125
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:126
msgid "web_ui.items.single.package.version_list_heading"
msgstr "Available versions"
@@ -1171,7 +1188,7 @@ msgstr ""
"Hydrilla was told to connect to a parent Hydrilla server but this feature"
" is not yet implemented."
-#: src/hydrilla/server/serve.py:209
+#: src/hydrilla/server/serve.py:213
msgid "serve_hydrilla_packages_explain_wsgi_considerations"
msgstr ""
"Serve Hydrilla packages.\n"
@@ -1180,36 +1197,36 @@ msgstr ""
"Hydrilla instance. For better performance, consider deployment using "
"WSGI."
-#: src/hydrilla/server/serve.py:212
+#: src/hydrilla/server/serve.py:216
msgid "directory_to_serve_from_overrides_config"
msgstr ""
"Directory to serve files from. Overrides value from the config file (if "
"any)."
-#: src/hydrilla/server/serve.py:214
+#: src/hydrilla/server/serve.py:218
msgid "project_url_to_display_overrides_config"
msgstr ""
"Project url to display on generated HTML pages. Overrides value from the "
"config file (if any)."
-#: src/hydrilla/server/serve.py:216
+#: src/hydrilla/server/serve.py:220
msgid "tcp_port_to_listen_on_overrides_config"
msgstr ""
"TCP port number to listen on (0-65535). Overrides value from the config "
"file (if any)."
-#: src/hydrilla/server/serve.py:219
+#: src/hydrilla/server/serve.py:223
msgid "path_to_config_file_explain_default"
msgstr ""
"Path to Hydrilla server configuration file (optional, by default Hydrilla"
" loads its own config file, which in turn tries to load "
"/etc/hydrilla/config.json)."
-#: src/hydrilla/server/serve.py:251
+#: src/hydrilla/server/serve.py:255
msgid "config_option_{}_not_supplied"
msgstr "Missing configuration option '{}'."
-#: src/hydrilla/server/serve.py:255
+#: src/hydrilla/server/serve.py:259
msgid "serve_hydrilla_packages_wsgi_help"
msgstr ""
"Serve Hydrilla packages.\n"
diff --git a/src/hydrilla/proxy/web_ui/root.py b/src/hydrilla/proxy/web_ui/root.py
index 3676307..14b44ff 100644
--- a/src/hydrilla/proxy/web_ui/root.py
+++ b/src/hydrilla/proxy/web_ui/root.py
@@ -167,7 +167,7 @@ def process_request(
flask_response = app.test_client().open(
path = path,
- base_url = 'https://hkt.mitm.it',
+ base_url = f'{request_info.url.scheme}://hkt.mitm.it',
method = request_info.method,
query_string = request_info.url.query,
headers = [*request_info.headers.items()],
diff --git a/src/hydrilla/proxy/web_ui/templates/base.html.jinja b/src/hydrilla/proxy/web_ui/templates/base.html.jinja
index 266e448..e4760bf 100644
--- a/src/hydrilla/proxy/web_ui/templates/base.html.jinja
+++ b/src/hydrilla/proxy/web_ui/templates/base.html.jinja
@@ -118,6 +118,10 @@ code in a proprietary work, I am not going to enforce this in court.
color: inherit;
}
+ .has-colored-links a {
+ color: #557b8e;
+ }
+
.small-print {
font-size: 80%;
color: #555;
diff --git a/src/hydrilla/proxy/web_ui/templates/index.html.jinja b/src/hydrilla/proxy/web_ui/templates/index.html.jinja
index f05cf4a..e42f5e9 100644
--- a/src/hydrilla/proxy/web_ui/templates/index.html.jinja
+++ b/src/hydrilla/proxy/web_ui/templates/index.html.jinja
@@ -37,12 +37,24 @@ code in a proprietary work, I am not going to enforce this in court.
{{ _('web_ui.home.heading.about_haketilo') }}
</h4>
- <p>
- {{ _('web_ui.home.haketilo_is_blah_blah') }}
+ <p class="has-colored-links">
+ {{ _('web_ui.home.html.haketilo_is_blah_blah')|safe }}
</p>
<div class="horizontal-separator"></div>
+ {% if request.url.startswith('http://') %}
+ <h4>
+ {{ _('web_ui.home.heading.configuring_browser_for_haketilo') }}
+ </h4>
+
+ <p class="has-colored-links">
+ {{ _('web_ui.home.html.to_add_certs_do_xyz')|safe }}
+ </p>
+
+ <div class="horizontal-separator"></div>
+ {% endif %}
+
<h4>
{{ _('web_ui.home.heading.options') }}
</h4>
diff --git a/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja
index 3d1a2cb..4b6cdee 100644
--- a/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja
+++ b/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja
@@ -56,14 +56,6 @@ code in a proprietary work, I am not going to enforce this in court.
</ul>
{% endmacro %}
-{% block style %}
- {{ super() }}
-
- .has-colored-links a {
- color: #557b8e;
- }
-{% endblock %}
-
{% block top_errors %}
{% if not version_display_info.info.compatible %}
{{ error_note(_('web_ui.err.item_not_compatible')) }}