mirror of
https://github.com/YunoHost-Apps/redirect_ynh.git
synced 2024-09-03 20:16:10 +02:00
v2
This commit is contained in:
parent
3a06bf6c0b
commit
627eab8d37
9 changed files with 30 additions and 156 deletions
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
||||
#=================================================
|
||||
|
|
10
tests.toml
Normal file
10
tests.toml
Normal file
|
@ -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"
|
Loading…
Reference in a new issue