1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/tldraw_ynh.git synced 2024-09-03 20:35:54 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-31 03:06:36 +02:00 committed by Alexandre Aubin
parent fcfa282e24
commit bc20b211a8
12 changed files with 111 additions and 295 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
*~ *~
*.sw[op] *.sw[op]
.DS_Store

View file

@ -8,7 +8,7 @@ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/apps/www/ WorkingDirectory=__INSTALL_DIR__/apps/www/
Environment="NODE_ENV=production" Environment="NODE_ENV=production"
Environment="__YNH_NODE_LOAD_PATH__" Environment="PATH=__PATH_WITH_NODEJS__"
ExecStart=yarn start --port=__PORT__ ExecStart=yarn start --port=__PORT__
StandardOutput=append:/var/log/__APP__/__APP__.log StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit StandardError=inherit

View file

@ -16,7 +16,8 @@ demo = "https://tldraw.com"
code = "https://github.com/tldraw/tldraw" code = "https://github.com/tldraw/tldraw"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = false ldap = false

View file

@ -1,21 +1,9 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES AND CUSTOM HELPERS
#================================================= #=================================================
# PHP APP SPECIFIC # PHP APP SPECIFIC
#================================================= #=================================================
NODEJS_VERSION=18 nodejs_version=18
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -1,38 +1,29 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP FAIL2BAN CONFIGURATION # BACKUP FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup "/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
@ -40,22 +31,22 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup "/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP LOGS # BACKUP LOGS
#================================================= #=================================================
ynh_backup --src_path="/var/log/$app/$app.log" ynh_backup "/var/log/$app/$app.log"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app.service"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,41 +1,31 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression "Stopping $app's systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemctl --service=$app --action="stop"
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config ynh_config_change_url_nginx
#=================================================
# GENERIC FINALISATION
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemctl --service=$app --action="start"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app" --last ynh_script_progression "Change of URL completed for $app"

View file

@ -1,102 +0,0 @@
#!/bin/bash
# In simple cases, you don't need a config script.
# With a simple config_panel.toml, you can write in the app settings, in the
# upstream config file or replace complete files (logo ...) and restart services.
# The config scripts allows you to go further, to handle specific cases
# (validation of several interdependent fields, specific getter/setter for a value,
# display dynamic informations or choices, pre-loading of config type .cube... ).
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__amount() {
# Here we can imagine to have an API call to stripe to know the amount of donation during a month
local amount = 200
# It's possible to change some properties of the question by overriding it:
if [ $amount -gt 100 ]
then
cat << EOF
style: success
value: $amount
ask:
en: A lot of donation this month: **$amount €**
EOF
else
cat << EOF
style: danger
value: $amount
ask:
en: Not so much donation this month: $amount €
EOF
fi
}
get__prices() {
local prices = "$(grep "DONATION\['" "$final_path/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')"
if [ "$prices" == "," ];
then
# Return YNH_NULL if you prefer to not return a value at all.
echo YNH_NULL
else
echo $prices
fi
}
#=================================================
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
#=================================================
validate__publishable_key() {
# We can imagine here we test if the key is really a publisheable key
(is_secret_key $publishable_key) &&
echo 'This key seems to be a secret key'
}
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
set__prices() {
#---------------------------------------------
# IMPORTANT: setter are trigger only if a change is detected
#---------------------------------------------
for price in $(echo $prices | sed "s/,/ /"); do
frequency=$(echo $price | cut -d/ -f1)
currency=$(echo $price | cut -d/ -f2)
price_id=$(echo $price | cut -d/ -f3)
sed "d/DONATION\['$frequency'\]\['$currency'\]" "$final_path/settings.py"
echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$final_path/settings.py"
done
#---------------------------------------------
# IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too
#---------------------------------------------
ynh_app_setting_set $app prices $prices
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_run $1

View file

@ -1,47 +1,40 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1 ynh_script_progression "Installing dependencies..."
# Install nodejs # Install nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_nodejs_install
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression "Setting up source files..."
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
chmod -R o-rwx "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1 ynh_script_progression "Configuring NGINX web server..."
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_config_add_nginx
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Patching multiplayer file..." --weight=1 ynh_script_progression "Patching multiplayer file..."
ynh_secure_remove --file="$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx" ynh_safe_rm "$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" ynh_config_add --template="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" 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" chown $app:$app "$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx"
@ -49,60 +42,58 @@ chown $app:$app "$install_dir/packages/tldraw/src/components/TopPanel/Multiplaye
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression "Adding $app's configuration..."
ynh_add_config --template="../conf/.env" --destination="$install_dir/apps/www/.env" ynh_config_add --template=".env" --destination="$install_dir/apps/www/.env"
chmod 400 "$install_dir/apps/www/.env" #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/apps/www/.env"
chown $app:$app "$install_dir/apps/www/.env" #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/apps/www/.env"
#================================================= #=================================================
# BUILD YARN DEPENDENCIES # BUILD YARN DEPENDENCIES
#================================================= #=================================================
pushd "$install_dir" pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn cache clean
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000 ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install --network-timeout 1000000000
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn cache clean
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn build ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn build
popd popd
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_script_progression "Configuring $app's systemd service..."
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_config_add_systemd
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1 ynh_script_progression "Configuring log rotation..."
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_config_add_logrotate
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression "Integrating service in YunoHost..."
yunohost service add $app --description="A tiny little drawing app" --log="/var/log/$app/$app.log" yunohost service add $app --description="A tiny little drawing app" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemctl --service=$app --action="start"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression "Installation of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -16,23 +10,23 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # 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 if ynh_hide_warnings yunohost service status $app >/dev/null
then then
ynh_script_progression --message="Removing $app service integration..." --weight=1 ynh_script_progression "Removing $app service integration..."
yunohost service remove $app yunohost service remove $app
fi fi
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_config_remove_systemd
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_config_remove_logrotate
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_config_remove_nginx
# Remove the dedicated Fail2Ban config # Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config ynh_config_remove_fail2ban
# Remove the log files # Remove the log files
@ -40,4 +34,4 @@ ynh_remove_fail2ban_config
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,84 +7,83 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir" ynh_restore "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# RESTORE FAIL2BAN CONFIGURATION # RESTORE FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1 ynh_script_progression "Restoring the Fail2Ban configuration..."
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore "/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_restore "/etc/fail2ban/filter.d/$app.conf"
ynh_systemd_action --action=restart --service_name=fail2ban ynh_systemctl --action=restart --service=fail2ban
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1 ynh_script_progression "Reinstalling dependencies..."
# Install nodejs # Install nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1 ynh_nodejs_install 2>&1
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 ynh_script_progression "Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_script_progression "Restoring $app's systemd service..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore "/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
#================================================= #=================================================
# RESTORE THE LOGROTATE CONFIGURATION # RESTORE THE LOGROTATE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 ynh_script_progression "Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore "/etc/logrotate.d/$app"
#================================================= #=================================================
# RESTORE THE LOGS # RESTORE THE LOGS
#================================================= #=================================================
ynh_script_progression --message="Restoring the logs..." --weight=1 ynh_script_progression "Restoring the logs..."
ynh_restore_file --origin_path="/var/log/$app/$app.log" ynh_restore "/var/log/$app/$app.log"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression "Integrating service in YunoHost..."
yunohost service add $app --description="A tiny little drawing app" --log="/var/log/$app/$app.log" yunohost service add $app --description="A tiny little drawing app" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemctl --service=$app --action="start"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_script_progression "Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemctl --service=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression "Restoration completed for $app"

View file

@ -1,67 +1,53 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression "Stopping $app's systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemctl --service=$app --action="stop"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] # FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then then
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
fi fi
chmod -R o-rwx "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_script_progression "Upgrading dependencies..."
# Install nodejs # Install nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_nodejs_install
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 ynh_script_progression "Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_config_add_nginx
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Patching multiplayer file..." --weight=1 ynh_script_progression "Patching multiplayer file..."
ynh_secure_remove --file="$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx" ynh_safe_rm "$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" ynh_config_add --template="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" 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" chown $app:$app "$install_dir/packages/tldraw/src/components/TopPanel/MultiplayerMenu/MultiplayerMenu.tsx"
@ -69,59 +55,57 @@ chown $app:$app "$install_dir/packages/tldraw/src/components/TopPanel/Multiplaye
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression "Updating configuration..."
ynh_add_config --template="../conf/.env" --destination="$install_dir/apps/www/.env" ynh_config_add --template=".env" --destination="$install_dir/apps/www/.env"
chmod 400 "$install_dir/apps/www/.env" #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/apps/www/.env"
chown $app:$app "$install_dir/apps/www/.env" #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/apps/www/.env"
#================================================= #=================================================
# BUILD YARN DEPENDENCIES # BUILD YARN DEPENDENCIES
#================================================= #=================================================
pushd "$install_dir" pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000 2>&1 ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install --network-timeout 1000000000 2>&1
ynh_script_progression --message="Cleaning cache... " --weight=3 ynh_script_progression "Cleaning cache... "
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean 2>&1 ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn cache clean 2>&1
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn build 2>&1 ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn build 2>&1
popd popd
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_script_progression "Upgrading systemd configuration..."
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_config_add_systemd
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 ynh_script_progression "Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append ynh_config_add_logrotate
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression "Integrating service in YunoHost..."
yunohost service add $app --description="A tiny little drawing app" --log="/var/log/$app/$app.log" yunohost service add $app --description="A tiny little drawing app" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemctl --service=$app --action="start"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression "Upgrade of $app completed"

View file

@ -1,15 +0,0 @@
diff --git a/apps/www/pages/r/[id].tsx b/apps/www/pages/r/[id].tsx
index 7f582cfa..9d9f9bed 100644
--- a/apps/www/pages/r/[id].tsx
+++ b/apps/www/pages/r/[id].tsx
@@ -16,10 +16,6 @@ interface RoomProps {
}
export default function Room({ id }: RoomProps) {
- if (typeof window !== 'undefined' && window.self !== window.top) {
- return <IFrameWarning url={`https://tldraw.com/r/${id}`} />
- }
-
return (
<>
<Head>