mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
app: add notifications helpers
This commit is contained in:
parent
ea3826fb8d
commit
cdcd967eb1
2 changed files with 24 additions and 0 deletions
|
@ -166,6 +166,7 @@
|
|||
"confirm_app_install_thirdparty": "DANGER! This app is not part of YunoHost's app catalog. Installing third-party apps may compromise the integrity and security of your system. You should probably NOT install it unless you know what you are doing. NO SUPPORT will be provided if this app doesn't work or breaks your system... If you are willing to take that risk anyway, type '{answers}'",
|
||||
"confirm_app_install_warning": "Warning: This app may work, but is not well-integrated into YunoHost. Some features such as single sign-on and backup/restore might not be available. Install anyway? [{answers}] ",
|
||||
"confirm_app_insufficient_ram": "DANGER! This app requires {required} RAM to install/upgrade but only {current} is available right now. Even if this app could run, its installation/upgrade process requires a large amount of RAM so your server may freeze and fail miserably. If you are willing to take that risk anyway, type '{answers}'",
|
||||
"confirm_notifications_read": "WARNING: You should check the app notifications above before continuing, there might be important stuff to know. [{answers}]",
|
||||
"custom_app_url_required": "You must provide a URL to upgrade your custom app {app}",
|
||||
"danger": "Danger:",
|
||||
"diagnosis_apps_allgood": "All installed apps respect basic packaging practices",
|
||||
|
|
23
src/app.py
23
src/app.py
|
@ -2799,6 +2799,29 @@ def _assert_system_is_sane_for_app(manifest, when):
|
|||
raise YunohostError("this_action_broke_dpkg")
|
||||
|
||||
|
||||
def _filter_and_hydrate_notifications(notifications, current_version=None, data={}):
|
||||
return {
|
||||
# Should we render the markdown maybe? idk
|
||||
name: _hydrate_app_template(_value_for_locale(content_per_lang), data)
|
||||
for name, content_per_lang in notifications.items()
|
||||
if current_version is None
|
||||
or name == "main"
|
||||
or version.parse(name) > current_version
|
||||
}
|
||||
|
||||
|
||||
def _display_notifications(notifications, force=False):
|
||||
if not notifications:
|
||||
return
|
||||
|
||||
for name, content in notifications.items():
|
||||
print(f"========== {name}")
|
||||
print(content)
|
||||
print("==========")
|
||||
|
||||
_ask_confirmation("confirm_notifications_read", kind="simple", force=force)
|
||||
|
||||
|
||||
# FIXME: move this to Moulinette
|
||||
def _ask_confirmation(
|
||||
question: str,
|
||||
|
|
Loading…
Add table
Reference in a new issue