From 2fe1f8ca36bec63204abe4311164227e850a548d Mon Sep 17 00:00:00 2001 From: Limezy Date: Mon, 22 Jan 2024 23:35:41 +0630 Subject: [PATCH 01/12] Update to 8.0 --- conf/migrate_7.0.6.sql | 15 +++++++++++++++ manifest.toml | 6 +++--- scripts/upgrade | 18 ++++++++++++++---- sources/patches/app-01-mail.patch | 23 +++++++++++------------ 4 files changed, 43 insertions(+), 19 deletions(-) create mode 100644 conf/migrate_7.0.6.sql diff --git a/conf/migrate_7.0.6.sql b/conf/migrate_7.0.6.sql new file mode 100644 index 0000000..836fa4e --- /dev/null +++ b/conf/migrate_7.0.6.sql @@ -0,0 +1,15 @@ +ALTER TABLE `compte` +ADD `totp_etat` smallint(5) unsigned DEFAULT NULL; + +ALTER TABLE `compte` +ADD `totp_secret` varchar(255) DEFAULT NULL; + +CREATE TABLE `cle_valeur` ( + `cle` varchar(255) NOT NULL, + `valeur` bigint(20) unsigned DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + +INSERT INTO `cle_valeur` (`cle`, `valeur`) VALUES +('pub_visite_mensuel', 0), +('pub_visite_hebdo', 0), +('pub_visite_jour', 0); diff --git a/manifest.toml b/manifest.toml index a7d8eb0..3b0b21f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Moncycle" description.en = "Menstrual cycle follow-up for natural family planning" description.fr = "Suivi de cycle pour les méthodes naturelles de régulation de naissance" -version = "7.0~ynh6" +version = "8.0~ynh1" maintainers = ["Raoul de Limezy"] @@ -38,8 +38,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/jean-io/moncycle.app/archive/4ee55999138825fd2f309fa27a69bafe6f5a0c36.zip" - sha256 = "94c3010d12f9650ea87aecde046ef0ba4102308b566de94868adc76c69c22ccf" + url = "https://github.com/jean-io/moncycle.app/archive/a686e4f1769203ec66884a772c9d274ce3777274.zip" + sha256 = "60697bc442373b25c996eedb805c71c2b63a6cc7abdcef2e08f5f4257fecb005" [resources.system_user] diff --git a/scripts/upgrade b/scripts/upgrade index f938b44..01fb7dc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -44,12 +44,22 @@ pushd "$install_dir" ynh_script_progression --message="Checking if a database migration is needed" if ynh_compare_current_package_version --comparison le --version 7.0~ynh5 then - ynh_script_progression --message="Database migration required, migrating" - ynh_add_config --template="../conf/migrate_7.0.5.sql" --destination="$install_dir/migrate.sql" - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate.sql + ynh_script_progression --message="7.0.5 to 8.0 database migration required, migrating" + ynh_add_config --template="../conf/migrate_7.0.5.sql" --destination="$install_dir/migrate_7.0.5.sql" + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_7.0.5.sql + ynh_add_config --template="../conf/migrate_7.0.6.sql" --destination="$install_dir/migrate_7.0.6.sql" + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_7.0.6.sql else - ynh_script_progression --message="Database migration not required" + if ynh_compare_current_package_version --comparison eq --version 7.0~ynh6 + then + ynh_script_progression --message="7.0.6 to 8.0 database migration required, migrating" + ynh_add_config --template="../conf/migrate_7.0.6.sql" --destination="$install_dir/migrate_7.0.6.sql" + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_7.0.6.sql + else + ynh_script_progression --message="7.0.6 to 8.0 database migration not required" + fi fi + ynh_script_progression --message="Database migration not required" popd diff --git a/sources/patches/app-01-mail.patch b/sources/patches/app-01-mail.patch index 87b81ef..c8db56e 100644 --- a/sources/patches/app-01-mail.patch +++ b/sources/patches/app-01-mail.patch @@ -1,17 +1,16 @@ diff --git a/www_data/lib/mail.php b/www_data/lib/mail.php -index f153e3c..e56f1fd 100644 +index 363aeb7..343e33b 100644 --- a/www_data/lib/mail.php +++ b/www_data/lib/mail.php @@ -15,10 +15,10 @@ function mail_init(){ - $mail->isSMTP(); - $mail->Host = SMTP_HOST; -- $mail->SMTPAuth = true; - $mail->Username = SMTP_MAIL; - $mail->Password = SMTP_PASSWORD; -- $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; -+ $mail->SMTPAutoTLS = false; -+ $mail->SMTPSecure = false; - $mail->Port = SMTP_PORT; - $mail->CharSet = 'UTF-8'; - + $mail->isSMTP(); + $mail->Host = SMTP_HOST; +- $mail->SMTPAuth = true; + $mail->Username = SMTP_MAIL; + $mail->Password = SMTP_PASSWORD; +- $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; ++ $mail->SMTPAutoTLS = false; ++ $mail->SMTPSecure = false; + $mail->Port = SMTP_PORT; + $mail->CharSet = 'UTF-8'; From 8bb27ae078c680741be043316024da7de0f17bac Mon Sep 17 00:00:00 2001 From: Limezy Date: Mon, 29 Jan 2024 12:27:20 +0700 Subject: [PATCH 02/12] First try v9 --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 3b0b21f..36578ea 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Moncycle" description.en = "Menstrual cycle follow-up for natural family planning" description.fr = "Suivi de cycle pour les méthodes naturelles de régulation de naissance" -version = "8.0~ynh1" +version = "9.0~ynh1" maintainers = ["Raoul de Limezy"] @@ -38,8 +38,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/jean-io/moncycle.app/archive/a686e4f1769203ec66884a772c9d274ce3777274.zip" - sha256 = "60697bc442373b25c996eedb805c71c2b63a6cc7abdcef2e08f5f4257fecb005" + url = "https://github.com/jean-io/moncycle.app/archive/ee594d980925b1e868c6b23239e254c1c4bf7f52.zip" + sha256 = "7d4837723051f7338bff500931c30b57be7ef5ec7641c03000bd6e0be9b7b2c7" [resources.system_user] From 3f32aee1e02a5bc757c1c7d26de07d1e0b8006af Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 30 Jan 2024 00:36:03 +0700 Subject: [PATCH 03/12] Updates --- conf/nginx.conf | 9 +++------ manifest.toml | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index a48fa91..f49bd10 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -26,12 +26,9 @@ location __PATH__/ { } # Default indexes and catch-all - rewrite ^/(export|inscription|compte)$ /$1.php; - rewrite ^/(connexion)$ /$1.html; - rewrite ^/api/(deconnexion)$ /api/$1.php; - rewrite ^/img/(captcha)$ /img/$1.php; - index index.html index.php; - try_files $uri $uri.php $uri/index.php $uri/ $1?$args $1.php?$args; + rewrite ^/(connexion|compte)$ /$1.html; + index index.php index.html; + try_files $uri $uri/ $uri.php?$args; # Execute and serve PHP files location ~ [^/]\.php(/|$) { diff --git a/manifest.toml b/manifest.toml index 36578ea..9ccc470 100644 --- a/manifest.toml +++ b/manifest.toml @@ -49,7 +49,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server, php8.2-gd, php8.2-mysql, php8.2-mbstring" + packages = "mariadb-server, php8.2-gd, php8.2-mysql, php8.2-xml, php8.2-mbstring" [resources.database] type = "mysql" From 6aa128997a485aee6814b3fd78caabe62a3916ce Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 30 Jan 2024 00:41:20 +0700 Subject: [PATCH 04/12] nginx is definitely a pain in the *ss --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index f49bd10..0610eb0 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __INSTALL_DIR__/; + root __INSTALL_DIR__/; # Deny access to hidden files and directories location ~ ^/(.+/|)\.(?!well-known\/) { From 0a2c773a31cc666bfe217b0f6885891cbec12f81 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 30 Jan 2024 01:19:37 +0700 Subject: [PATCH 05/12] chart.js --- scripts/install | 3 ++- scripts/upgrade | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index c248549..e7f55b4 100755 --- a/scripts/install +++ b/scripts/install @@ -42,7 +42,8 @@ popd # worckaround while https://github.com/chartjs/Chart.js/issues/11478 is not fixed ynh_exec_warn_less mkdir "$install_dir/vendor/chartjs" -ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.js https://cdn.jsdelivr.net/npm/chart.js +ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.js https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.js +ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.umd.js.map https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.js.map #================================================= # PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 01fb7dc..0bc5157 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -74,7 +74,8 @@ popd # worckaround while https://github.com/chartjs/Chart.js/issues/11478 is not fixed ynh_exec_warn_less mkdir "$install_dir/vendor/chartjs" -ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.js https://cdn.jsdelivr.net/npm/chart.js +ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.js https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.js +ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.umd.js.map https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.js.map #================================================= # PHP-FPM CONFIGURATION From 979242a3597d8eb2eb75db00e526ed4c669817ef Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 30 Jan 2024 01:24:46 +0700 Subject: [PATCH 06/12] Update upgrade --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0bc5157..813267f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -50,16 +50,16 @@ pushd "$install_dir" ynh_add_config --template="../conf/migrate_7.0.6.sql" --destination="$install_dir/migrate_7.0.6.sql" ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_7.0.6.sql else - if ynh_compare_current_package_version --comparison eq --version 7.0~ynh6 + if ynh_compare_current_package_version --comparison le --version 7.0~ynh6 then ynh_script_progression --message="7.0.6 to 8.0 database migration required, migrating" ynh_add_config --template="../conf/migrate_7.0.6.sql" --destination="$install_dir/migrate_7.0.6.sql" ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate_7.0.6.sql else - ynh_script_progression --message="7.0.6 to 8.0 database migration not required" + ynh_script_progression --message="7.0.6 to 8.0 database migration not required since package > 7.0.6" fi fi - ynh_script_progression --message="Database migration not required" + ynh_script_progression --message="You shouldn't see this" popd From f3ca9c8da4f4aca6ad49f19e182ce6b71c960e51 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 30 Jan 2024 01:37:57 +0700 Subject: [PATCH 07/12] Update POST_INSTALL.md --- doc/POST_INSTALL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 138bffa..00f1c19 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -1,3 +1,4 @@ * After installing, you can create your own user using the form * Once done, you can (if you want) set the account creation to false in `__INSTALL_DIR__/config.php` * If you want to use the app in PWA mode, be sure to be connected to your account first +* After upgrading from 7.0 to 9.0, you may experience issues if you don't clean your browser cache From f97ff9011a71a868ea20a55eb46782094a9b1ee0 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 31 Jan 2024 08:50:34 +0700 Subject: [PATCH 08/12] Update manifest.toml --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 9ccc470..2ea959c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Moncycle" description.en = "Menstrual cycle follow-up for natural family planning" description.fr = "Suivi de cycle pour les méthodes naturelles de régulation de naissance" -version = "9.0~ynh1" +version = "9.0~ynh2" maintainers = ["Raoul de Limezy"] @@ -38,8 +38,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/jean-io/moncycle.app/archive/ee594d980925b1e868c6b23239e254c1c4bf7f52.zip" - sha256 = "7d4837723051f7338bff500931c30b57be7ef5ec7641c03000bd6e0be9b7b2c7" + url = "https://github.com/jean-io/moncycle.app/archive/cda74b19c2b392886aed48f0ae3a6c6d9b2869a3.zip" + sha256 = "e7b4a6b3350d80106245cd27a529e53ed477764ee59686d8a6f599faec9997e6" [resources.system_user] From d6639ad3bb31312ea22b437b48bbc81fe3d5f11e Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 31 Jan 2024 09:55:07 +0700 Subject: [PATCH 09/12] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index e7f55b4..4025c36 100755 --- a/scripts/install +++ b/scripts/install @@ -42,7 +42,7 @@ popd # worckaround while https://github.com/chartjs/Chart.js/issues/11478 is not fixed ynh_exec_warn_less mkdir "$install_dir/vendor/chartjs" -ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.js https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.js +ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.js https://cdn.jsdelivr.net/npm/chart.js ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.umd.js.map https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.js.map #================================================= From b048da14c710a6ccad439f4462bd4adf807c6399 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 31 Jan 2024 12:09:54 +0700 Subject: [PATCH 10/12] Test --- conf/nginx.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0610eb0..37886f7 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - root __INSTALL_DIR__/; + alias __INSTALL_DIR__/; # Deny access to hidden files and directories location ~ ^/(.+/|)\.(?!well-known\/) { @@ -27,6 +27,7 @@ location __PATH__/ { # Default indexes and catch-all rewrite ^/(connexion|compte)$ /$1.html; + rewrite ^/api/([a-zA-Z0-9_]+)(\?.*)?$ /api/$1.php$2; index index.php index.html; try_files $uri $uri/ $uri.php?$args; From dae6d8b62e415e90c34d69e70208ddb8947496fb Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 31 Jan 2024 12:44:26 +0700 Subject: [PATCH 11/12] Path --- conf/config.php | 2 +- manifest.toml | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/conf/config.php b/conf/config.php index c12e1ad..04f2655 100644 --- a/conf/config.php +++ b/conf/config.php @@ -7,7 +7,7 @@ ** https://github.com/jean-io/moncycle.app */ -define("APP_URL", "__DOMAIN__/__PATH__"); +define("APP_URL", "__DOMAIN____PATH__"); define("DB_HOST", "localhost"); define("DB_ID", "__DB_USER__"); diff --git a/manifest.toml b/manifest.toml index 2ea959c..19edd99 100644 --- a/manifest.toml +++ b/manifest.toml @@ -29,10 +29,6 @@ ram.runtime = "50M" [install.domain] type = "domain" - [install.path] - type = "path" - default = "/moncycle" - [install.init_main_permission] type = "group" From 33b4023419a88ab829e0518a755331c189552910 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 31 Jan 2024 06:04:39 +0000 Subject: [PATCH 12/12] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index df6c799..9a02c8d 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Make it easy to monitor menstrual cycles and apply natural methods. Billings. Sy - automatic sending of cycles by email - no data sales/no advertising -**Shipped version:** 7.0~ynh6 +**Shipped version:** 9.0~ynh2 **Demo:** https://tableau.moncycle.app/connexion.php?email1=demo@moncycle.app&mdp=demo diff --git a/README_fr.md b/README_fr.md index cf5c3ea..4bc0f56 100644 --- a/README_fr.md +++ b/README_fr.md @@ -36,7 +36,7 @@ Rendre facile le suivi des cycles menstruels et l’application des méthodes na - pas de vente de données/pas de publicité -**Version incluse :** 7.0~ynh6 +**Version incluse :** 9.0~ynh2 **Démo :** https://tableau.moncycle.app/connexion.php?email1=demo@moncycle.app&mdp=demo