1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hedgedoc_ynh.git synced 2024-09-03 19:25:52 +02:00

Add allow free url to config panel

This commit is contained in:
Éric Gaspar 2023-01-21 12:24:42 +01:00
parent d9e47b4647
commit de36e0d897
4 changed files with 19 additions and 1 deletions

View file

@ -7,7 +7,7 @@
"loglevel": "info", "loglevel": "info",
"useCDN": false, "useCDN": false,
"allowGravatar": false, "allowGravatar": false,
"allowFreeURL": false, "allowFreeURL": __ALLOW_FREE_URL__,
"allowAnonymous": __ALLOW_ANONYMOUS__, "allowAnonymous": __ALLOW_ANONYMOUS__,
"allowAnonymousEdits": true, "allowAnonymousEdits": true,
"defaultPermission": "locked", "defaultPermission": "locked",

View file

@ -22,3 +22,13 @@ name = "HedgeDoc configuration"
help = "Set to allow registration of new accounts using an email address. If set to false, you can still create accounts using the command line." help = "Set to allow registration of new accounts using an email address. If set to false, you can still create accounts using the command line."
bind = "allow_email_registration:__FINALPATH__/config.json" bind = "allow_email_registration:__FINALPATH__/config.json"
[main.config.allow_free_url]
ask = "Allow email registration"
type = "boolean"
yes = "true"
no = "false"
help = "Set to allow new note creation by accessing a nonexistent note URL. This is the behavior familiar from Etherpad."
bind = "allow_free_url:__FINALPATH__/config.json"

View file

@ -31,6 +31,7 @@ app=$YNH_APP_INSTANCE_NAME
allow_anonymous=false allow_anonymous=false
allow_email_registration=false allow_email_registration=false
allow_free_url=false
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -52,6 +53,7 @@ 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=allow_anonymous --value=$allow_anonymous ynh_app_setting_set --app=$app --key=allow_anonymous --value=$allow_anonymous
ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration
ynh_app_setting_set --app=$app --key=allow_free_url --value=$allow_free_url
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS

View file

@ -26,6 +26,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
allow_anonymous=$(ynh_app_setting_get --app=$app --key=allow_anonymous) allow_anonymous=$(ynh_app_setting_get --app=$app --key=allow_anonymous)
allow_email_registration=$(ynh_app_setting_get --app=$app --key=allow_email_registration) allow_email_registration=$(ynh_app_setting_get --app=$app --key=allow_email_registration)
allow_free_url=$(ynh_app_setting_get --app=$app --key=allow_free_url)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -48,6 +49,11 @@ if [ -z "$allow_email_registration" ]; then
ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration
fi fi
if [ -z "$allow_free_url" ]; then
allow_free_url="false"
ynh_app_setting_set --app=$app --key=allow_free_url --value=$allow_free_url
fi
# Cleaning legacy permissions # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all ynh_legacy_permissions_delete_all