diff --git a/README.md b/README.md index 803c1b4..06ed820 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to ## Overview Gotify is a simple server for sending and receiving messages in real-time per web socket. (Includes a sleek web-ui) -**Shipped version:** 2.0.10 +**Shipped version:** 2.0.14 ## Screenshots diff --git a/README_fr.md b/README_fr.md index ad01825..3f16f61 100644 --- a/README_fr.md +++ b/README_fr.md @@ -12,7 +12,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble Gotify est un simple serveur permettant d'envoyer et de recevoir des messages via websocket. -**Version incluse:** 2.0.10 +**Version incluse:** 2.0.14 ## Captures d'écran diff --git a/conf/amd64.src b/conf/amd64.src index 6fa39c5..391a6c1 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.10/gotify-linux-amd64.zip -SOURCE_SUM=bee61bae6aec048a1e50835fac92970cd60397bfb0fbf1d0fb8596a96ef39fd8 +SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.14/gotify-linux-amd64.zip +SOURCE_SUM=edf1650467ab20ddd827c824171e80d9c2f010eacedc9dfae0b967e981e78854 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/conf/arm.src b/conf/arm.src index f07d240..43c2c0d 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.10/gotify-linux-arm-7.zip -SOURCE_SUM=70cfa4374d93520a6cc96d83624f29540393180e388006d4bf8557788f8accdc +SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.14/gotify-linux-arm-7.zip +SOURCE_SUM=d591e241e65629b13968bbbfca1ba58f4fc114c192c2b8d864d88c075e4dcfd2 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/conf/arm64.src b/conf/arm64.src index 2e7a56d..f9d0495 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.10/gotify-linux-arm64.zip -SOURCE_SUM=a378696c9279cd8b035813ad60260066e429f86aadfc2cbfe775405aeb6d4d7b +SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.14/gotify-linux-arm64.zip +SOURCE_SUM=f29d0b504bcbbacc0d9bf2af9030c6a3c72fa5f21ec811236bcaa24abcfe5b5e SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/manifest.json b/manifest.json index ddb180d..263d4e7 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A simple server for sending and receiving messages.", "fr": "Un simple serveur pour envoyer et recevoir des messages." }, - "version": "2.0.10~ynh1", + "version": "2.0.14~ynh1", "url": "http://gotify.net", "license": "MIT", "maintainer": { @@ -14,7 +14,7 @@ "email": "plopoyop@gmail.com" }, "requirements": { - "yunohost": ">= 2.7.14" + "yunohost": ">= 3.7.0" }, "multi_instance": true, "services": [ diff --git a/scripts/backup b/scripts/backup index 4ae7ff3..a107bf4 100755 --- a/scripts/backup +++ b/scripts/backup @@ -19,7 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -32,21 +32,21 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info "Backing up the main app directory..." +ynh_script_progression --message="Backing up the main app directory..." --weight=30 ynh_backup "$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info "Backing up nginx web server configuration..." +ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1 ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_print_info "Backing up the MySQL database..." +ynh_script_progression --message="Backing up the MySQL database..." --weight=20 ynh_mysql_dump_db "$db_name" > db.sql @@ -56,4 +56,4 @@ ynh_mysql_dump_db "$db_name" > db.sql #================================================= ynh_backup "/etc/systemd/system/$app.service" -ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)" --last \ No newline at end of file diff --git a/scripts/install b/scripts/install index d914f58..fa3c8dd 100755 --- a/scripts/install +++ b/scripts/install @@ -27,22 +27,12 @@ admin=$YNH_APP_ARG_ADMIN is_public=1 password=$YNH_APP_ARG_PASSWORD -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info "Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -58,7 +48,7 @@ ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info "Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url @@ -72,30 +62,15 @@ ynh_app_setting_set $app password $password # FIND AND OPEN A PORT #================================================= -### Use these lines if you have to open a port for the application -### `ynh_find_port` will find the first available port starting from the given port. -### If you're not using these lines: -### - Remove the section "CLOSE A PORT" in the remove script - # Find a free port port=$(ynh_find_port 8080) # Open this port -# yunohost firewall allow --no-upnp TCP $port 2>&1 ynh_app_setting_set $app port $port #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_print_info "Creating a MySQL database..." - -### Use these lines if you need a database for the application. -### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. -### The password will be stored as 'mysqlpwd' into the app settings, -### and will be available as $db_pwd -### If you're not using these lines: -### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script -### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script -### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script +ynh_script_progression --message="Creating a MySQL database..." --weight=20 db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set $app db_name $db_name @@ -104,11 +79,7 @@ ynh_mysql_setup_db $db_name $db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Setting up source files..." - -### `ynh_setup_source` is used to install an app from a zip or tar.gz file, -### downloaded from an upstream source, like a git repository. -### `ynh_setup_source` use the file conf/app.src +ynh_script_progression --message="Setting up source files..." --weight=6 ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src @@ -117,9 +88,7 @@ ynh_setup_source "$final_path" $architecture #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Configuring nginx web server..." - -### `ynh_add_nginx_config` will use the file conf/nginx.conf +ynh_script_progression --message="Configuring nginx web server..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config @@ -127,7 +96,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Configuring system user..." +ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user ynh_system_user_create $app @@ -137,27 +106,14 @@ ynh_system_user_create $app # SETUP SYSTEMD #================================================= -### `ynh_systemd_config` is used to configure a systemd script for an app. -### It can be used for apps that use sysvinit (with adaptation) or systemd. -### Have a look at the app to be sure this app needs a systemd script. -### `ynh_systemd_config` will use the file conf/systemd.service -### If you're not using these lines: -### - You can remove those files in conf/. -### - Remove the section "BACKUP SYSTEMD" in the backup script -### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script -### - As well as the section "RESTORE SYSTEMD" in the restore script -### - And the section "SETUP SYSTEMD" in the upgrade script - # Create a dedicated systemd config ynh_add_systemd_config #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_print_info "Create config file..." +ynh_script_progression --message="Create config file..." --weight=1 -### `ynh_replace_string` is used to replace a string in a file. -### (It's compatible with sed regular expressions syntax) cp ../conf/config.yml "$final_path/config.yml" ynh_replace_string "__APP__" $app "$final_path/config.yml" ynh_replace_string "__PORT__" $port "$final_path/config.yml" @@ -171,10 +127,6 @@ ynh_replace_string "__DOMAIN__" $domain "$final_path/config.yml" # STORE THE CONFIG FILE CHECKSUM #================================================= -### `ynh_store_file_checksum` is used to store the checksum of a file. -### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`, -### you can make a backup of this file before modifying it again if the admin had modified it. - # Calculate and store the config file checksum into the app settings ynh_store_file_checksum "$final_path/config.yml" @@ -184,69 +136,31 @@ ynh_store_file_checksum "$final_path/config.yml" # SECURE FILES AND DIRECTORIES #================================================= -### For security reason, any app should set the permissions to root: before anything else. -### Then, if write authorization is needed, any access should be given only to directories -### that really need such authorization. - # Set permissions to app files chown -R root: $final_path mkdir $final_path/data chown $app $final_path/data -#================================================= -# SETUP LOGROTATE -#================================================= - -### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app. -### Use this helper only if there is effectively a log file for this app. -### If you're not using this helper: -### - Remove the section "BACKUP LOGROTATE" in the backup script -### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script -### - And the section "SETUP LOGROTATE" in the upgrade script - -# Use logrotate to manage application logfile(s) -# ynh_use_logrotate - #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -### `yunohost service add` is a CLI yunohost command to add a service in the admin panel. -### You'll find the service in the 'services' section of YunoHost admin panel. -### This CLI command would be useless if the app does not have any services (systemd or sysvinit) -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script -### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script - yunohost service add $app -#--log "/var/log/FILE.log" #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." --weight=1 # Make app public if necessary -# if [ $is_public -eq 1 ] -# then -# # unprotected_uris allows SSO credentials to be passed anyway. -# ynh_app_setting_set $app unprotected_uris "/" -# fi - -# websocket must be open -# ynh_app_setting_set $app unprotected_uris "/stream" - -ynh_app_setting_set $app unprotected_uris "/" +ynh_permission_update --permission "main" --add visitors #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." --weight=1 systemctl reload nginx systemctl start $app -# yunohost firewall allow --no-upnp TCP $port 2>&1 -ynh_print_info "Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" --last \ No newline at end of file diff --git a/scripts/remove b/scripts/remove index 4d9bc6e..ae063a3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get $app final_path) # Remove a service from the admin panel, added by `yunohost service add` if yunohost service status | grep -q $app then - echo "Remove $app service" + ynh_script_progression --message="Remove $app service" --weight=1 yunohost service remove $app fi @@ -46,7 +46,7 @@ ynh_remove_systemd_config #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_print_info "Removing the MySQL database" +ynh_script_progression --message="Removing the MySQL database..." --weight=10 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db $db_user $db_name @@ -54,7 +54,7 @@ ynh_mysql_remove_db $db_user $db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info "Removing app main directory" +ynh_script_progression --message="Removing app main directory..." --weight=30 # Remove the app directory securely ynh_secure_remove "$final_path" @@ -62,51 +62,19 @@ ynh_secure_remove "$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info "Removing nginx web server configuration" +ynh_script_progression --message="Removing nginx web server configuration..." --weight=5 # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= - -# Remove the app-specific logrotate config -# ynh_remove_logrotate - -#================================================= -# CLOSE A PORT -#================================================= - -# if yunohost firewall list | grep -q "\- $port$" -# then -# echo "Close port $port" >&2 -# yunohost firewall disallow TCP $port 2>&1 -# fi - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE THE CRON FILE -#================================================= - -# Remove a cron file -# ynh_secure_remove "/etc/cron.d/$app" - -# Remove a directory securely -# ynh_secure_remove "/etc/$app/" - -# Remove the log files -# ynh_secure_remove "/var/log/$app/" - #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info "Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user..." --weight=5 # Delete a system user ynh_system_user_delete $app -ynh_print_info "Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" --last \ No newline at end of file diff --git a/scripts/restore b/scripts/restore index dce7a99..4b31907 100755 --- a/scripts/restore +++ b/scripts/restore @@ -19,7 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading settings..." +ynh_script_progression --message="Loading settings.." app=$YNH_APP_INSTANCE_NAME @@ -31,7 +31,7 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info "Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters.." --weight=1 ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -43,21 +43,21 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_print_info "Restoring nginx configuration..." +ynh_script_progression --message="Restoring nginx configuration..." --weight=1 ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info "Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory.." --weight=1 ynh_restore_file "$final_path" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_print_info "Restoring the MySQL database..." +ynh_script_progression --message="Restoring the MySQL database.." --weight=20 db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_mysql_setup_db $db_name $db_name $db_pwd @@ -66,7 +66,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info "Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user.." --weight=1 # Create the dedicated user (if not existing) ynh_system_user_create $app @@ -86,12 +86,11 @@ chown -R $app: $final_path/data/ #================================================= yunohost service add $app -# --log "/var/log/$app/APP.log" #================================================= # RESTORE SYSTEMD #================================================= -ynh_print_info "Restoring service..." +ynh_script_progression --message="Restoring service..." --weight=10 ynh_restore_file "/etc/systemd/system/$app.service" systemctl enable $app.service @@ -99,8 +98,8 @@ systemctl start $app #================================================= # GENERIC FINALIZATION #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server ..." --weight=1 systemctl reload nginx -ynh_print_info "Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 9854733..1f53155 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading settings.." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -29,7 +29,7 @@ password=$(ynh_app_setting_get $app password) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info "Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility.." --weight=1 # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then @@ -55,7 +55,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info "Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=30 # Backup the current version of the app ynh_backup_before_upgrade @@ -78,7 +78,7 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Upgrading source files..." +ynh_script_progression --message="Upgrading source files..." --weight=6 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" $architecture @@ -86,7 +86,7 @@ ynh_setup_source "$final_path" $architecture #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 # Create a dedicated nginx config if [ "$path_url" != "/" ] @@ -99,7 +99,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 # Create a dedicated user (if not existing) ynh_system_user_create $app @@ -151,22 +151,27 @@ chown -R $app: $final_path/data #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Upgrading SSOwat configuration..." +ynh_script_progression --message="Configuring SSOwat..." --weight=1 -ynh_app_setting_set $app unprotected_uris "/" +unprotected_uris=$(ynh_app_setting_get --app=$app --key=unprotected_uris) +if [ ! -z "$unprotected_uris" ]; then + ynh_app_setting_delete --app=$app --key=unprotected_uris +fi + +ynh_permission_update --permission "main" --add visitors #================================================= # RELOAD SERVICE #================================================= -ynh_print_info "Reloading service..." +ynh_script_progression --message="Reloading service..." --weight=1 systemctl restart $app #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." --weight=1 systemctl reload nginx -ynh_print_info "Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed" --last \ No newline at end of file