diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md diff --git a/manifest.json b/manifest.json deleted file mode 100644 index ea811b4..0000000 --- a/manifest.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "Redirect", - "id": "redirect", - "packaging_format": 1, - "description": { - "en": "Create a redirection or a proxy to another path", - "fr": "Créer une redirection ou un proxy vers un autre emplacement" - }, - "version": "1.0.2~ynh1", - "license": "AGPL-3.0-or-later", - "url": "https://github.com/YunoHost-Apps/redirect_ynh", - "upstream": { - "license": "AGPL-3.0-or-later", - "code": "https://github.com/YunoHost-Apps/redirect_ynh" - }, - "maintainer": { - "name": "alexAubin", - "email": "alex.aubin@mailoo.org" - }, - "requirements": { - "yunohost": ">= 4.2.0" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain", - "example": "domain.org" - }, - { - "name": "path", - "type": "path", - "example": "/redirect", - "default": "/redirect" - }, - { - "name": "redirect_path", - "type": "string", - "ask": { - "en": "Redirect destination path", - "fr": "Emplacement de destination" - }, - "example": "http://127.0.0.1:8080/app/", - "default": "http://127.0.0.1" - }, - { - "name": "redirect_type", - "type": "string", - "ask": { - "en": "Redirect type", - "fr": "Type de redirection" - }, - "choices": { - "public_302": "Visible redirect (302, temporary). Everybody will be able to access it.", - "public_301": "Visible redirect (301, permanent). Everybody will be able to access it.", - "public_proxy": "Proxy, invisible (NGINX proxy_pass). Everybody will be able to access it.", - "private_proxy": "Proxy, invisible (NGINX proxy_pass). Only accessible for allowed users." - }, - "default": "public_302" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index c1db00c..bfb56a7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -11,28 +11,23 @@ maintainers = ["alexAubin"] [upstream] license = "AGPL-3.0-or-later" -code = "https://github.com/YunoHost-Apps/redirect_ynh" website = "https://github.com/YunoHost-Apps/redirect_ynh" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 4.2.0" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.2" +architectures = "all" multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" [install.path] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "path" default = "/redirect" @@ -50,10 +45,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen default = "public_302" [install.redirect_type.choices] -public_302 = "Visible redirect (302, temporary). Everybody will be able to access it." -public_301 = "Visible redirect (301, permanent). Everybody will be able to access it." -public_proxy = "Proxy, invisible (NGINX proxy_pass). Everybody will be able to access it." -private_proxy = "Proxy, invisible (NGINX proxy_pass). Only accessible for allowed users." + public_302 = "Visible redirect (302, temporary). Everybody will be able to access it." + public_301 = "Visible redirect (301, permanent). Everybody will be able to access it." + public_proxy = "Proxy, invisible (NGINX proxy_pass). Everybody will be able to access it." + private_proxy = "Proxy, invisible (NGINX proxy_pass). Only accessible for allowed users." [resources] [resources.system_user] diff --git a/scripts/backup b/scripts/backup index fe765d8..5598312 100644 --- a/scripts/backup +++ b/scripts/backup @@ -8,22 +8,6 @@ source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -# Retrieve arguments -#REMOVEME? app=$YNH_APP_INSTANCE_NAME -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index 6e8847e..c5a3057 100644 --- a/scripts/install +++ b/scripts/install @@ -8,26 +8,12 @@ source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -# Retrieve arguments -#REMOVEME? app=$YNH_APP_INSTANCE_NAME -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? redirect_type=$YNH_APP_ARG_REDIRECT_TYPE -#REMOVEME? redirect_path=$YNH_APP_ARG_REDIRECT_PATH - -# Check domain/path availability -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path +redirect_type=$YNH_APP_ARG_REDIRECT_TYPE +redirect_path=$YNH_APP_ARG_REDIRECT_PATH # Validate redirect path url_regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' @@ -39,9 +25,9 @@ url_regex='^(http://(127\.[0-9]+\.[0-9]+\.[0-9]+|localhost)|https://.*)(:[0-9]+) [[ "$redirect_type" = "proxy" ]] && [[ ! $redirect_path =~ $url_regex ]] && ynh_die \ "For secure reason, you can't use an unencrypted http remote destination couple with ssowat for your reverse proxy: $redirect_path" 1 -# Save extra settings +# Save extra settings ynh_app_setting_set --app=$app --key=redirect_type --value=$redirect_type -#REMOVEME? ynh_app_setting_set --app=$app --key=redirect_path --value=$redirect_path +ynh_app_setting_set --app=$app --key=redirect_path --value=$redirect_path #================================================= # CONFIGURE NGINX @@ -70,22 +56,15 @@ fi #================================================= # CONFIGURE SSOWAT #================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=2 +ynh_script_progression --message="Configuring permissions..." --weight=2 # Make app public if necessary if [ "$redirect_type" != "private_proxy" ] then # unprotected_uris allows SSO credentials to be passed anyway. -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" + ynh_permission_update --permission="main" --add="visitors" fi -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 9f3f534..008b047 100644 --- a/scripts/remove +++ b/scripts/remove @@ -8,15 +8,6 @@ source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -# Retrieve arguments -#REMOVEME? app=$YNH_APP_INSTANCE_NAME -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -24,13 +15,6 @@ source /usr/share/yunohost/helpers # Remove configuration files ynh_secure_remove /etc/nginx/conf.d/$domain.d/$app.conf -#================================================= -# RELOAD NGINX AND PHP-FPM -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index e78f9dc..1f4533c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,23 +8,12 @@ source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # LOAD SETTINGS #================================================= -# Retrieve arguments -#REMOVEME? app=$YNH_APP_INSTANCE_NAME -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? redirect_type=$(ynh_app_setting_get --app=$app --key=redirect_type) -#REMOVEME? redirect_path=$(ynh_app_setting_get --app=$app --key=redirect_path) +redirect_type=$(ynh_app_setting_get --app=$app --key=redirect_type) +redirect_path=$(ynh_app_setting_get --app=$app --key=redirect_path) # Validate redirect path url_regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' @@ -45,7 +34,7 @@ ynh_restore_file "$NGINX_CONF" if [ "$redirect_type" != "private_proxy" ] then # unprotected_uris allows SSO credentials to be passed anyway. -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..4cfe8c7 --- /dev/null +++ b/tests.toml @@ -0,0 +1,10 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Default args to use for install + # ------------------------------- + + args.redirect_type = "public_302" + args.redirect_path = "http://127.0.0.1" \ No newline at end of file