From 87ca90e94d07a27fa71eb6e1d130a1b5d84b34bd Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Sun, 11 Feb 2024 21:27:41 +0100 Subject: [PATCH 1/9] some cleanup --- scripts/backup | 4 ++-- scripts/install | 16 ++++++++-------- scripts/restore | 8 ++++---- scripts/upgrade | 10 +++++----- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/scripts/backup b/scripts/backup index 597bead..ae1d9ef 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,9 +15,9 @@ source /usr/share/yunohost/helpers #================================================= ynh_print_info --message="Declaring files to be backed up..." -(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console.php maintenance 1) +(cd "$install_dir" && ynh_exec_as "$app" "php$phpversion" bin/console.php maintenance 1) -trap "(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console.php maintenance 0)" EXIT +trap '(cd $install_dir && ynh_exec_as $app php$phpversion bin/console.php maintenance 0)' EXIT #================================================= # BACKUP THE APP MAIN DIR diff --git a/scripts/install b/scripts/install index 1e64836..c270c7b 100644 --- a/scripts/install +++ b/scripts/install @@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -email=$(ynh_user_get_info --username=$admin --key=mail) +email=$(ynh_user_get_info --username="$admin" --key=mail) timezone=$(cat /etc/timezone) #================================================= @@ -21,7 +21,7 @@ timezone=$(cat /etc/timezone) #================================================= ynh_script_progression --message="Storing installation settings..." --weight=1 -ynh_app_setting_set --app=$app --key=email --value=$email +ynh_app_setting_set --app="$app" --key=email --value="$email" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -36,7 +36,7 @@ mkdir -p "$install_dir/view/smarty3" chmod -R 775 "$install_dir/view/smarty3" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # SYSTEM CONFIGURATION @@ -49,7 +49,7 @@ ynh_add_fpm_config # Create a dedicated nginx config ynh_add_nginx_config -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +ynh_add_config --template="cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" @@ -65,7 +65,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg ynh_script_progression --message="Adding the LDAP Auth addon configuration file..." --weight=1 # LDAP addon config -ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir/config/addon.config.php" +ynh_add_config --template="addon.config.php" --destination="$install_dir/config/addon.config.php" #================================================= # INSTALL FRIENDICA @@ -74,15 +74,15 @@ ynh_script_progression --message="Install Friendica..." --weight=1 pushd "$install_dir" # Import Composer dependencies - ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet + ynh_exec_as "$app" "php$phpversion" bin/composer.phar install --no-dev --quiet # Install application - ynh_exec_as "$app" php$phpversion bin/console.php autoinstall\ + ynh_exec_as "$app" "php$phpversion" bin/console.php autoinstall\ --dbhost "localhost" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path" # Enable LDAP Auth addon - ynh_exec_as "$app" php$phpversion bin/console.php addon enable ldapauth + ynh_exec_as "$app" "php$phpversion" bin/console.php addon enable ldapauth popd diff --git a/scripts/restore b/scripts/restore index 29f7215..496e7a4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -17,7 +17,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" chmod -R 775 "$install_dir/view/smarty3" #================================================= @@ -25,7 +25,7 @@ chmod -R 775 "$install_dir/view/smarty3" #================================================= ynh_script_progression --message="Restoring the MySQL database..." --weight=1 -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS @@ -53,7 +53,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload ynh_systemd_action --service_name=nginx --action=reload @@ -62,7 +62,7 @@ ynh_systemd_action --service_name=nginx --action=reload #============== # exit maintenance mode since the app was backed up while in maintenance mode -(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console.php maintenance 0) +(cd "$install_dir" && ynh_exec_as "$app" "php$phpversion" bin/console.php maintenance 0) #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 534cdea..d5e7081 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -36,7 +36,7 @@ then fi chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # REAPPLY SYSTEM CONFIGURATIONS @@ -51,7 +51,7 @@ ynh_add_fpm_config ynh_use_logrotate --non-append -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +ynh_add_config --template="cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" @@ -64,8 +64,8 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg # Run Composer pushd "$install_dir" - ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet - ynh_exec_as "$app" php$phpversion bin/console.php dbstructure update + ynh_exec_as "$app" "php$phpversion" bin/composer.phar install --no-dev --quiet + ynh_exec_as "$app" "php$phpversion" bin/console.php dbstructure update popd #================================================= From b84945c5393cd835b10ad2138cd0778b8b626ba3 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Sun, 11 Feb 2024 21:28:01 +0100 Subject: [PATCH 2/9] add autoupdate for the addons --- manifest.toml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/manifest.toml b/manifest.toml index a9e635a..27e8d8c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ description.fr = "Réseau social décentralisé" version = "2023.12~ynh1" -maintainers = [] +maintainers = [ "" ] [upstream] license = "AGPL-3.0-only" @@ -30,7 +30,7 @@ ram.runtime = "50M" [install] [install.domain] type = "domain" - + [install.init_main_permission] type = "group" default = "visitors" @@ -42,7 +42,7 @@ ram.runtime = "50M" ask.en = "Choose the application language" ask.fr = "Choisissez la langue de l'application" type = "select" - choices = ["de", "en", "es", "fr", "it", "pt"] + choices = [ "de", "en", "es", "fr", "it", "pt" ] default = "en" [resources] @@ -51,21 +51,23 @@ ram.runtime = "50M" [resources.sources.main] url = "https://github.com/friendica/friendica/archive/refs/tags/2023.12.tar.gz" sha256 = "d55475628ae24aab1ee7ed3367d22b2fd3ee49200b5da276c69e97df2afbd943" - autoupdate.strategy = "latest_github_tag" - + autoupdate.strategy = "latest_github_release" + [resources.sources.addons] url = "https://github.com/friendica/friendica-addons/archive/refs/tags/2023.12.tar.gz" sha256 = "d0228833584dd7dc0301ee04bd41728345c8051d84908849dea52ed04a7c8982" + autoupdate.upstream = "https://github.com/friendica/friendica-addons" + autoupdate.strategy = "latest_github_tag" - [resources.system_user] +[resources.system_user] - [resources.install_dir] +[resources.install_dir] - [resources.permissions] - main.url = "/" +[resources.permissions] +main.url = "/" - [resources.apt] - packages = "mariadb-server, php8.2-curl, php8.2-mbstring, php8.2-imagick, php8.2-xml, php8.2-zip, php8.2-mysql, php8.2-gd, php8.2-gmp" +[resources.apt] +packages = "mariadb-server, php8.2-curl, php8.2-mbstring, php8.2-imagick, php8.2-xml, php8.2-zip, php8.2-mysql, php8.2-gd, php8.2-gmp" - [resources.database] - type = "mysql" +[resources.database] +type = "mysql" From 6d0e39712dae3acdbb8656da2bc2e970def8a10b Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Sun, 11 Feb 2024 22:31:34 +0100 Subject: [PATCH 3/9] bump version --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 27e8d8c..1b4698b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Friendica" description.en = "Decentralized Social Network" description.fr = "Réseau social décentralisé" -version = "2023.12~ynh1" +version = "2023.12~ynh2" maintainers = [ "" ] From ba9a20d17eee44c7f5911c3984f174227845f07c Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 11 Feb 2024 21:31:39 +0000 Subject: [PATCH 4/9] 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 9fc2139..e17418f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. -**Shipped version:** 2023.12~ynh1 +**Shipped version:** 2023.12~ynh2 **Demo:** https://dir.friendica.social/servers diff --git a/README_fr.md b/README_fr.md index 1505640..57663fe 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. -**Version incluse :** 2023.12~ynh1 +**Version incluse :** 2023.12~ynh2 **Démo :** https://dir.friendica.social/servers From d344ee92c1714527c26ae55d81861546d116e6f4 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Sun, 11 Feb 2024 22:42:44 +0100 Subject: [PATCH 5/9] adding php8.2-intl dependency --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 1b4698b..5af6989 100644 --- a/manifest.toml +++ b/manifest.toml @@ -67,7 +67,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] -packages = "mariadb-server, php8.2-curl, php8.2-mbstring, php8.2-imagick, php8.2-xml, php8.2-zip, php8.2-mysql, php8.2-gd, php8.2-gmp" +packages = "mariadb-server, php8.2-curl, php8.2-mbstring, php8.2-imagick, php8.2-xml, php8.2-zip, php8.2-mysql, php8.2-gd, php8.2-gmp, php8.2-intl" [resources.database] type = "mysql" From 513a4759be7d70e5bed5f61c17de59d740bba91d Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Sun, 11 Feb 2024 23:07:19 +0100 Subject: [PATCH 6/9] remove irrelevant #sub_path_only rewrite & fix format --- conf/nginx.conf | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index ff4222f..398d4cf 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,26 +1,25 @@ -#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { +location __PATH__/ { - alias __INSTALL_DIR__/; + alias __INSTALL_DIR__/; - if (!-e $request_filename) { - rewrite ^(.*)$ /index.php?pagename=$1; - } + if (!-e $request_filename) { + rewrite ^(.*)$ /index.php?pagename=$1; + } - #allow uploads up to 20MB in size - client_max_body_size 50M; - client_body_buffer_size 128k; + #allow uploads up to 20MB in size + client_max_body_size 50M; + client_body_buffer_size 128k; - #Default indexes and catch-all - index index.php; + #Default indexes and catch-all + index index.php; # make sure webfinger and other well known services aren't blocked # by denying dot files and rewrite request to the front controller location ^~ /.well-known/ { allow all; - if (!-e $request_filename) { - rewrite ^(.*)$ /index.php?pagename=$1; - } + if (!-e $request_filename) { + rewrite ^(.*)$ /index.php?pagename=$1; + } } include mime.types; @@ -30,15 +29,15 @@ location __PATH__/ { deny all; } - #Execute and serve PHP files - location ~* \.php$ { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - try_files $uri =404; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - } + #Execute and serve PHP files + location ~* \.php$ { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + try_files $uri =404; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } # deny access to all dot files location ~ /\. { From 81927f29defdb141185ae55c4df3e95dcf292f9b Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 12 Feb 2024 00:03:37 +0100 Subject: [PATCH 7/9] fix url (#125) * fix url * no need for the path variable * fix url on upgrade * add config * fix variable * check if the config file exists * fix config file --- conf/local-sample.config.php | 4 ++-- scripts/install | 4 +++- scripts/upgrade | 10 ++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/conf/local-sample.config.php b/conf/local-sample.config.php index ef4a0f7..be4e5a4 100644 --- a/conf/local-sample.config.php +++ b/conf/local-sample.config.php @@ -32,7 +32,7 @@ return [ // **************************************************************** 'config' => [ - 'php_path' => '/usr/bin/php' + 'php_path' => '/usr/bin/php', 'admin_email' => '__EMAIL__', 'sitename' => 'Friendica Social Network', 'register_policy' => \Friendica\Module\Register::OPEN, @@ -40,7 +40,7 @@ return [ ], 'system' => [ 'url' => 'https://__DOMAIN__', - 'basepath' => '__INSTALL_DIR__' + 'basepath' => '__INSTALL_DIR__', 'default_timezone' => '__TIMEZONE__', 'language' => '__LANGUAGE__', ], diff --git a/scripts/install b/scripts/install index c270c7b..bc07915 100644 --- a/scripts/install +++ b/scripts/install @@ -38,6 +38,8 @@ chmod -R 775 "$install_dir/view/smarty3" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" +ynh_add_config --template="local-sample.config.php" --destination="$install_dir/config/local.config.php" + #================================================= # SYSTEM CONFIGURATION #================================================= @@ -79,7 +81,7 @@ pushd "$install_dir" # Install application ynh_exec_as "$app" "php$phpversion" bin/console.php autoinstall\ --dbhost "localhost" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ - --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path" + --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain" # Enable LDAP Auth addon ynh_exec_as "$app" "php$phpversion" bin/console.php addon enable ldapauth diff --git a/scripts/upgrade b/scripts/upgrade index d5e7081..0ff2f28 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,6 +58,16 @@ chmod 644 "/etc/cron.d/$app" # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 + +# fix the url if necessary (there should be no trailing slash) +if [ -f "$install_dir/config/local.config.php" ] && ! grep -q -e "'url' => 'https://$domain'," "$install_dir/config/local.config.php"; then + ynh_replace_string --match_string="'url' => 'https://.*'," --replace_string="'url' => 'https://$domain'," --target_file="$install_dir/config/local.config.php" +fi + #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= From f18910dd25ac218726af48f70c1a7b9010e985d4 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 12 Feb 2024 00:06:44 +0100 Subject: [PATCH 8/9] break line --- doc/DESCRIPTION.md | 4 ++-- doc/DESCRIPTION_fr.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index a3f067b..cbb347d 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,2 +1,2 @@ -Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. -Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. \ No newline at end of file +Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. +Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index a3f067b..cbb347d 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1,2 +1,2 @@ -Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. -Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. \ No newline at end of file +Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. +Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. From 5456bca2bcd4a6e66cc8e817d1a09cbdd005489b Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 11 Feb 2024 23:06:49 +0000 Subject: [PATCH 9/9] Auto-update README --- README.md | 3 ++- README_fr.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e17418f..6ba8bd8 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,10 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. +Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. + **Shipped version:** 2023.12~ynh2 **Demo:** https://dir.friendica.social/servers diff --git a/README_fr.md b/README_fr.md index 57663fe..e36af15 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,9 +16,10 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. +Friendica is a decentralised communications platform that integrates social communication. The platform links to independent social projects and corporate services. Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted. + **Version incluse :** 2023.12~ynh2 **Démo :** https://dir.friendica.social/servers