diff options
5 files changed, 94 insertions, 45 deletions
diff --git a/src/hydrilla/locales/en_US/LC_MESSAGES/messages.po b/src/hydrilla/locales/en_US/LC_MESSAGES/messages.po index c336f2d..55cf02a 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-04 21:19+0200\n" +"POT-Creation-Date: 2022-10-07 15:39+0200\n" "PO-Revision-Date: 2022-02-12 00:00+0000\n" "Last-Translator: Wojtek Kosior <koszko@koszko.org>\n" "Language: en_US\n" @@ -137,7 +137,7 @@ msgstr "" msgid "err.item_info.filename_invalid_{}" msgstr "Item definition conatains an illegal path: {}" -#: src/hydrilla/item_infos.py:484 +#: src/hydrilla/item_infos.py:516 #, python-brace-format msgid "uuid_mismatch_{identifier}" msgstr "Two different uuids were specified for item '{identifier}'." @@ -184,24 +184,24 @@ msgstr "Data directory for Haketilo to use." msgid "cli_opt.haketilo.version" msgstr "Print version information and exit" -#: src/hydrilla/proxy/addon.py:111 +#: src/hydrilla/proxy/addon.py:123 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:166 +#: src/hydrilla/proxy/addon.py:173 msgid "err.proxy.unknown_error_{}_try_again" msgstr "" "Haketilo experienced an error. Try again.\n" "\n" "{}" -#: src/hydrilla/proxy/policies/payload_resource.py:89 +#: src/hydrilla/proxy/policies/payload_resource.py:264 msgid "api.file_not_found" msgstr "Requested file could not be found." -#: src/hydrilla/proxy/policies/payload_resource.py:125 +#: src/hydrilla/proxy/policies/payload_resource.py:387 msgid "api.resource_not_enabled_for_access" msgstr "Requested resource is not enabled for access." @@ -471,51 +471,63 @@ msgstr "This item is required and cannot be uninstalled." msgid "web_ui.err.repo_communication_error" msgstr "Couldn't communicate with repository." -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:82 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:81 +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:86 msgid "web_ui.items.single_version.identifier_label" msgstr "Identifier" -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:90 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:94 msgid "web_ui.items.single_version.version_label" msgstr "Version" -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:99 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:103 msgid "web_ui.items.single_version.uuid_label" msgstr "UUID" -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:109 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:113 msgid "web_ui.items.single_version.description_label" msgstr "Description" -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:118 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:122 msgid "web_ui.items.single_version.licenses_label" msgstr "License and copyright files" -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:124 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:128 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:131 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:135 msgid "web_ui.items.single_version.required_mappings_label" msgstr "Required packages" -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:158 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:155 +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:165 +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:182 msgid "web_ui.items.single_version.install_uninstall_label" msgstr "Installation status" -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:165 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:189 msgid "web_ui.items.single_version.retry_install_button" msgstr "Retry installation" -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:169 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:193 msgid "web_ui.items.single_version.leave_uninstalled_button" msgstr "Leave uninstalled" -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:173 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:197 msgid "web_ui.items.single_version.install_button" msgstr "Install" -#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:175 +#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:199 msgid "web_ui.items.single_version.uninstall_button" msgstr "Uninstall" @@ -646,105 +658,105 @@ msgstr "Other available versions of the package" msgid "web_ui.items.single_version.package.payloads_label" msgstr "Payloads" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:91 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:101 msgid "web_ui.items.single_version.package.no_payloads" msgstr "This package has no payloads." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:97 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:107 msgid "web_ui.items.single_version.package.enabled_label" msgstr "Usage status" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:103 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:117 msgid "web_ui.items.single_version.unenable_button" msgstr "Forget" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:104 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:118 msgid "web_ui.items.single_version.disable_button" msgstr "Disable" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:105 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:119 msgid "web_ui.items.single_version.enable_button" msgstr "Enable" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:114 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:128 msgid "web_ui.items.single_version.package.item_not_activated" msgstr "This package is not enabled. This version won't be used." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:116 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:130 msgid "web_ui.items.single_version.package.item_will_be_asked_about" msgstr "" "This package is not currently enabled. You will be asked whether to " "enable this version of it when you visit a website where it can be used." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:119 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:133 msgid "web_ui.items.single_version.package.item_auto_activated" msgstr "" "This package version has not been explicitly enabled but it is going to " "be used automatically." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:123 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:137 msgid "web_ui.items.single_version.package.item_disabled" msgstr "All versions of the package have been explicitly disabled by the user." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:127 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:141 msgid "web_ui.items.single_version.package.item_enabled" msgstr "The package has been enabled by the user." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:142 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:156 msgid "web_ui.items.single_version.package.pinning_label" msgstr "Enabled package pinning" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:148 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:168 msgid "web_ui.items.single_version.unpin_button" msgstr "Unpin" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:153 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:173 msgid "web_ui.items.single_version.not_pinned" msgstr "The package is not pinned to any version." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:158 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:178 msgid "web_ui.items.single_version.pinned_repo_local" msgstr "The package is pinned to only use locally installed versions." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:161 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:181 msgid "web_ui.items.single_version.pinned_repo_{}" msgstr "The package is pinned to only use versions from repository '{}'." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:172 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:192 msgid "web_ui.items.single_version.pin_local_repo_button" msgstr "Pin to local packages" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:177 -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:190 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:197 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:210 msgid "web_ui.items.single_version.pin_repo_button" msgstr "Pin to repository" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:184 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:204 msgid "web_ui.items.single_version.repin_repo_button" msgstr "Pin to this repository" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:198 -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:209 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:218 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:229 msgid "web_ui.items.single_version.pin_ver_button" msgstr "Pin to this version" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:201 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:221 msgid "web_ui.items.single_version.pinned_ver" msgstr "The package is pinned to this version." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:204 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:224 msgid "web_ui.items.single_version.repin_ver_button" msgstr "Pin to this version" -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:206 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:226 msgid "web_ui.items.single_version.pinned_other_ver" msgstr "The package is pinned to a different version." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:214 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:234 msgid "web_ui.items.single_version.active_ver_is_this_one" msgstr "This is the currently active version." -#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:218 +#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:238 msgid "web_ui.items.single_version.active_ver_is_{}" msgstr "Currently active version is '{}'." diff --git a/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py b/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py index 864d463..4cc4e7a 100644 --- a/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py +++ b/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py @@ -77,7 +77,8 @@ def _get_infos_of_type(cursor: sqlite3.Cursor, info_type: t.Type[AnyInfoVar],) \ for item_version_id, definition, repo_name, repo_iteration \ in cursor.fetchall(): info = info_type.load(definition, repo_name, repo_iteration) - result[item_version_id] = info + if info.compatible: + result[item_version_id] = info return result diff --git a/src/hydrilla/proxy/web_ui/root.py b/src/hydrilla/proxy/web_ui/root.py index 402c5ae..3676307 100644 --- a/src/hydrilla/proxy/web_ui/root.py +++ b/src/hydrilla/proxy/web_ui/root.py @@ -42,6 +42,7 @@ import flask import werkzeug from ...translations import translation as make_translation +from ... import versions from ... import item_infos from .. import state as st from .. import http_messages @@ -97,6 +98,7 @@ class WebUIAppImpl(_app.WebUIApp): self.jinja_env.globals['ActiveStatus'] = st.ActiveStatus self.jinja_env.globals['ItemType'] = item_infos.ItemType self.jinja_env.globals['MappingUseMode'] = st.MappingUseMode + self.jinja_env.globals['versions'] = versions self.before_request(authenticate_by_referrer) 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 fe5f335..0d2ed57 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 @@ -77,6 +77,10 @@ code in a proprietary work, I am not going to enforce this in court. {{ error_note(_('web_ui.err.repo_communication_error')) }} {% endif %} + {% if not version_display_info.info.compatible %} + {{ error_note(_('web_ui.err.item_not_compatible')) }} + {% endif %} + {{ super() }} {{ label(_('web_ui.items.single_version.identifier_label')) }} @@ -147,6 +151,26 @@ code in a proprietary work, I am not going to enforce this in court. <div class="horizontal-separator"></div> {% endif %} + {% if version_display_info.info.min_haketilo_ver != versions.int_ver_min %} + {{ label(_('web_ui.items.single_version.min_haketilo_ver_label')) }} + + <p> + {{ versions.version_string(version_display_info.info.min_haketilo_ver) }} + </p> + + <div class="horizontal-separator"></div> + {% endif %} + + {% if version_display_info.info.max_haketilo_ver != versions.int_ver_max %} + {{ label(_('web_ui.items.single_version.max_haketilo_ver_label')) }} + + <p> + {{ versions.version_string(version_display_info.info.max_haketilo_ver) }} + </p> + + <div class="horizontal-separator"></div> + {% endif %} + {% block main_info_rest required %}{% endblock %} {% diff --git a/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja index 230168a..fa7c954 100644 --- a/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja @@ -110,6 +110,10 @@ code in a proprietary work, I am not going to enforce this in court. {% set unenable_but_classes = ['green-button'] %} {% set disable_but_classes = ['red-button'] %} + {% if not version_display_info.info.compatible %} + {% do enable_but_classes.append('disabled-button') %} + {% endif %} + {% set unenable_text = _('web_ui.items.single_version.unenable_button') %} {% set disable_text = _('web_ui.items.single_version.disable_button') %} {% set enable_text = _('web_ui.items.single_version.enable_button') %} @@ -155,6 +159,12 @@ code in a proprietary work, I am not going to enforce this in court. {% set pin_repo_but_classes = ['green-button'] %} {% set pin_ver_but_classes = ['green-button'] %} + {% if not version_display_info.info.compatible %} + {% do unpin_but_classes.append('disabled-button') %} + {% do pin_repo_but_classes.append('disabled-button') %} + {% do pin_ver_but_classes.append('disabled-button') %} + {% endif %} + {% set unpin_text = _('web_ui.items.single_version.unpin_button') %} <p> |