From 305be90bbfdad3c19b1a69c7be45c8c02e13090f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:17:58 +0100 Subject: [PATCH] Testing (#51) * Small fixes * 1.7.0 (#4) * Upgrde to v.1.7.0 * Set requirements to 3.8.1 * Update README.md * Upgrade to 1.7.1 (#6) * Add limitations * Avoid to buid frontend bundle * Remove PostegrSQL warning * Update README.md Add you should reload service for changes in config to be registered. * Add restart systemd tuto * Change version * Finding an available port * Upgrade to version 1.7.2 (#12) * Patch (#17) * Cleaning up * Update manifest.json * Cleaning up * Secure config file * Remove yarn * Update change_url * Update change_url * Revert "Remove yarn" This reverts commit a8cabf0c0addf8f9c4569b27ae04512db5c93df0. * Update change_url * Update systemd.service * Update systemd.service * Cleaning up * Fix * fix badges * Upgrade to version 1.8.0 (#21) * Upgrade to version 1.8.0 * Upgrade to 1.8.0 * Upgrade to 1.8.0 * Upgrade to version 1.8.1 * [autopatch] Update issue and PR templates (#25) Co-authored-by: Yunohost-Bot <> * Add templates * Upgrade to 1.8.2 * Update check_process * Add templates * Auto-update README * Set new requirements (#28) * Fix * Simplify config * Auto-update README Co-authored-by: Yunohost-Bot <> * Update manifest.json * Auto-update README * 1.9.0 (#31) * 1.9.0 * Update manifest.json * Auto-update README * Systemd hardening (#33) * Update systemd.service * Update app.src * Update manifest.json * 1.9.1 (#34) * Upgrade to 1.9.1 * 1.9.2 (#36) * Remove replace_string * Fix (#39) * Update manifest.json * Auto-update README * Update config.json.example * Update config.json.example * 1.9.3 * Auto-update README * 1.9.4 (#42) * 1.9.4 * Auto-update README Co-authored-by: yunohost-bot * Auto-update README * Update manifest.json * Update _common.sh * set relative path for --keep opt * Update manifest.json * Auto-update README * 1.9.5 * Auto-update README * 1.9.6 * Auto-update README * Add more security as default (#47) * Add more security as default * Auto-update README * Update config.json.example * Update change_url Co-authored-by: yunohost-bot * Update manifest.json * Auto-update README * Update install Co-authored-by: Eauchat <34686393+eauchat@users.noreply.github.com> Co-authored-by: Alexandre Aubin Co-authored-by: YunoHost Bot Co-authored-by: Yunohost-Bot <> Co-authored-by: yunohost-bot Co-authored-by: yalh76 --- README.md | 2 +- README_fr.md | 2 +- conf/config.json.example | 3 ++- config_panel.toml.example | 24 ++++++++++++++++++++++++ manifest.json | 2 +- scripts/change_url | 3 +++ scripts/install | 6 ++++++ scripts/upgrade | 13 +++++++++++++ 8 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 config_panel.toml.example diff --git a/README.md b/README.md index 55b5376..f9cfdf8 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Easy to use permission system - Low system requirements -**Shipped version:** 1.9.6~ynh1 +**Shipped version:** 1.9.6~ynh2 **Demo:** https://demo.hedgedoc.org/ diff --git a/README_fr.md b/README_fr.md index 4e4b558..106324b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -28,7 +28,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Easy to use permission system - Low system requirements -**Version incluse :** 1.9.6~ynh1 +**Version incluse :** 1.9.6~ynh2 **Démo :** https://demo.hedgedoc.org/ diff --git a/conf/config.json.example b/conf/config.json.example index 5b9bfe1..7b30ba4 100644 --- a/conf/config.json.example +++ b/conf/config.json.example @@ -8,10 +8,11 @@ "useCDN": false, "allowGravatar": false, "allowFreeURL": false, + "allowAnonymous": __ALLOW_ANONYMOUS__, "allowAnonymousEdits": true, "defaultPermission": "locked", "email": true, - "allowEmailRegister": true, + "allowEmailRegister": __ALLOW_EMAIL_REGISTRATION__, "imageUploadType": "filesystem", "tooBusyLag": 1000, "hsts": { diff --git a/config_panel.toml.example b/config_panel.toml.example new file mode 100644 index 0000000..e784143 --- /dev/null +++ b/config_panel.toml.example @@ -0,0 +1,24 @@ +version = "1.0" + +[main] +name = "HedgeDoc configuration" + + [main.config] + name = "Configuration Options" + + [main.config.allow_anonymous] + ask = "Allow anonymous usage" + type = "boolean" + yes = "true" + no = "false" + help = "Set to allow anonymous usage (default is true)." + bind = "allow_anonymous:__FINALPATH__/config.json" + + [main.config.allow_email_registration] + ask = "Allow email registration" + type = "boolean" + yes = "true" + no = "false" + 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" + diff --git a/manifest.json b/manifest.json index 8d12a2c..a38fa58 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Collaborative editor to work on notes written in Markdown", "fr": "Éditeur collaboratif pour travailler sur des notes en Markdown" }, - "version": "1.9.6~ynh1", + "version": "1.9.6~ynh2", "url": "https://hedgedoc.org", "upstream": { "license": "AGPL-3.0-only", diff --git a/scripts/change_url b/scripts/change_url index a9c8a53..5fd09f8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -33,6 +33,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name 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) + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= diff --git a/scripts/install b/scripts/install index 6b71a53..ed5aea4 100644 --- a/scripts/install +++ b/scripts/install @@ -29,6 +29,9 @@ is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME +allow_anonymous=false +allow_email_registration=false + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -47,6 +50,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 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=allow_anonymous --value=$allow_anonymous +ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration #================================================= # STANDARD MODIFICATIONS @@ -121,6 +126,7 @@ ynh_script_progression --message="Building HedgeDoc... (this will take some time pushd "$final_path" ynh_use_nodejs + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean bin/setup popd diff --git a/scripts/upgrade b/scripts/upgrade index 4041836..d0f97ad 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name 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) + #================================================= # CHECK VERSION #================================================= @@ -35,6 +38,16 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +if [ -z "$allow_anonymous" ]; then + allow_anonymous="false" + ynh_app_setting_set --app=$app --key=allow_anonymous --value=$allow_anonymous +fi + +if [ -z "$allow_email_registration" ]; then + allow_email_registration="false" + ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all