diff --git a/check_process b/check_process index 6efab9e..1c21f46 100644 --- a/check_process +++ b/check_process @@ -4,18 +4,16 @@ domain="domain.tld" (DOMAIN) path="/path" (PATH) language="fr" - disablecacheck=1 ; pre-install sudo yunohost app fetchlist - sudo yunohost domain add --verbose baikaldomain.tld --admin-password $PASSWORD + sudo yunohost domain add baikaldomain.tld --admin-password $PASSWORD sudo yunohost app install baikal -a "domain=baikaldomain.tld&path=/baikal&password=admin" ; Checks pkg_linter=1 setup_sub_dir=1 setup_root=0 setup_nourl=0 -# Private test only should be fixed in package check before. -# setup_private=1 + setup_private=1 setup_public=0 upgrade=1 backup_restore=1 diff --git a/conf/settings.php b/conf/settings.php index ac70cb2..0dbbe83 100644 --- a/conf/settings.php +++ b/conf/settings.php @@ -40,7 +40,7 @@ $app['caldav.baseurl'] = '{CALDAV_BASEURL}'; $app['caldav.authmethod'] = 'basic'; // Do not verify SSL certificate, it is self signed -$app['caldav.certificate.verify'] = __CACHECK__; +$app['caldav.certificate.verify'] = false; // Whether to show public CalDAV urls $app['caldav.publicurls'] = true; diff --git a/manifest.json b/manifest.json index 814e55b..27c7197 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ }, "multi_instance": false, "requirements": { - "yunohost": ">= 2.7.0" + "yunohost": ">= 3.0.0" }, "services": [ "nginx", @@ -53,14 +53,6 @@ "de", "en", "es", "fr", "it", "nl" ], "default": "en" - }, - { - "name": "disablecacheck", - "ask": { - "en": "Disable certificate checks? (if not using a valid certificate)" - }, - "type": "boolean", - "default": false } ] } diff --git a/scripts/install b/scripts/install index 829758c..2a74f87 100644 --- a/scripts/install +++ b/scripts/install @@ -23,7 +23,6 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH language=$YNH_APP_ARG_LANGUAGE -disablecacheck=$YNH_APP_ARG_DISABLECACHECK # Set and store language language=${LANGUAGES[$language]} @@ -75,7 +74,6 @@ fi ynh_app_setting_set "$app" language "$language" ynh_app_setting_set "$app" path "$path_url" ynh_app_setting_set "$app" domain "$domain" -ynh_app_setting_set "$app" disablecacheck "$disablecacheck" ynh_app_setting_set "$app" final_path "$final_path" #================================================= @@ -151,12 +149,6 @@ ynh_replace_string "{LANGUAGE}" "${language}" "$conf_path" ynh_replace_string "{CALDAV_BASEURL}" "${caldav_url}${caldav_baseurl}" "$conf_path" ynh_replace_string "{CALDAV_DOMAIN}" "${caldav_domain}" "$conf_path" -if [ "$disablecacheck" -eq 0 ]; then - ynh_replace_string "__CACHECK__" "true" "$conf_path" -else - ynh_replace_string "__CACHECK__" "false" "$conf_path" -fi - #================================================= # STORE THE CHECKSUM OF THE CONFIG FILE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b8f016e..69213ca 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,7 +24,6 @@ path_url=$(ynh_app_setting_get "$app" path) dbpass=$(ynh_app_setting_get "$app" mysqlpwd) encryptkey=$(ynh_app_setting_get "$app" encryptkey) language=$(ynh_app_setting_get "$app" language) -disablecacheck=$(ynh_app_setting_get "$app" disablecacheck) LOGDIR=/var/log/$app @@ -59,12 +58,6 @@ if [ -z "$db_name" ]; then ynh_app_setting_set "$app" db_name "$db_name" fi -# If disablecacheck doesn't exist, create it -if [ -z "$disablecacheck" ]; then - disablecacheck=0 - ynh_app_setting_set "$app" disablecacheck "$disablecacheck" -fi - # If final_path doesn't exist, create it if [ -z "$final_path" ]; then final_path=/var/www/$app @@ -170,12 +163,6 @@ ynh_replace_string "{LANGUAGE}" "${language}" "$conf_path" ynh_replace_string "{CALDAV_BASEURL}" "${caldav_url}${caldav_baseurl}" "$conf_path" ynh_replace_string "{CALDAV_DOMAIN}" "${caldav_domain}" "$conf_path" -if [ "$disablecacheck" -eq 0 ]; then - ynh_replace_string "__CACHECK__" "true" "$conf_path" -else - ynh_replace_string "__CACHECK__" "false" "$conf_path" -fi - #================================================= # STORE THE CHECKSUM OF THE CONFIG FILE #================================================= diff --git a/sources/patches/app-00-add-http-auth.patch b/sources/patches/app-00-add-http-auth.patch new file mode 100644 index 0000000..abd4452 --- /dev/null +++ b/sources/patches/app-00-add-http-auth.patch @@ -0,0 +1,53 @@ +--- a/web/app/controllers.php ++++ b/web/app/controllers.php +@@ -58,14 +58,20 @@ $controllers->before(function(Request $request, Silex\Application $app) { + // processing the request + if ($app['session']->has('username')) { + $username = $app['session']->get('username'); +- $preferences = $app['preferences.repository']->userPreferences($username); +- $app['user.preferences'] = $preferences; +- $app['user.timezone'] = $preferences->get('timezone'); +- +- // Set application language +- $request->setLocale($preferences->get('language')); +- $app['translator']->setLocale($preferences->get('language')); +- return; ++ // Clear user session if HTTP authentication changed ++ if (isset($_SERVER['PHP_AUTH_USER']) ++ && $username != $_SERVER['PHP_AUTH_USER']) { ++ $app['session']->clear(); ++ } else { ++ $preferences = $app['preferences.repository']->userPreferences($username); ++ $app['user.preferences'] = $preferences; ++ $app['user.timezone'] = $preferences->get('timezone'); ++ ++ // Set application language ++ $request->setLocale($preferences->get('language')); ++ $app['translator']->setLocale($preferences->get('language')); ++ return; ++ } + } + + if ($request->isXmlHttpRequest()) { +diff --git a/web/src/Controller/Authentication.php b/web/src/Controller/Authentication.php +index deebb751..134cc9a8 100644 +--- a/web/src/Controller/Authentication.php ++++ b/web/src/Controller/Authentication.php +@@ -34,9 +34,14 @@ class Authentication + $success = false; + $template_vars = []; + +- if ($request->isMethod('POST')) { +- $user = $request->request->get('user'); +- $password = $request->request->get('password'); ++ if ($request->isMethod('POST') || isset($_SERVER['PHP_AUTH_USER'])) { ++ if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { ++ $user = $_SERVER['PHP_AUTH_USER']; ++ $password = $_SERVER['PHP_AUTH_PW']; ++ } else { ++ $user = $request->request->get('user'); ++ $password = $request->request->get('password'); ++ } + + if (empty($user) || empty($password)) { + $template_vars['error'] = $app['translator']->trans('messages.error_empty_fields');