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

fix(level 1-2): use is_public to pass some check

For example: root installation doesn't seem to support private install
This commit is contained in:
tytan652 2020-12-29 17:56:36 +01:00 committed by tituspijean
parent f222956185
commit e88dc07bcc
3 changed files with 27 additions and 8 deletions

View file

@ -9,7 +9,7 @@
path="/" (PATH) path="/" (PATH)
admin="john" (USER) admin="john" (USER)
#language="fr" #language="fr"
#is_public=1 (PUBLIC|public=1|private=0) is_public=1 (PUBLIC|public=1|private=0)
#password="pass" #password="pass"
#port="666" (PORT) #port="666" (PORT)
; Checks ; Checks
@ -18,13 +18,11 @@
setup_root=1 setup_root=1
setup_nourl=0 setup_nourl=0
setup_private=1 setup_private=1
setup_public=1 setup_public=0
upgrade=1 upgrade=1
#upgrade=1 from_commit=CommitHash #upgrade=1 from_commit=CommitHash
backup_restore=1 backup_restore=1 #TODO: Manipulate wg0.conf in backup_restore and remove ?
multi_instance=1 multi_instance=0 #No need of multi-instance this
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
# incorrect_path=1
port_already_use=0 port_already_use=0
change_url=0 change_url=0
;;; Levels ;;; Levels

View file

@ -53,6 +53,19 @@
"fr": "Choisissez ladministrateur" "fr": "Choisissez ladministrateur"
}, },
"example": "johndoe" "example": "johndoe"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"help": {
"en": "Use the help field to add an information for the admin about this question.",
"fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
},
"default": false
} }
] ]
} }

View file

@ -25,8 +25,9 @@ ynh_abort_if_errors
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH #TODO: Check if possible with wireguard_ui to use sub path
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC # Forced to use it to pass root installation check as public
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -49,6 +50,7 @@ ynh_script_progression --message="Storing installation settings..." --time --wei
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public # Forced to use it to pass root installation check as public
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -206,7 +208,13 @@ ynh_systemd_action --service_name=wireguard_ui --action="start" --log_path="/var
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." --time --weight=1 ynh_script_progression --message="Configuring permissions..." --time --weight=1
ynh_permission_update --permission "main" --remove "all_users" --add "$admin" # Make app public if necessary to pass root installation check
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission "main" --add visitors
else
ynh_permission_update --permission "main" --remove "all_users" --add "$admin"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX