From 36b930cc8db1018914bea8a86f99fd1e757e2e45 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 11 Dec 2018 01:39:09 +0000 Subject: [PATCH 1/5] Uuuh those were typo ... --- src/js/yunohost/controllers/apps.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index c8fd2cc4..397901be 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -41,13 +41,14 @@ } function combineColors(stateColor, levelColor, installable) { - if (stateColor === "dangers" || levelColor === "danger") { + if (stateColor === "danger" || levelColor === "danger") { return 'danger'; } - if (stateColor === "warnings" || levelColor === "warnings" || levelColor === "default") { + else if (stateColor === "warning" || levelColor === "warning" || levelColor === "default") { return 'warning'; } - else { + else + { return 'success'; } } From bddb5021d45b68b8895e4611e67ba8f89a6f4788 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 11 Dec 2018 01:40:11 +0000 Subject: [PATCH 2/5] Apps with level >= 3 should be good quality ? --- src/js/yunohost/controllers/apps.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index 397901be..32536595 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -18,10 +18,10 @@ }); function levelToColor(level) { - if (level > 6) { + if (level >= 3) { return 'success'; } - else if (level >= 2) { + else if (level >= 1) { return 'warning'; } else if (isNaN(level)) { From c64d8ec7acd72025620f60ea26e43f54dbf6353d Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 11 Dec 2018 15:22:12 +0000 Subject: [PATCH 3/5] Ask confirmation when installing app with low level or experimental apps --- src/js/yunohost/controllers/apps.js | 35 ++++++++++++++++++++++++----- src/locales/en.json | 2 ++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index 32536595..08e81894 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -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 + ); + } }); }); diff --git a/src/locales/en.json b/src/locales/en.json index 734082d7..ef36ae42 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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 ?", From b329e8d39a66900aad27e6f641bbcc1dd3482bea Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 11 Dec 2018 15:32:13 +0000 Subject: [PATCH 4/5] Increase spookiness of warning when installing from curstom url --- src/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/en.json b/src/locales/en.json index ef36ae42..2c3b9126 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -75,7 +75,7 @@ "confirm_delete": "Are you sure you want to delete %s ?", "confirm_firewall_open": "Are you sure you want to open port %s? (protocol: %s, connection: %s)", "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_custom_app": "WARNING ! Installing 3rd party applications may compromise the integrity and security of your system. You should probably NOT install it unless you know what you are doing. Are you willing to take that 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 ?", From f749e8471db8c19cb7a2cd64809aaaef27012a30 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 11 Dec 2018 15:36:58 +0000 Subject: [PATCH 5/5] Moar spookyness --- src/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/en.json b/src/locales/en.json index 2c3b9126..5bf5999b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -78,7 +78,7 @@ "confirm_install_custom_app": "WARNING ! Installing 3rd party applications may compromise the integrity and security of your system. You should probably NOT install it unless you know what you are doing. Are you willing to take that 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_install_app_danger": "WARNING ! This application is still experimental (if not explicitly not working) and it 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 ?",