diff --git a/README.md b/README.md index b523625..6b72f21 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,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.22 +**Shipped version:** 2.1.4 ## Screenshots @@ -31,10 +31,6 @@ How to configure this app: LDAP is not supported (blocked until Gotify core upstream implements it). -## Limitations - - * Require dedicated domain like `gotify.domain.tld` - ## Links * Report a bug: https://github.com/YunoHost-Apps/gotify_ynh/issues diff --git a/README_fr.md b/README_fr.md index b301310..2511267 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble Gotify est un serveur simple permettant d'envoyer et de recevoir des messages via websocket. -**Version incluse :** 2.0.20 +**Version incluse :** 2.1.4 ## Captures d'écran @@ -31,10 +31,6 @@ Pour configurer Gotify : Pas de support de LDAP (non implémenté upstream) -## Limitations - - * Nécessite un domaine dédié comme par exemple `gotify.domain.tld` - ## Liens * Signaler un bug : https://github.com/YunoHost-Apps/gotify_ynh/issues diff --git a/check_process b/check_process index 96906bb..ea87313 100644 --- a/check_process +++ b/check_process @@ -6,12 +6,13 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) + path="/path" (PATH) admin="john" (USER) password="pass" port="666" (PORT) ; Checks pkg_linter=1 - setup_sub_dir=0 + setup_sub_dir=1 setup_root=1 setup_nourl=0 setup_private=0 @@ -21,7 +22,7 @@ backup_restore=1 multi_instance=1 port_already_use=1 - change_url=0 + change_url=1 ;;; Upgrade options ; commit=e0fbbb9a6d2fd87b4d42e85c0fc8f4e479689abc name=Mon Feb 18 21:55:49 2019 +0100 Merge branch 'master' of github.com:YunoHost-Apps/gotify_ynh diff --git a/conf/amd64.src b/conf/amd64.src index 201e47d..cd813ee 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.22/gotify-linux-amd64.zip -SOURCE_SUM=30801ea636d428630ea1380a7853eb85ba5dee74d4d757b0d51d5646af02fbf7 +SOURCE_URL=https://github.com/gotify/server/releases/download/v2.1.4/gotify-linux-amd64.zip +SOURCE_SUM=98b126e5d934d45b1390b1a1b9136e7690518bfdbb731a75a45a55e86291af4b SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/conf/arm-7.src b/conf/arm-7.src index b1d428e..1c196de 100644 --- a/conf/arm-7.src +++ b/conf/arm-7.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.22/gotify-linux-arm-7.zip -SOURCE_SUM=2f7a0133a17274a8d919fa438f1ddeb4054612b1bcf9b47773a405e490bb0ed0 +SOURCE_URL=https://github.com/gotify/server/releases/download/v2.1.4/gotify-linux-arm-7.zip +SOURCE_SUM=ffbc8710f1ba6b2c3dc74171fd4e28fc74765e6dda2e6a304dc0685bbd167243 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/conf/arm64.src b/conf/arm64.src index 2be1329..d37686a 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.22/gotify-linux-arm64.zip -SOURCE_SUM=fd36d04ccf0adc18758fca3c73a537b9d824fcf5cf21c94d250d3a04458e179d +SOURCE_URL=https://github.com/gotify/server/releases/download/v2.1.4/gotify-linux-arm64.zip +SOURCE_SUM=1379a92844e9d632cc5fd01db1e1d1ef4303bb6e92e6ca7e2618f06ed463264c SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/conf/config.yml b/conf/config.yml index 2ea5599..b742dce 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -12,7 +12,7 @@ server: database: # for database see (configure database section) dialect: mysql - connection: __APP__:__DBPASS__@/__DBNAME__?charset=utf8&parseTime=True&loc=Local + connection: __APP__:__DBPASS__@unix(/var/run/mysqld/mysqld.sock)/__DBNAME__?charset=utf8&parseTime=True&loc=Local defaultuser: # on database creation, gotify creates an admin user name: __ADMINUSER__ # the username of the default user diff --git a/conf/nginx.conf b/conf/nginx.conf index 486711d..4963313 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -18,6 +18,7 @@ location __PATH__/stream { location __PATH__/ { proxy_pass http://127.0.0.1:__PORT__/; + #sub_path_only rewrite ^/__PATH__(/.*) $1 break; proxy_set_header Host $host; proxy_buffering off; fastcgi_param REMOTE_USER $remote_user; diff --git a/manifest.json b/manifest.json index de61340..bd6309f 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.22~ynh1", + "version": "2.1.4~ynh1", "url": "http://gotify.net", "license": "MIT", "maintainer": { @@ -32,6 +32,16 @@ }, "example": "example.com" }, + { + "name": "path", + "type": "path", + "ask": { + "en": "Choose a path for Gotify", + "fr": "Choisissez un chemin pour Gotify" + }, + "example": "/gotify", + "default": "/gotify" + }, { "name": "admin", "type": "user", diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000..af09e6d --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,18 @@ +## Problem +- *Description of why you made this PR* + +## Solution +- *And how do you fix that problem* + +## PR Status +- [ ] Code finished. +- [ ] Tested with Package_check. +- [ ] Fix or enhancement tested. +- [ ] Upgrade from last version tested. +- [ ] Can be reviewed and tested. + +## Package_check results +--- +*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* + +[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/gotify_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/gotify_ynh%20PR-NUM-%20(USERNAME)/) diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..2378050 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,128 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +old_domain=$YNH_APP_OLD_DOMAIN +old_path=$YNH_APP_OLD_PATH + +new_domain=$YNH_APP_NEW_DOMAIN +new_path=$YNH_APP_NEW_PATH + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --time --weight=1 + +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get $app port) + +#================================================= +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# CHECK WHICH PARTS SHOULD BE CHANGED +#================================================= + +change_domain=0 +if [ "$old_domain" != "$new_domain" ] +then + change_domain=1 +fi + +change_path=0 +if [ "$old_path" != "$new_path" ] +then + change_path=1 +fi + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 + +ynh_systemd_action --service_name=$app --action="stop" + +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= +ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 + +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Change the path in the NGINX config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original NGINX config file if modified + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" + # Set global variables for NGINX helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated NGINX config + ynh_add_nginx_config +fi + +# Change the domain for NGINX +if [ $change_domain -eq 1 ] +then + # Delete file checksum for the old conf file location + ynh_delete_file_checksum --file="$nginx_conf_path" + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + # Store file checksum for the new config file location + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +fi + +#================================================= +# SPECIFIC MODIFICATIONS +#================================================= +#================================================= + +#================================================= +# GENERIC FINALISATION +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --time --weight=1 + +ynh_systemd_action --service_name=$app --action="start" + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Change of URL completed for $app" --time --last \ No newline at end of file diff --git a/scripts/install b/scripts/install index fff7f5f..b016ecb 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=/ +path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN is_public=1 password=$YNH_APP_ARG_PASSWORD