From b7022d1034e20e0eacca727a39bb4dd53c6711ce Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 18 May 2022 21:59:43 +0200 Subject: [PATCH 1/7] 0.2.29 --- conf/app.src | 4 ++-- manifest.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index f95ce56..425cd52 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/vector-im/hydrogen-web/releases/download/v0.2.28/hydrogen-web-0.2.28.tar.gz -SOURCE_SUM=01eac4c10a7c9dd61bc3817f24a3cd8fb095f2f9cb327bfb17af9b75372d3cc6 +SOURCE_URL=https://github.com/vector-im/hydrogen-web/releases/download/v0.2.29/hydrogen-web-0.2.29.tar.gz +SOURCE_SUM=84c4b895c23d4ae650c4030177539df7efb784fb573f7f6da29be97ca40c469e SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 5ecdf8a..11b3ab8 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Web client for Matrix", "fr": "Client web pour Matrix" }, - "version": "0.2.28~ynh1", + "version": "0.2.29~ynh1", "url": "https://matrix.org/docs/projects/client/hydrogen", "upstream": { "license": "Apache-2.0", From 996aac9302cec320fe2230a9bc0d9b40e7e114e6 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 18 May 2022 19:59:49 +0000 Subject: [PATCH 2/7] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 80e3a9a..19e212b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ A minimal Matrix chat client, focused on performance, offline functionality, and - Loading (unused) parts of the application after initial page load should be supported -**Shipped version:** 0.2.28~ynh1 +**Shipped version:** 0.2.29~ynh1 **Demo:** https://hydrogen.element.io/ diff --git a/README_fr.md b/README_fr.md index 81c1d5e..c2a4474 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ A minimal Matrix chat client, focused on performance, offline functionality, and - Loading (unused) parts of the application after initial page load should be supported -**Version incluse :** 0.2.28~ynh1 +**Version incluse :** 0.2.29~ynh1 **Démo :** https://hydrogen.element.io/ From bb0d62a02b8e77df4a57148005b23215494e1050 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 18 May 2022 22:11:31 +0200 Subject: [PATCH 3/7] Fix --- conf/config.sample.json | 15 ++ config_panel.toml.example | 296 +------------------------------------- manifest.json | 18 +-- scripts/install | 12 ++ scripts/upgrade | 7 + 5 files changed, 51 insertions(+), 297 deletions(-) create mode 100644 conf/config.sample.json diff --git a/conf/config.sample.json b/conf/config.sample.json new file mode 100644 index 0000000..c68c353 --- /dev/null +++ b/conf/config.sample.json @@ -0,0 +1,15 @@ +{ + "push": { + "appId": "io.element.hydrogen.web", + "gatewayUrl": "https://matrix.org", + "applicationServerKey": "BC-gpSdVHEXhvHSHS0AzzWrQoukv2BE7KzpoPO_FfPacqOo3l1pdqz7rSgmB04pZCWaHPz7XRe6fjLaC-WPDopM" + }, + "defaultHomeServer": "__DEFAULT_SERVER__", + "themeManifests": [ + "assets/theme-element.json" + ], + "defaultTheme": { + "light": "element-light", + "dark": "element-dark" + } +} \ No newline at end of file diff --git a/config_panel.toml.example b/config_panel.toml.example index c6bccd8..40f6987 100644 --- a/config_panel.toml.example +++ b/config_panel.toml.example @@ -1,295 +1,13 @@ - -## Config panel are available from webadmin > Apps > YOUR_APP > Config Panel Button -## Those panels let user configure some params on their apps using a friendly interface, -## and remove the need to manually edit files from the command line. - -## From a packager perspective, this .toml is coupled to the scripts/config script, -## which may be used to define custom getters/setters. However, most use cases -## should be covered automagically by the core, thus it may not be necessary -## to define a scripts/config at all! - -## ----------------------------------------------------------------------------- -## IMPORTANT: In accordance with YunoHost's spirit, please keep things simple and -## do not overwhelm the admin with tons of misunderstandable or advanced settings. -## ----------------------------------------------------------------------------- - -## The top level describe the entire config panels screen. - -## The version is a required property. -## Here a small reminder to associate config panel version with YunoHost version -## | Config | YNH | Config panel small change log | -## | ------ | --- | ------------------------------------------------------- | -## | 0.1 | 3.x | 0.1 config script not compatible with YNH >= 4.3 | -## | 1.0 | 4.3.x | The new config panel system with 'bind' property | version = "1.0" -## (optional) i18n property let you internationalize questions, however this feature -## is only available in core configuration panel (like yunohost domain config). -## So in app config panel this key is ignored for now, but you can internationalize -## by using a lang dictionary (see property name bellow) -# i18n = "prefix_translation_key" - -################################################################################ -#### ABOUT PANELS -################################################################################ - -## The next level describes web admin panels -## You have to choose an ID for each panel, in this example the ID is "main" -## Keep in mind this ID will be used in CLI to refer to your question, so choose -## something short and meaningfull. -## In the webadmin, each panel corresponds to a distinct tab / form [main] +name = "Hydrogen configuration" -## Define the label for your panel -## Internationalization works similarly to the 'description' and 'ask' questions in the manifest -# name.en = "Main configuration" -# name.fr = "Configuration principale" + [main.config] + name = "Configuration Options" -## (optional) If you need to trigger a service reload-or-restart after the user -## change a question in this panel, you can add your service in the list. -services = ["__APP__"] -# or services = ["nginx", "__APP__"] to also reload-or-restart nginx - -## (optional) This help properties is a short help displayed on the same line -## than the panel title but not displayed in the tab. -# help = "" - - ############################################################################ - #### ABOUT SECTIONS - ############################################################################ - - ## A panel is composed of one or several sections. - ## - ## Sections are meant to group questions together when they correspond to - ## a same subtopic. This impacts the rendering in terms of CLI prompts - ## and HTML forms - ## - ## You should choose an ID for your section, and prefix it with the panel ID - ## (Be sure to not make a typo in the panel ID, which would implicitly create - ## an other entire panel) - ## - ## We use the context of pepettes_ynh as an example, - ## which is a simple donation form app written in python, - ## and for which the admin will want to edit the configuration - [main.customization] - - ## (optional) Defining a proper title for sections is not mandatory - ## and depends on the exact rendering you're aiming for the CLI / webadmin - name = "" - - ## (optional) This help properties is a short help displayed on the same line - ## than the section title, meant to provide additional details - # help = "" - - ## (optional) As for panel, you can specify to trigger a service - ## reload-or-restart after the user change a question in this section. - ## This property is added to the panel property, it doesn't deactivate it. - ## So no need to replicate, the service list from panel services property. - # services = [] - - ## (optional) By default all questions are optionals, but you can specify a - ## default behaviour for question in the section - optional = false - - ## (optional) It's also possible with the 'visible' property to only - ## display the section depending on the user's answers to previous questions. - ## - ## Be careful that the 'visible' property should only refer to **previous** questions - ## Hence, it should not make sense to have a "visible" property on the very first section. - ## - ## Also, keep in mind that this feature only works in the webadmin and not in CLI - ## (therefore a user could be prompted in CLI for a question that may not be relevant) - # visible = true - - ######################################################################## - #### ABOUT QUESTIONS - ######################################################################## - - ## A section is compound of one or several questions. - - ## --------------------------------------------------------------------- - ## IMPORTANT: as for panel and section you have to choose an ID, but this - ## one should be unique in all this document, even if the question is in - ## an other panel. - ## --------------------------------------------------------------------- - - ## You can use same questions types and properties than in manifest.yml - ## install part. However, in YNH 4.3, a lot of change has been made to - ## extend availables questions types list. - ## See: TODO DOC LINK - - [main.customization.project_name] - - ## (required) The ask property is equivalent to the ask property in - ## the manifest. However, in config panels, questions are displayed on the - ## left side and therefore have less space to be rendered. Therefore, - ## it is better to use a short question, and use the "help" property to - ## provide additional details if necessary. - ask.en = "Name of the project" - - ## (required) The type property indicates how the question should be - ## displayed, validated and managed. Some types have specific properties. - ## - ## Types available: string, boolean, number, range, text, password, path - ## email, url, date, time, color, select, domain, user, tags, file. - ## - ## For a complete list with specific properties, see: TODO DOC LINK + [main.config.default_server] + ask = "Set default server" type = "string" - - ######################################################################## - #### ABOUT THE BIND PROPERTY - ######################################################################## - - ## (recommended) 'bind' property is a powerful feature that let you - ## configure how and where the data will be read, validated and written. - - ## By default, 'bind property is in "settings" mode, it means it will - ## **only** read and write the value in application settings file. - ## bind = "settings" - - ## However, settings usually correspond to key/values in actual app configurations - ## Hence, a more useful mode is to have bind = ":FILENAME". In that case, YunoHost - ## will automagically find a line with "KEY=VALUE" in FILENAME - ## (with the adequate separator between KEY and VALUE) - ## - ## YunoHost will then use this value for the read/get operation. - ## During write/set operations, YunoHost will overwrite the value - ## in **both** FILENAME and in the app's settings.yml - - ## Configuration file format supported: yaml, toml, json, ini, env, php, - ## python. The feature probably works with others formats, but should be tested carefully. - - ## Note that this feature only works with relatively simple cases - ## such as `KEY: VALUE`, but won't properly work with - ## complex data structures like multilin array/lists or dictionnaries. - ## It also doesn't work with XML format, custom config function call, php define(), ... - - ## More info on TODO - # bind = ":/var/www/__APP__/settings.py" - - - ## By default, bind = ":FILENAME" will use the question ID as KEY - ## ... but the question ID may sometime not be the exact KEY name in the configuration file. - ## - ## In particular, in pepettes, the python variable is 'name' and not 'project_name' - ## (c.f. https://github.com/YunoHost-Apps/pepettes_ynh/blob/5cc2d3ffd6529cc7356ff93af92dbb6785c3ab9a/conf/settings.py##L11 ) - ## - ## In that case, the key name can be specified before the column ':' - - bind = "name:/var/www/__APP__/settings.py" - - ## --------------------------------------------------------------------- - ## IMPORTANT: other 'bind' mode exists: - ## - ## bind = "FILENAME" (with no column character before FILENAME) - ## may be used to bind to the **entire file content** (instead of a single KEY/VALUE) - ## This could be used to expose an entire configuration file, or binary files such as images - ## For example: - ## bind = "/var/www/__APP__/img/logo.png" - ## - ## bind = "null" can be used to disable reading / writing in settings. - ## This creates sort of a "virtual" or "ephemeral" question which is not related to any actual setting - ## In this mode, you are expected to define custom getter/setters/validators in scripts/config: - ## - ## getter: get__QUESTIONID() - ## setter: set__QUESTIONID() - ## validator: validate__QUESTIONID() - ## - ## You can also specify a common getter / setter / validator, with the - ## function 'bind' mode, for example here it will try to run - ## get__array_settings() first. - # bind = "array_settings()" - ## --------------------------------------------------------------------- - - ## --------------------------------------------------------------------- - ## IMPORTANT: with the exception of bind=null questions, - ## question IDs should almost **always** correspond to an app setting - ## initialized / reused during install/upgrade. - ## Not doing so may result in inconsistencies between the config panel mechanism - ## and the use of ynh_add_config - ## --------------------------------------------------------------------- - - ######################################################################## - #### OTHER GENERIC PROPERTY FOR QUESTIONS - ######################################################################## - - ## (optional) An help text for the question - help = "Fill the name of the project which will received donation" - - ## (optional) An example display as placeholder in web form - # example = "YunoHost" - - ## (optional) set to true in order to redact the value in operation logs - # redact = false - - ## (optional) A validation pattern - ## --------------------------------------------------------------------- - ## IMPORTANT: your pattern should be between simple quote, not double. - ## --------------------------------------------------------------------- - pattern.regexp = '^\w{3,30}$' - pattern.error = "The name should be at least 3 chars and less than 30 chars. Alphanumeric chars are accepted" - - ## Note: visible and optional properties are also available for questions - - - [main.customization.contact_url] - ask = "Contact url" - type = "url" - example = "mailto: contact@example.org" - help = "mailto: accepted" - pattern.regexp = '^mailto:[^@]+@[^@]+|https://$' - pattern.error = "Should be https or mailto:" - bind = ":/var/www/__APP__/settings.py" - - [main.customization.logo] - ask = "Logo" - type = "file" - accept = ".png" - help = "Fill with an already resized logo" - bind = "__FINALPATH__/img/logo.png" - - [main.customization.favicon] - ask = "Favicon" - type = "file" - accept = ".png" - help = "Fill with an already sized favicon" - bind = "__FINALPATH__/img/favicon.png" - - - [main.stripe] - name = "Stripe general info" - optional = false - - # The next alert is overwrited with a getter from the config script - [main.stripe.amount] - ask = "Donation in the month : XX € - type = "alert" - style = "success" - - [main.stripe.publishable_key] - ask = "Publishable key" - type = "string" - redact = true - help = "Indicate here the stripe publishable key" - bind = ":/var/www/__APP__/settings.py" - - [main.stripe.secret_key] - ask = "Secret key" - type = "string" - redact = true - help = "Indicate here the stripe secret key" - bind = ":/var/www/__APP__/settings.py" - - [main.stripe.prices] - ask = "Prices ID" - type = "tags" - help = """\ - Indicates here the prices ID of donation products you created in stripe interfaces. \ - Go on [Stripe products](https://dashboard.stripe.com/products) to create those donation products. \ - Fill it tag with 'FREQUENCY/CURRENCY/PRICE_ID' \ - FREQUENCY: 'one_time' or 'recuring' \ - CURRENCY: 'EUR' or 'USD' \ - PRICE_ID: ID from stripe interfaces starting with 'price_' \ - """ - pattern.regexp = '^(one_time|recuring)/(EUR|USD)/price_.*$' - pattern.error = "Please respect the format describe in help text for each price ID" + help = "Choose a default server" + bind = "defaultHomeServer:__FINALPATH__/config.json" \ No newline at end of file diff --git a/manifest.json b/manifest.json index 11b3ab8..2f413c1 100644 --- a/manifest.json +++ b/manifest.json @@ -28,14 +28,6 @@ ], "arguments": { "install" : [ - { - "name": "warning", - "type": "display_text", - "ask": { - "en": "Hydrogen is still in beta phase.", - "fr": "Hydrogen est encore en phase bêta." - } - }, { "name": "domain", "type": "domain" @@ -46,6 +38,16 @@ "example": "/hydrogen", "default": "/hydrogen" }, + { + "name": "default_server", + "type": "string", + "ask": { + "en": "Choose a default server", + "fr": "Choisissez un serveur par défault" + }, + "example": "my-matrix-server.tld", + "default": "matrix.org" + }, { "name": "is_public", "type": "boolean", diff --git a/scripts/install b/scripts/install index 621422c..d13b84e 100755 --- a/scripts/install +++ b/scripts/install @@ -27,6 +27,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC +default_server=$YNH_APP_ARG_DEFAULT_SERVER app=$YNH_APP_INSTANCE_NAME @@ -48,6 +49,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 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=default_server --value=$default_server #================================================= # STANDARD MODIFICATIONS @@ -89,6 +91,16 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="../conf/config.sample.json" --destination="$final_path/config.json" + +chmod 400 "$final_path/config.json" +chown $app:$app "$final_path/config.json" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 703b4c4..ca6851a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +default_server=$(ynh_app_setting_get --app=$app --key=default_server) #================================================= # CHECK VERSION @@ -54,6 +55,12 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# If default_server doesn't exist, create it +if [ -z "$default_server" ]; then + default_server="matrix.org" + ynh_app_setting_set --app=$app --key=default_server --value=$default_server +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all From efe822406700e1b22e4609890eb61b6466cab925 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 18 May 2022 22:15:20 +0200 Subject: [PATCH 4/7] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index d13b84e..29358af 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/config.sample.json" --destination="$final_path/config.json" -chmod 400 "$final_path/config.json" +chmod 650 "$final_path/config.json" chown $app:$app "$final_path/config.json" #================================================= From c7d2b2a82e9b754b50f491f61f9668ed073202a9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 19 May 2022 08:57:02 +0200 Subject: [PATCH 5/7] Fix --- config_panel.toml.example => config_panel.toml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename config_panel.toml.example => config_panel.toml (100%) diff --git a/config_panel.toml.example b/config_panel.toml similarity index 100% rename from config_panel.toml.example rename to config_panel.toml From 0858c05ec018381e1286530bff9c8b25ef863948 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 19 May 2022 09:00:56 +0200 Subject: [PATCH 6/7] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 29358af..4e184a2 100755 --- a/scripts/install +++ b/scripts/install @@ -98,8 +98,8 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/config.sample.json" --destination="$final_path/config.json" -chmod 650 "$final_path/config.json" -chown $app:$app "$final_path/config.json" +chmod 660 "$final_path/config.json" +chown $app:www-data "$final_path/config.json" #================================================= # GENERIC FINALIZATION From 616024f60b89be87f063307d2f4cb5c0389e5841 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 19 May 2022 09:04:16 +0200 Subject: [PATCH 7/7] Update config_panel.toml --- config_panel.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_panel.toml b/config_panel.toml index 40f6987..c6f792f 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -9,5 +9,5 @@ name = "Hydrogen configuration" [main.config.default_server] ask = "Set default server" type = "string" - help = "Choose a default server" + help = "Choose a default Matrix server" bind = "defaultHomeServer:__FINALPATH__/config.json" \ No newline at end of file