diff --git a/README.md b/README.md index 32c5ea0..5c39dc7 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ TLDraw is a tiny little drawing app. - Multiplayer mode (iFrame compatible) -**Shipped version:** 1.24.5~ynh3 +**Shipped version:** 2.3.0~ynh1 **Demo:** diff --git a/README_es.md b/README_es.md index f874aa6..5f5018c 100644 --- a/README_es.md +++ b/README_es.md @@ -26,7 +26,7 @@ TLDraw is a tiny little drawing app. - Multiplayer mode (iFrame compatible) -**Versión actual:** 1.24.5~ynh3 +**Versión actual:** 2.3.0~ynh1 **Demo:** diff --git a/README_eu.md b/README_eu.md index 3afd660..f5589e2 100644 --- a/README_eu.md +++ b/README_eu.md @@ -26,7 +26,7 @@ TLDraw is a tiny little drawing app. - Multiplayer mode (iFrame compatible) -**Paketatutako bertsioa:** 1.24.5~ynh3 +**Paketatutako bertsioa:** 2.3.0~ynh1 **Demoa:** diff --git a/README_fr.md b/README_fr.md index c647098..c6b40d8 100644 --- a/README_fr.md +++ b/README_fr.md @@ -25,7 +25,7 @@ TLDraw est une petite application de dessin. - Prêt pour PWA - Mode multijoueur (compatible iFrame) -**Version incluse :** 1.24.5~ynh3 +**Version incluse :** 2.3.0~ynh1 **Démo :** diff --git a/README_gl.md b/README_gl.md index bf83cbc..8bf04d6 100644 --- a/README_gl.md +++ b/README_gl.md @@ -26,7 +26,7 @@ TLDraw is a tiny little drawing app. - Multiplayer mode (iFrame compatible) -**Versión proporcionada:** 1.24.5~ynh3 +**Versión proporcionada:** 2.3.0~ynh1 **Demo:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md index b2c7135..1830963 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -26,7 +26,7 @@ TLDraw is a tiny little drawing app. - Multiplayer mode (iFrame compatible) -**分发版本:** 1.24.5~ynh3 +**分发版本:** 2.3.0~ynh1 **演示:** diff --git a/conf/systemd.service b/conf/systemd.service index cd044e0..92b1894 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__INSTALL_DIR__/apps/www/ +WorkingDirectory=__INSTALL_DIR__/sources/apps/www/ Environment="NODE_ENV=production" Environment="__YNH_NODE_LOAD_PATH__" ExecStart=yarn start --port=__PORT__ diff --git a/manifest.toml b/manifest.toml index 19e7dfc..3ff5698 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "tldraw" @@ -5,7 +7,7 @@ name = "TLDraw" description.en = "Tiny little drawing app" description.fr = "Petite application de dessin" -version = "1.24.5~ynh3" +version = "2.3.0~ynh1" maintainers = ["Raoul de Limezy"] @@ -33,29 +35,13 @@ ram.runtime = "50M" type = "group" default = "visitors" - [install.publickey] - ask.en = "Liveblocks API Public Key" - ask.fr = "Clé publique de l'API Liveblocks" - help.en = "Multiplayer mode requires a Liveblocks API Public Key (you can get one for free at https://liveblocks.io). Don't input anything if you don't want multiplayer mode." - help.fr = "Le mode d'édition instantanée requiert une clef publique d'API Liveblocks (vous pouvez en obtenir une gratuitement sur ttps://liveblocks.io). Ne mettez rien si vous ne souhaitez pas de mode d'étition instantanée." - type = "string" - optional = true - - [install.secretkey] - ask.en = "Liveblocks API Secret Key" - ask.fr = "Clé secrète de l'API Liveblocks" - help.en = "Multiplayer mode requires a Liveblocks API Secret Key (you can get one for free at https://liveblocks.io). Don't input anything if you don't want multiplayer mode." - help.fr = "Le mode d'édition instantanée requiert une clef secrete d'API Liveblocks (vous pouvez en obtenir une gratuitement sur ttps://liveblocks.io). Ne mettez rien si vous ne souhaitez pas de mode d'étition instantanée." - type = "string" - optional = true - [resources] [resources.sources.main] - url = "https://github.com/tldraw/tldraw/archive/8e55e263bf45cb6d425178c638aec385ec01e62c.zip" - sha256 = "d090aac97266e043418ec34d46e722dd69c7dace4bd30f39afb9478eb21271d1" + url = "https://github.com/tldraw/tldraw/archive/refs/tags/v2.3.0.tar.gz" + sha256 = "7f66ab29a755ad085695730690b6be1337c08a727eff687163990d4ecca696d6" # Disabled autoupdate for now because it's flooding with PRs which are failing the test # The "multiplayer" patch needs to be fixed to be adapted to newer versions - #autoupdate.strategy = "latest_github_tag" + autoupdate.strategy = "latest_github_tag" [resources.ports] @@ -65,9 +51,3 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" - - [resources.apt] - packages = "" - extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" - extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" - extras.yarn.packages = "yarn" diff --git a/scripts/_common.sh b/scripts/_common.sh index e6ea462..3cbba5a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,12 +1,10 @@ #!/bin/bash -#================================================= -# COMMON VARIABLES #================================================= # PHP APP SPECIFIC #================================================= -NODEJS_VERSION=18 +NODEJS_VERSION=20 #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index c71e44c..cb99c83 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -22,24 +20,16 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP FAIL2BAN CONFIGURATION -#================================================= +ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= @@ -48,12 +38,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/var/log/$app/$app.log" -#================================================= -# BACKUP SYSTEMD -#================================================= - -ynh_backup --src_path="/etc/systemd/system/$app.service" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index ae914ad..e93d545 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,8 +7,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # STOP SYSTEMD SERVICE #================================================= @@ -25,14 +21,12 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#================================================= -# GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index e30d975..ddbd4a9 100755 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -12,94 +10,67 @@ source /usr/share/yunohost/helpers #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 +ynh_script_progression --message="Installing NodeJS..." --weight=1 # Install nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION +ynh_install_nodejs --nodejs_version="$NODEJS_VERSION" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir/sources" +mkdir -p "$install_dir/bin" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config +chown -R "$app:www-data" "$install_dir" #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Patching multiplayer file..." --weight=1 +# ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_secure_remove --file="$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx" -ynh_add_config --template="../conf/MultiplayerMenu.tsx" --destination="$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx" - -chmod 400 "$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx" -chown $app:$app "$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx" - -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 - -ynh_add_config --template="../conf/.env" --destination="$install_dir/apps/www/.env" - -chmod 400 "$install_dir/apps/www/.env" -chown $app:$app "$install_dir/apps/www/.env" +# ynh_add_config --template=".env" --destination="$install_dir/apps/www/.env" +# chmod 400 "$install_dir/apps/www/.env" +# chown "$app:$app" "$install_dir/apps/www/.env" #================================================= # BUILD YARN DEPENDENCIES #================================================= -pushd "$install_dir" - ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000 - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn build +ynh_use_nodejs +ynh_exec_as "$app" env "$ynh_node_load_PATH" corepack enable --install-directory "$install_dir/bin" + +pushd "$install_dir/sources" + ynh_exec_warn_less ynh_exec_as "$app" env COREPACK_ENABLE_DOWNLOAD_PROMPT=0 "$ynh_node_load_PATH" "$install_dir/bin/yarn" cache clean + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$install_dir/bin/yarn" install --network-timeout 1000000000 + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$install_dir/bin/yarn" cache clean + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$install_dir/bin/yarn" build popd #================================================= -# SETUP SYSTEMD +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 + +# Create a dedicated NGINX config +ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 +yunohost service add "$app" --description="A tiny little drawing app" --log="/var/log/$app/$app.log" # Use logrotate to manage application logfile(s) ynh_use_logrotate -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="A tiny little drawing app" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index ede5b81..363cda9 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,16 +8,13 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEM CONFIGURATIONS #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null -then - ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove $app +if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then + yunohost service remove "$app" fi # Remove the dedicated systemd config @@ -34,8 +29,6 @@ ynh_remove_nginx_config # Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config -# Remove the log files - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 87f018f..142b009 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,15 +1,20 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 + +# Install nodejs +ynh_install_nodejs --nodejs_version="$NODEJS_VERSION" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -18,49 +23,25 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= -# RESTORE FAIL2BAN CONFIGURATION +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1 +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable "$app.service" --quiet +yunohost service add "$app" --description="A tiny little drawing app" --log="/var/log/$app/$app.log" + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -# Install nodejs -ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1 - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # RESTORE THE LOGS #================================================= @@ -69,23 +50,11 @@ ynh_script_progression --message="Restoring the logs..." --weight=1 ynh_restore_file --origin_path="/var/log/$app/$app.log" #================================================= -# INTEGRATE SERVICE IN YUNOHOST +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -yunohost service add $app --description="A tiny little drawing app" --log="/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 251f4a1..10dfc7f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,44 +7,43 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression --message="Stopping $app's 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 +# ENSURE DOWNWARD COMPATIBILITY #================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=1 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" +if [[ -n "${publickey:-}" ]]; then + ynh_app_setting_delete --app="$app" --key="publickey" +fi +if [[ -n "${secretkey:-}" ]]; then + ynh_app_setting_delete --app="$app" --key="secretkey" fi - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=1 +ynh_script_progression --message="Upgrading NodeJS..." --weight=1 # Install nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 + +ynh_setup_source --dest_dir="$install_dir/sources" --full_replace=1 + +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" + #================================================= # NGINX CONFIGURATION #================================================= diff --git a/tests.toml b/tests.toml index ddbf86a..94abb79 100644 --- a/tests.toml +++ b/tests.toml @@ -1,6 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + test_format = 1.0 [default] - - -args.publickey="public"