Ask confirmation when installing app with low level or experimental apps

This commit is contained in:
Alexandre Aubin 2018-12-11 15:22:12 +00:00
parent bddb5021d4
commit c64d8ec7ac
2 changed files with 32 additions and 5 deletions

View file

@ -492,11 +492,36 @@
// App installation form
app.get('#/apps/install/:app', function (c) {
c.api('/apps?raw', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
c.appInstallForm(
c.params['app'],
data[c.params['app']].manifest,
c.params
);
var state_color = stateToColor(data[c.params['app']]['state']);
var level_color = levelToColor(parseInt(data[c.params['app']]['level']));
var is_safe_for_install_color = combineColors(state_color, level_color);
if ((is_safe_for_install_color === "warning") || (is_safe_for_install_color === "danger"))
{
c.confirm(
y18n.t("applications"),
y18n.t("confirm_install_app_"+is_safe_for_install_color),
function(){
c.appInstallForm(
c.params['app'],
data[c.params['app']].manifest,
c.params
);
},
function(){
$('div.loader').remove();
c.redirect('#/apps/install');
}
);
}
else
{
c.appInstallForm(
c.params['app'],
data[c.params['app']].manifest,
c.params
);
}
});
});

View file

@ -77,6 +77,8 @@
"confirm_firewall_close": "Are you sure you want to close port %s? (protocol: %s, connection: %s)",
"confirm_install_custom_app": "Installing 3rd party applications may compromise the security of your system. Use at your own risk.",
"confirm_install_domain_root": "You will not be able to install any other app on %s. Continue ?",
"confirm_install_app_warning": "Warning : this application may work but is not well-integrated in YunoHost. Some features such as single sign-on and backup/restore might not be available.",
"confirm_install_app_danger": "WARNING ! This application is still experimental and is likely to break your system ! You should probably NOT install it unless you know what you are doing. Are you willing to take that risk ?",
"confirm_migrations_skip": "Skipping migrations is not recommended. Are you sure you want to do that?",
"confirm_postinstall": "You are about to launch the post-installation process on the domain %s. It may take a few minutes, *do not interrupt the operation*.",
"confirm_restore": "Are you sure you want to restore %s ?",