From 9158a3f076e1990f6b7580bb9f6ac6a2e0bf0c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 21 Jan 2023 12:30:12 +0100 Subject: [PATCH] Add FreeURL authentication --- config_panel.toml | 10 +++++++++- scripts/install | 2 ++ scripts/upgrade | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/config_panel.toml b/config_panel.toml index 7814eff..9fdb6dd 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -23,12 +23,20 @@ name = "HedgeDoc configuration" bind = "allow_email_registration:__FINALPATH__/config.json" [main.config.allow_free_url] - ask = "Allow email registration" + ask = "Allow new note creation" 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" + [main.config.require_free_url_authentication] + ask = "Require FreeURL authentication" + type = "boolean" + yes = "true" + no = "false" + help = "Set to require authentication for FreeURL mode style note creation." + bind = "require_free_url_authentication:__FINALPATH__/config.json" + diff --git a/scripts/install b/scripts/install index d5d0569..5cdc25d 100644 --- a/scripts/install +++ b/scripts/install @@ -32,6 +32,7 @@ app=$YNH_APP_INSTANCE_NAME allow_anonymous=false allow_email_registration=false allow_free_url=false +require_free_url_authentication=false #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -54,6 +55,7 @@ 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_email_registration --value=$allow_email_registration ynh_app_setting_set --app=$app --key=allow_free_url --value=$allow_free_url +ynh_app_setting_set --app=$app --key=require_free_url_authentication --value=$require_free_url_authentication #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/upgrade b/scripts/upgrade index 541592c..577b81f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,6 +27,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) 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_free_url=$(ynh_app_setting_get --app=$app --key=allow_free_url) +require_free_url_authentication=$(ynh_app_setting_get --app=$app --key=require_free_url_authentication) #================================================= # CHECK VERSION @@ -54,6 +55,11 @@ if [ -z "$allow_free_url" ]; then ynh_app_setting_set --app=$app --key=allow_free_url --value=$allow_free_url fi +if [ -z "$require_free_url_authentication" ]; then + require_free_url_authentication="false" + ynh_app_setting_set --app=$app --key=require_free_url_authentication --value=$require_free_url_authentication +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all