From dac54950af5cd615b1ac40f1f372637a667e3857 Mon Sep 17 00:00:00 2001 From: Dante Date: Mon, 3 Oct 2022 15:39:39 +0100 Subject: [PATCH 01/46] Add config panel with few config options and user management --- config_panel.toml | 111 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/config | 92 ++++++++++++++++++++++++++++++++++++++ scripts/install | 4 ++ 3 files changed, 207 insertions(+) create mode 100644 config_panel.toml create mode 100644 scripts/config diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..e0ba6e8 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,111 @@ +version = "1.0" + +[main] +name = "General configuration" +services = ["__APP__"] + + [main.config] + name = "Configuration options" + + [main.config.botname] + ask = "Set a bot name for the bridge puppet" + type = "string" + help = "Sets bot username. Please keep in mind that the bot admin room for previous bot username will stop working so you may need to create a new one using the new username" + + [main.config.log_level] + ask = "Sets log level of the application" + choices = ["debug", "info", "warn", "error", "fatal"] + default = "info" + bind = "logging>print_level:__FINALPATH__/config.yaml" + +[encryption] +name = "Encryption" +services = ["__APP__"] + [encryption.config] + name = "Encryption settings" + + [encryption.config.encryption] + ask = "Enable encryption" + type = "boolean" + yes = "true" + no = "false" + help = "Enables end to bridge encryption" + bind = "encryption>allow:__FINALPATH__/config.yaml" + + [encryption.config.default_encryption] + ask = "Default encryption" + type = "boolean" + yes = "true" + no = "false" + help = "Force-enable encryption in all portals the bridge creates. This will cause the bridge bot to be in private chats for the encryption to work properly." + bind = "encryption>default:__FINALPATH__/config.yaml" + + [encryption.config.require_encryption] + ask = "Require encryption" + type = "boolean" + yes = "true" + no = "false" + help = "Require encryption, drop any unencrypted messages." + bind = "encryption>require:__FINALPATH__/config.yaml" + +[usermanagement] +name = "User management" +services = ["__APP__"] + + [usermanagement.config] + name = "User management" + + [usermanagement.config.helptext] + ask = "Allowed values:\n  * - All Matrix users\n  domain - All users on that homeserver\n  mxid (@user:matrix.org) - Specific Matrix user\n  username - Specific local user" + type = "markdown" + + [usermanagement.config.listuser] + ask = "Users" + type = "tags" + visible = "role == 'user'" + + [usermanagement.config.listadmin] + ask = "Admins" + type = "tags" + visible = "role == 'admin'" + + [usermanagement.config.listrelay] + ask = "Relay users" + type = "tags" + visible = "role == 'relay'" + + [usermanagement.config.role] + ask = "Role" + type = "select" + choices = ["user", "admin", "relay"] + +[privacy] +name = "Privacy" +services = ["__APP__"] + + [privacy.config] + name = "Privacy settings" + + [privacy.config.delivery_receipts] + ask = "Delivery receipts" + type = "boolean" + yes = "true" + no = "false" + help = "Should the bridge send a read receipt from the bridge bot when a message has been sent to WhatsApp?" + bind = "bridge>delivery_receipts:__FINALPATH__/config.yaml" + + [privacy.config.send_presence_on_typing] + ask = "Send presence on typing" + type = "boolean" + yes = "true" + no = "false" + help = "Send the presence as 'available' to whatsapp when users start typing on a portal." + bind = "bridge>send_presence_on_typing:__FINALPATH__/config.yaml" + + [privacy.config.url_previews] + ask = "URL previews" + type = "boolean" + yes = "true" + no = "false" + help = "Should the bridge detect URLs in outgoing messages, ask the homeserver to generate a preview, and send it to WhatsApp?" + bind = "bridge>url_previews:__FINALPATH__/config.yaml" diff --git a/scripts/config b/scripts/config new file mode 100644 index 0000000..dbe4b5a --- /dev/null +++ b/scripts/config @@ -0,0 +1,92 @@ +#!/bin/bash +source /usr/share/yunohost/helpers +ynh_abort_if_errors + +final_path=$(ynh_app_setting_get --app=$app --key=final_path) + +function get__encryption { + encryption=$(ynh_app_setting_get --app $app --key encryption) + echo "'${encryption}'" +} + +function get__botname { + botname=$(ynh_app_setting_get --app $app --key botname) + echo "${botname}" +} + +function set__botname { + old_botname=$(ynh_app_setting_get --app $app --key botname) + if [ "$botname" -eq "$old_botname" ] # Check to avoid updating botname when it's not needed. + then + return + fi + + ynh_app_setting_set --app=$app --key=botname --value="$botname" + synapse_instance=$(ynh_app_setting_get --app $app --key synapse_instance) + + sed -i "s/username:.*/username: $botname/" "$final_path/config.yaml" + "$final_path/mautrix-whatsapp" -g -c "$final_path/config.yaml" -r "/etc/matrix-$synapse_instance/app-service/$app.yaml" + "/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh" || ynh_die --message="Synapse can't restart with the appservice configuration" + chown -R "$app:$app" "$final_path" + ynh_store_file_checksum --file="/etc/matrix-$synapse_instance/app-service/$app.yaml" + ynh_store_file_checksum --file="$final_path/config.yaml" +} + +function get__listuser { + existingUsers=$(grep -- "\".*: user" "$final_path/config.yaml" | sed -r 's/: user//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',') + + cat < Date: Tue, 4 Oct 2022 18:00:46 +0100 Subject: [PATCH 02/46] Better handling of special chars like * --- scripts/config | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/config b/scripts/config index dbe4b5a..1e3a10d 100644 --- a/scripts/config +++ b/scripts/config @@ -64,27 +64,29 @@ EOF } function set__role { + set -o noglob # Disable globbing to avoid expansions when passing * as value. declare values="list$role" newValues="${!values}" # Here we expand the dynamic variable we created in the previous line. ! Does the trick usersArray=(${newValues//,/ }) # Split the values using comma (,) as separator. - if [ -n "${!values}" ] + if [ -n "$newValues" ] then ynh_systemd_action --service_name="$app" --action=stop # Get all entries between "permissions:" and "relay:" keys, remove the role part, remove commented parts, format it with newlines and clean whitespaces and double quotes. - allDefinedEntries=$(awk '/permissions:/{flag=1; next} /relay:/{flag=0} flag' "$final_path/config.yaml" | sed -r 's/: (admin|user|relay)//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr ',' '\n' ) + allDefinedEntries=$(awk '/permissions:/{flag=1; next} /relay:/{flag=0} flag' "$final_path/config.yaml" | sed "/: $role/d" | sed -r 's/: (admin|user|relay)//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr ',' '\n' ) # Delete everything from the corresponding role to insert the new defined values. This way we also handle deletion of users. - sed -i "/permissions:/,/relay:/{/: ${role}/d;}" "$final_path/config.yaml" + sed -i "/permissions:/,/relay:/{/: $role/d;}" "$final_path/config.yaml" for user in "${usersArray[@]}" do - if echo "$allDefinedEntries" | grep -q -E "^${user}$" + if grep -q -x "${user}" <<< "$allDefinedEntries" then ynh_print_info "User $user already defined in another role." else - sed -i "/permissions:/a \ \\\"${user}\": ${role}" "$final_path/config.yaml" # Whitespaces are needed so that the file can be correctly parsed + sed -i "/permissions:/a \ \\\"$user\": $role" "$final_path/config.yaml" # Whitespaces are needed so that the file can be correctly parsed fi done fi + set +o noglob ynh_print_info "Users with role $role added in $final_path/config.yaml" } From f0b9772e47d537f79f06a1633a4c85cbf94d06c0 Mon Sep 17 00:00:00 2001 From: Dante Date: Fri, 9 Dec 2022 10:24:55 +0100 Subject: [PATCH 03/46] WIP expose more config options --- config_panel.toml | 107 +++++++++++++++++++++++++++++++++++++++++----- scripts/config | 10 +++++ 2 files changed, 107 insertions(+), 10 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index e0ba6e8..aab35ad 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -1,22 +1,109 @@ version = "1.0" -[main] -name = "General configuration" +[homeserver] +name = "Homeserver configuration" services = ["__APP__"] - [main.config] + [homeserver.config] name = "Configuration options" - [main.config.botname] - ask = "Set a bot name for the bridge puppet" + [homeserver.config.async_media] + ask = "Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246?" + type = "boolean" + yes = "true" + no = "false" + help = "Enables asynchronous media uploads" + bind = "homeserver>async_media:__FINALPATH__/config.yaml" + +[appservice] +name = "Application service configuration" +services = ["__APP__"] + + [appservice.config] + name = "General configuration" + + [appservice.config.ephemeral_events] + ask = "Whether or not to receive ephemeral events via appservice transactions" + type = "boolean" + yes = "true" + no = "false" + help = "Requires MSC2409 support (i.e. Synapse 1.22+). You should disable bridge -> sync_with_custom_puppets when this is enabled" + bind = "appservice>ephemeral_events:__FINALPATH__/config.yaml" + + [appservice.bot] + name = "Appservice bot configuration" + + [appservice.bot.botname] + ask = "Username of the appservice bot" type = "string" help = "Sets bot username. Please keep in mind that the bot admin room for previous bot username will stop working so you may need to create a new one using the new username" - [main.config.log_level] - ask = "Sets log level of the application" - choices = ["debug", "info", "warn", "error", "fatal"] - default = "info" - bind = "logging>print_level:__FINALPATH__/config.yaml" + [appservice.bot.displayname] + ask = "Display name for bot" + type = "string" + help = "Set to 'remove' to remove display name, leave empty to leave display name as-is" + + [appservice.bot.avatar] + ask = "Avatar for bot" + type = "string" + help = "Set to 'remove' to remove avatar, leave empty to leave avatar as-is" + +[metrics] +name = "Prometheus configuration" +services = ["__APP__"] + + [metrics.config] + name = "General configuration" + + [metrics.config.enabled] + ask = "Enable prometheus metrics" + type = "boolean" + yes = "true" + no = "false" + bind = "metrics>enabled:__FINALPATH__/config.yaml" + + [metrics.config.listen] + ask = "IP and port where the metrics listener should be" + type = "string" + default = "127.0.0.1:8001" + help = "The path is always /metrics" + bind = "metrics>listen:__FINALPATH__/config.yaml" + +[whatsapp] +name = "Whatsapp configuration" +help = "Configuration for things that are directly sent to WhatsApp" +services = ["__APP__"] + + [whatsapp.config] + name = "General configuration" + + [whatsapp.config.os_name] + ask = "Device name that's shown in the 'WhatsApp Web' section in the mobile app" + type = "string" + default = "Mautrix-WhatsApp bridge" + bind = "whatsapp>os_name:__FINALPATH__/config.yaml" + + [whatsapp.config.browser_name] + ask = "Browser name that determines the logo shown in the mobile app" + type = "select" + choices = ["unknown", "chrome", "firefox", "ie", "opera", "safari", "edge", "desktop", "ipad", "android_tablet", "ohana", "aloha", "catalina", "tcl_tv"] + default = "unknown" + help = "Must be 'unknown' for a generic icon or a valid browser name if you want a specific icon" + bind = "whatsapp>browser_name:__FINALPATH__/config.yaml" + +[bridge] +name = "Bridge configuration" +services = ["__APP__"] + + [bridge.config] + name = "General configuration" + + [bridge.config.username_template] + ask = "Localpart template of MXIDs for WhatsApp users" + type = "string" + default = "whatsapp_{{.}}" + help = "{{.}} is replaced with the phone number of the WhatsApp user" + bind = "bridge>username_template:__FINALPATH__/config.yaml" [encryption] name = "Encryption" diff --git a/scripts/config b/scripts/config index 1e3a10d..9737fbc 100644 --- a/scripts/config +++ b/scripts/config @@ -14,6 +14,16 @@ function get__botname { echo "${botname}" } +function get__displayname { + displayname="WhatsApp bridge bot" + echo "${displayname}" +} + +function get__avatar { + avatar="mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr" + echo "${avatar}" +} + function set__botname { old_botname=$(ynh_app_setting_get --app $app --key botname) if [ "$botname" -eq "$old_botname" ] # Check to avoid updating botname when it's not needed. From f58912baed3eb725908b0239cc2d13bb384b74d2 Mon Sep 17 00:00:00 2001 From: Gredin 67 Date: Thu, 5 Jan 2023 03:57:04 +0100 Subject: [PATCH 04/46] add __foobar__ settings --- conf/config.yaml | 38 ++++++++++++++++---------------- scripts/config | 15 ------------- scripts/install | 56 ++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 71 insertions(+), 38 deletions(-) diff --git a/conf/config.yaml b/conf/config.yaml index 792868c..1137f15 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -15,7 +15,7 @@ homeserver: # Endpoint for reporting per-message status. message_send_checkpoint_endpoint: null # Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246? - async_media: false + async_media: __ASYNC_MEDIA__ # Application service host/registration related details. # Changing these values requires regeneration of the registration. @@ -52,16 +52,16 @@ appservice: bot: # Username of the appservice bot. #username: whatsappbot - username: __BOTNAME__ + username: __USERNAME__ # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty # to leave display name/avatar as-is. - displayname: WhatsApp bridge bot - avatar: mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr + displayname: __DISPLAYNAME__ + avatar: __AVATAR__ # Whether or not to receive ephemeral events via appservice transactions. # Requires MSC2409 support (i.e. Synapse 1.22+). # You should disable bridge -> sync_with_custom_puppets when this is enabled. - ephemeral_events: true + ephemeral_events: __EPHEMERAL_EVENTS__ # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify. as_token: "This value is generated when generating the registration" @@ -73,24 +73,24 @@ segment_key: null # Prometheus config. metrics: # Enable prometheus metrics? - enabled: false + enabled: __METRICS_ENABLED__ # IP and port where the metrics listener should be. The path is always /metrics - listen: 127.0.0.1:8001 + listen: __LISTEN__ # Config for things that are directly sent to WhatsApp. whatsapp: # Device name that's shown in the "WhatsApp Web" section in the mobile app. - os_name: Mautrix-WhatsApp bridge + os_name: __OS_NAME__ # Browser name that determines the logo shown in the mobile app. # Must be "unknown" for a generic icon or a valid browser name if you want a specific icon. # List of valid browser names: https://github.com/tulir/whatsmeow/blob/8b34d886d543b72e5f4699cf5b2797f68d598f78/binary/proto/def.proto#L38-L51 - browser_name: unknown + browser_name: __BROWSER_NAME__ # Bridge config bridge: # Localpart template of MXIDs for WhatsApp users. # {{.}} is replaced with the phone number of the WhatsApp user. - username_template: whatsapp_{{.}} + username_template: __USERNAME_TEMPLATE__ # Displayname template for WhatsApp users. # {{.PushName}} - nickname set by the WhatsApp user # {{.BusinessName}} - validated WhatsApp business name @@ -101,9 +101,9 @@ bridge: displayname_template: "{{if .BusinessName}}{{.BusinessName}}{{else if .PushName}}{{.PushName}}{{else}}{{.JID}}{{end}} (WA)" # Should the bridge create a space for each logged-in user and add bridged rooms to it? # Users who logged in before turning this on should run `!wa sync space` to create and fill the space for the first time. - personal_filtering_spaces: false + personal_filtering_spaces: __PERSONAL_FILTERING_SPACES__ # Should the bridge send a read receipt from the bridge bot when a message has been sent to WhatsApp? - delivery_receipts: false + delivery_receipts: __DELIVERY_RECEIPTS__ # Whether the bridge should send the message status as a custom com.beeper.message_send_status event. message_status_events: false # Whether the bridge should send error notices via m.notice events when a message fails to bridge. @@ -220,7 +220,7 @@ bridge: # Send the presence as "available" to whatsapp when users start typing on a portal. # This works as a workaround for homeservers that do not support presence, and allows # users to see when the whatsapp user on the other side is typing during a conversation. - send_presence_on_typing: false + send_presence_on_typing: __SEND_PRESENCE_ON_TYPING__ # Should the bridge always send "active" delivery receipts (two gray ticks on WhatsApp) # even if the user isn't marked as online (e.g. when presence bridging isn't enabled)? # @@ -292,7 +292,7 @@ bridge: # Should the bridge detect URLs in outgoing messages, ask the homeserver to generate a preview, # and send it to WhatsApp? URL previews can always be sent using the `com.beeper.linkpreviews` # key in the event content even if this is disabled. - url_previews: false + url_previews: __URL_PREVIEWS__ # Send captions in the same message as images. This will send data compatible with both MSC2530 and MSC3552. # This is currently not supported in most clients. caption_in_message: false @@ -334,11 +334,11 @@ bridge: # Default to encryption, force-enable encryption in all portals the bridge creates # This will cause the bridge bot to be in private chats for the encryption to work properly. # It is recommended to also set private_chat_portal_meta to true when using this. - default: false + default: __DEFAULT__ # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data. appservice: false # Require encryption, drop any unencrypted messages. - require: false + require: __REQUIRE__ # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled. # You must use a client that supports requesting keys from other users to use this feature. allow_key_sharing: false @@ -406,9 +406,9 @@ bridge: # Whether relay mode should be allowed. If allowed, `!wa set-relay` can be used to turn any # authenticated user into a relaybot for that chat. #enabled: false - enabled: true + enabled: __ENABLED__ # Should only admins be allowed to set themselves as relay users? - admin_only: true + admin_only: __ADMIN_ONLY__ # The formats to use when sending messages to WhatsApp via the relaybot. message_formats: m.text: "{{ .Sender.Displayname }}: {{ .Message }}" @@ -437,4 +437,4 @@ logging: timestamp_format: "Jan _2, 2006 15:04:05" # Minimum severity for log messages printed to stdout/stderr. This doesn't affect the log file. # Options: debug, info, warn, error, fatal - print_level: INFO + print_level: __PRINT_LEVEL__ diff --git a/scripts/config b/scripts/config index 9737fbc..caf3da0 100644 --- a/scripts/config +++ b/scripts/config @@ -4,26 +4,11 @@ ynh_abort_if_errors final_path=$(ynh_app_setting_get --app=$app --key=final_path) -function get__encryption { - encryption=$(ynh_app_setting_get --app $app --key encryption) - echo "'${encryption}'" -} - function get__botname { botname=$(ynh_app_setting_get --app $app --key botname) echo "${botname}" } -function get__displayname { - displayname="WhatsApp bridge bot" - echo "${displayname}" -} - -function get__avatar { - avatar="mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr" - echo "${avatar}" -} - function set__botname { old_botname=$(ynh_app_setting_get --app $app --key botname) if [ "$botname" -eq "$old_botname" ] # Check to avoid updating botname when it's not needed. diff --git a/scripts/install b/scripts/install index 7e0ce63..235be0a 100755 --- a/scripts/install +++ b/scripts/install @@ -25,7 +25,7 @@ ynh_abort_if_errors appserviceid=$YNH_APP_INSTANCE_NAME synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER -botname=$YNH_APP_ARG_BOTNAME +username=$YNH_APP_ARG_BOTNAME bot_synapse_adm=$YNH_APP_ARG_BOT_SYNAPSE_ADM encryption=$YNH_APP_ARG_ENCRYPTION botadmin=$YNH_APP_ARG_BOTADMIN @@ -49,6 +49,54 @@ server_name=$(ynh_app_setting_get --app $synapse_instance --key server_name) domain=$(ynh_app_setting_get --app $synapse_instance --key domain) synapse_db_name="matrix_$synapse_instance" +#================================================= +# SET STANDARD SETTINGS FROM DEFAULT CONFIG +#================================================= + +async_media="false" +displayname="WhatsApp bridge bot" +avatar="mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr" +ephemeral_events="true" +metrics_enabled="false" +listen="127.0.0.1:8001" +os_name="Mautrix-WhatsApp bridge" +browser_name="unknown" +username_template="whatsapp_{{.}}" +personal_filtering_spaces="false" +delivery_receipts="false" +send_presence_on_typing="false" +url_previews="false" +default="false" +require="false" +enabled="true" +admin_only="true" +print_level="INFO" +existingUsers=$botusers +existingAdmins=$botadmin +existingRelayUsers="*" + +ynh_app_setting_set --app=$app --key=async_media --value=$async_media +ynh_app_setting_set --app=$app --key=displayname --value=$displayname +ynh_app_setting_set --app=$app --key=avatar --value=$avatar +ynh_app_setting_set --app=$app --key=ephemeral_events --value=$ephemeral_events +ynh_app_setting_set --app=$app --key=metrics_enabled --value=$metrics_enabled +ynh_app_setting_set --app=$app --key=listen --value=$listen +ynh_app_setting_set --app=$app --key=os_name --value=$os_name +ynh_app_setting_set --app=$app --key=browser_name --value=$browser_name +ynh_app_setting_set --app=$app --key=username_template --value=$username_template +ynh_app_setting_set --app=$app --key=personal_filtering_spaces --value=$personal_filtering_spaces +ynh_app_setting_set --app=$app --key=delivery_receipts --value=$delivery_receipts +ynh_app_setting_set --app=$app --key=send_presence_on_typing --value=$send_presence_on_typing +ynh_app_setting_set --app=$app --key=url_previews --value=$url_previews +ynh_app_setting_set --app=$app --key=default --value=$default +ynh_app_setting_set --app=$app --key=require --value=$require +ynh_app_setting_set --app=$app --key=enabled --value=$enabled +ynh_app_setting_set --app=$app --key=admin_only --value=$admin_only +ynh_app_setting_set --app=$app --key=print_level --value=$print_level +ynh_app_setting_set --app=$app --key=existingUsers --value=$existingUsers +ynh_app_setting_set --app=$app --key=existingAdmins --value=$existingAdmins +ynh_app_setting_set --app=$app --key=existingRelayUsers --value=$existingRelayUsers + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -67,7 +115,7 @@ fi ynh_script_progression --message="Storing installation settings..." --weight=7 ynh_app_setting_set --app=$app --key=appserviceid --value=$appserviceid -ynh_app_setting_set --app=$app --key=botname --value=$botname +ynh_app_setting_set --app=$app --key=username --value=$username ynh_app_setting_set --app=$app --key=bot_synapse_adm --value=$bot_synapse_adm ynh_app_setting_set --app=$app --key=encryption --value=$encryption ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin @@ -191,8 +239,8 @@ sleep 30 # (Note that, by default, non-admins might not have your homeserver's permission to create communities.) if [ "$bot_synapse_adm" = true ] then - ynh_psql_execute_as_root --database=$synapse_db_name --sql="UPDATE users SET admin = 1 WHERE name = ""$botname"";" - #yunohost app action run $synapse_instance set_admin_user -a username=$botname + ynh_psql_execute_as_root --database=$synapse_db_name --sql="UPDATE users SET admin = 1 WHERE name = ""$username"";" + #yunohost app action run $synapse_instance set_admin_user -a username=$username fi ynh_systemd_action --service_name=$app --action="restart" From 80bff155fd3ffdad1e355d1675158513caf7fb77 Mon Sep 17 00:00:00 2001 From: Gredin 67 Date: Fri, 6 Jan 2023 00:00:26 +0100 Subject: [PATCH 05/46] unique setting name --- conf/config.yaml | 12 +++++----- config_panel.toml | 57 ++++++++++++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/conf/config.yaml b/conf/config.yaml index 1137f15..a2b61eb 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -52,7 +52,7 @@ appservice: bot: # Username of the appservice bot. #username: whatsappbot - username: __USERNAME__ + username: __BOTNAME__ # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty # to leave display name/avatar as-is. displayname: __DISPLAYNAME__ @@ -73,9 +73,9 @@ segment_key: null # Prometheus config. metrics: # Enable prometheus metrics? - enabled: __METRICS_ENABLED__ + enabled: __ENABLE_METRICS__ # IP and port where the metrics listener should be. The path is always /metrics - listen: __LISTEN__ + listen: __METRICS_LISTEN_PORT__ # Config for things that are directly sent to WhatsApp. whatsapp: @@ -334,11 +334,11 @@ bridge: # Default to encryption, force-enable encryption in all portals the bridge creates # This will cause the bridge bot to be in private chats for the encryption to work properly. # It is recommended to also set private_chat_portal_meta to true when using this. - default: __DEFAULT__ + default: __ENCRYPTION_DEFAULT__ # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data. appservice: false # Require encryption, drop any unencrypted messages. - require: __REQUIRE__ + require: __ENCRYPTION_REQUIRE__ # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled. # You must use a client that supports requesting keys from other users to use this feature. allow_key_sharing: false @@ -406,7 +406,7 @@ bridge: # Whether relay mode should be allowed. If allowed, `!wa set-relay` can be used to turn any # authenticated user into a relaybot for that chat. #enabled: false - enabled: __ENABLED__ + enabled: __ENABLE_RELAYBOT__ # Should only admins be allowed to set themselves as relay users? admin_only: __ADMIN_ONLY__ # The formats to use when sending messages to WhatsApp via the relaybot. diff --git a/config_panel.toml b/config_panel.toml index aab35ad..8298810 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,7 +13,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Enables asynchronous media uploads" - bind = "homeserver>async_media:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" [appservice] name = "Application service configuration" @@ -28,7 +28,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Requires MSC2409 support (i.e. Synapse 1.22+). You should disable bridge -> sync_with_custom_puppets when this is enabled" - bind = "appservice>ephemeral_events:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" [appservice.bot] name = "Appservice bot configuration" @@ -37,16 +37,19 @@ services = ["__APP__"] ask = "Username of the appservice bot" type = "string" help = "Sets bot username. Please keep in mind that the bot admin room for previous bot username will stop working so you may need to create a new one using the new username" + bind = ":__FINALPATH__/config.yaml" [appservice.bot.displayname] ask = "Display name for bot" type = "string" help = "Set to 'remove' to remove display name, leave empty to leave display name as-is" + bind = ":__FINALPATH__/config.yaml" [appservice.bot.avatar] ask = "Avatar for bot" type = "string" help = "Set to 'remove' to remove avatar, leave empty to leave avatar as-is" + bind = ":__FINALPATH__/config.yaml" [metrics] name = "Prometheus configuration" @@ -55,19 +58,18 @@ services = ["__APP__"] [metrics.config] name = "General configuration" - [metrics.config.enabled] + [metrics.config.enable_metrics] ask = "Enable prometheus metrics" type = "boolean" yes = "true" no = "false" - bind = "metrics>enabled:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" - [metrics.config.listen] + [metrics.config.metrics_listen_port] ask = "IP and port where the metrics listener should be" type = "string" - default = "127.0.0.1:8001" help = "The path is always /metrics" - bind = "metrics>listen:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" [whatsapp] name = "Whatsapp configuration" @@ -80,16 +82,14 @@ services = ["__APP__"] [whatsapp.config.os_name] ask = "Device name that's shown in the 'WhatsApp Web' section in the mobile app" type = "string" - default = "Mautrix-WhatsApp bridge" - bind = "whatsapp>os_name:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" [whatsapp.config.browser_name] ask = "Browser name that determines the logo shown in the mobile app" type = "select" choices = ["unknown", "chrome", "firefox", "ie", "opera", "safari", "edge", "desktop", "ipad", "android_tablet", "ohana", "aloha", "catalina", "tcl_tv"] - default = "unknown" help = "Must be 'unknown' for a generic icon or a valid browser name if you want a specific icon" - bind = "whatsapp>browser_name:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" [bridge] name = "Bridge configuration" @@ -101,9 +101,24 @@ services = ["__APP__"] [bridge.config.username_template] ask = "Localpart template of MXIDs for WhatsApp users" type = "string" - default = "whatsapp_{{.}}" help = "{{.}} is replaced with the phone number of the WhatsApp user" - bind = "bridge>username_template:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" + + [bridge.config.enable_relaybot] + ask = "Whether relay mode should be allowed." + type = "boolean" + yes = "true" + no = "false" + help = "If allowed, `!wa set-relay` can be used to turn any authenticated user into a relaybot for that chat." + bind = ":__FINALPATH__/config.yaml" + + [bridge.config.admin_only] + ask = "Should only admins be allowed to set themselves as relay users?" + type = "boolean" + yes = "true" + no = "false" + help = "see User management -> Admins" + bind = ":__FINALPATH__/config.yaml" [encryption] name = "Encryption" @@ -117,23 +132,23 @@ services = ["__APP__"] yes = "true" no = "false" help = "Enables end to bridge encryption" - bind = "encryption>allow:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" - [encryption.config.default_encryption] + [encryption.config.encryption_default] ask = "Default encryption" type = "boolean" yes = "true" no = "false" help = "Force-enable encryption in all portals the bridge creates. This will cause the bridge bot to be in private chats for the encryption to work properly." - bind = "encryption>default:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" - [encryption.config.require_encryption] + [encryption.config.encryption_require] ask = "Require encryption" type = "boolean" yes = "true" no = "false" help = "Require encryption, drop any unencrypted messages." - bind = "encryption>require:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" [usermanagement] name = "User management" @@ -179,7 +194,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Should the bridge send a read receipt from the bridge bot when a message has been sent to WhatsApp?" - bind = "bridge>delivery_receipts:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" [privacy.config.send_presence_on_typing] ask = "Send presence on typing" @@ -187,7 +202,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Send the presence as 'available' to whatsapp when users start typing on a portal." - bind = "bridge>send_presence_on_typing:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" [privacy.config.url_previews] ask = "URL previews" @@ -195,4 +210,4 @@ services = ["__APP__"] yes = "true" no = "false" help = "Should the bridge detect URLs in outgoing messages, ask the homeserver to generate a preview, and send it to WhatsApp?" - bind = "bridge>url_previews:__FINALPATH__/config.yaml" + bind = ":__FINALPATH__/config.yaml" From d8dcdfae9e385f805224b31093e94f9cbb5aa93c Mon Sep 17 00:00:00 2001 From: Gredin 67 Date: Fri, 6 Jan 2023 00:01:03 +0100 Subject: [PATCH 06/46] init settings install upgrade --- scripts/install | 28 ++++---- scripts/upgrade | 165 ++++++++++++++++++++++++++++++++++++------------ 2 files changed, 138 insertions(+), 55 deletions(-) diff --git a/scripts/install b/scripts/install index 235be0a..1f2effa 100755 --- a/scripts/install +++ b/scripts/install @@ -25,7 +25,7 @@ ynh_abort_if_errors appserviceid=$YNH_APP_INSTANCE_NAME synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER -username=$YNH_APP_ARG_BOTNAME +botname=$YNH_APP_ARG_BOTNAME bot_synapse_adm=$YNH_APP_ARG_BOT_SYNAPSE_ADM encryption=$YNH_APP_ARG_ENCRYPTION botadmin=$YNH_APP_ARG_BOTADMIN @@ -57,8 +57,8 @@ async_media="false" displayname="WhatsApp bridge bot" avatar="mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr" ephemeral_events="true" -metrics_enabled="false" -listen="127.0.0.1:8001" +enable_metrics="false" +metrics_listen_port="127.0.0.1:8001" os_name="Mautrix-WhatsApp bridge" browser_name="unknown" username_template="whatsapp_{{.}}" @@ -66,9 +66,9 @@ personal_filtering_spaces="false" delivery_receipts="false" send_presence_on_typing="false" url_previews="false" -default="false" -require="false" -enabled="true" +encryption_default="false" +encryption_require="false" +enable_relaybot="true" admin_only="true" print_level="INFO" existingUsers=$botusers @@ -79,8 +79,8 @@ ynh_app_setting_set --app=$app --key=async_media --value=$async_media ynh_app_setting_set --app=$app --key=displayname --value=$displayname ynh_app_setting_set --app=$app --key=avatar --value=$avatar ynh_app_setting_set --app=$app --key=ephemeral_events --value=$ephemeral_events -ynh_app_setting_set --app=$app --key=metrics_enabled --value=$metrics_enabled -ynh_app_setting_set --app=$app --key=listen --value=$listen +ynh_app_setting_set --app=$app --key=enable_metrics --value=$enable_metrics +ynh_app_setting_set --app=$app --key=metrics_listen_port --value=$metrics_listen_port ynh_app_setting_set --app=$app --key=os_name --value=$os_name ynh_app_setting_set --app=$app --key=browser_name --value=$browser_name ynh_app_setting_set --app=$app --key=username_template --value=$username_template @@ -88,9 +88,9 @@ ynh_app_setting_set --app=$app --key=personal_filtering_spaces --value=$personal ynh_app_setting_set --app=$app --key=delivery_receipts --value=$delivery_receipts ynh_app_setting_set --app=$app --key=send_presence_on_typing --value=$send_presence_on_typing ynh_app_setting_set --app=$app --key=url_previews --value=$url_previews -ynh_app_setting_set --app=$app --key=default --value=$default -ynh_app_setting_set --app=$app --key=require --value=$require -ynh_app_setting_set --app=$app --key=enabled --value=$enabled +ynh_app_setting_set --app=$app --key=encryption_default --value=$encryption_default +ynh_app_setting_set --app=$app --key=encryption_require --value=$encryption_require +ynh_app_setting_set --app=$app --key=enable_relaybot --value=$enable_relaybot ynh_app_setting_set --app=$app --key=admin_only --value=$admin_only ynh_app_setting_set --app=$app --key=print_level --value=$print_level ynh_app_setting_set --app=$app --key=existingUsers --value=$existingUsers @@ -115,7 +115,7 @@ fi ynh_script_progression --message="Storing installation settings..." --weight=7 ynh_app_setting_set --app=$app --key=appserviceid --value=$appserviceid -ynh_app_setting_set --app=$app --key=username --value=$username +ynh_app_setting_set --app=$app --key=botname --value=$botname ynh_app_setting_set --app=$app --key=bot_synapse_adm --value=$bot_synapse_adm ynh_app_setting_set --app=$app --key=encryption --value=$encryption ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin @@ -239,8 +239,8 @@ sleep 30 # (Note that, by default, non-admins might not have your homeserver's permission to create communities.) if [ "$bot_synapse_adm" = true ] then - ynh_psql_execute_as_root --database=$synapse_db_name --sql="UPDATE users SET admin = 1 WHERE name = ""$username"";" - #yunohost app action run $synapse_instance set_admin_user -a username=$username + ynh_psql_execute_as_root --database=$synapse_db_name --sql="UPDATE users SET admin = 1 WHERE name = ""$botname"";" + #yunohost app action run $synapse_instance set_admin_user -a username=$botname fi ynh_systemd_action --service_name=$app --action="restart" diff --git a/scripts/upgrade b/scripts/upgrade index 5273e41..fc05304 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,6 +32,32 @@ server_name=$(ynh_app_setting_get --app=$app --key=server_name) synapse_db_name="matrix_$synapse_instance" bot_synapse_db_user="@$botname:$server_name" +#================================================= +# GET CONFIG PANEL SETTINGS +#================================================= +async_media=$(ynh_app_setting_get --app=$app --key=async_media) +displayname=$(ynh_app_setting_get --app=$app --key=displayname) +avatar=$(ynh_app_setting_get --app=$app --key=avatar) +ephemeral_events=$(ynh_app_setting_get --app=$app --key=ephemeral_events) +enable_metrics=$(ynh_app_setting_get --app=$app --key=enable_metrics) +metrics_listen_port=$(ynh_app_setting_get --app=$app --key=metrics_listen_port) +os_name=$(ynh_app_setting_get --app=$app --key=os_name) +browser_name=$(ynh_app_setting_get --app=$app --key=browser_name) +username_template=$(ynh_app_setting_get --app=$app --key=username_template) +personal_filtering_spaces=$(ynh_app_setting_get --app=$app --key=personal_filtering_spaces) +delivery_receipts=$(ynh_app_setting_get --app=$app --key=delivery_receipts) +send_presence_on_typing=$(ynh_app_setting_get --app=$app --key=send_presence_on_typing) +url_previews=$(ynh_app_setting_get --app=$app --key=url_previews) +encryption_default=$(ynh_app_setting_get --app=$app --key=encryption_default) +encryption_require=$(ynh_app_setting_get --app=$app --key=encryption_require) +enable_relaybot=$(ynh_app_setting_get --app=$app --key=enable_relaybot) +admin_only=$(ynh_app_setting_get --app=$app --key=admin_only) +print_level=$(ynh_app_setting_get --app=$app --key=print_level) +existingUsers=$(ynh_app_setting_get --app=$app --key=existingUsers) +existingAdmins=$(ynh_app_setting_get --app=$app --key=existingAdmins) +existingRelayUsers=$(ynh_app_setting_get --app=$app --key=existingRelayUsers) + + #================================================= # CHECK VERSION #================================================= @@ -67,56 +93,113 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# Migration from <=1.10.0 to >0.2.1 -ynh_secure_remove --file="$final_path"/community.go -ynh_secure_remove --file="$final_path"/database/upgrades/2019-05-23-protoupgrade.go -ynh_secure_remove --file="$final_path"/database/upgrades/2019-05-16-message-delete-cascade.go -src_path="$final_path"_src -ynh_secure_remove --file="$src_path" -src_path="$final_path"/src -ynh_secure_remove --file="$src_path" +# SET STANDARD SETTINGS FROM DEFAULT CONFIG -# Upgrade from >0.2.0 -botname=$(ynh_app_setting_get --app=$app --key=botname) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) - -# Upgrade from <=0.2.0 -if [ -z "$botname" ] +if [ -z "$async_media" ] then - botname=$(ynh_app_setting_get --app=$app --key=whatsappbot) - ynh_app_setting_set --app=$app --key=botname --value=$botname + async_media="false" + ynh_app_setting_set --app=$app --key=async_media --value=$async_media fi -if [ -z "$db_name" ] +if [ -z "$displayname" ] then - db_name=$(ynh_app_setting_get --app=$app --key=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name + displayname="WhatsApp bridge bot" + ynh_app_setting_set --app=$app --key=displayname --value=$displayname fi -if [ -z "$db_pwd" ] +if [ -z "$avatar" ] then - db_pwd=$(ynh_app_setting_get --app=$app --key=mautrix_whatsapp_db_pwd) - ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd + avatar="mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr" + ynh_app_setting_set --app=$app --key=avatar --value=$avatar fi - -# If appserviceid doesn't exist, create it -if [ -z "$appserviceid" ] +if [ -z "$ephemeral_events" ] then - appserviceid=$app - ynh_app_setting_set --app=$app --key=appserviceid --value=$appserviceid + ephemeral_events="true" + ynh_app_setting_set --app=$app --key=ephemeral_events --value=$ephemeral_events +fi +if [ -z "$enable_metrics" ] +then + enable_metrics="false" + ynh_app_setting_set --app=$app --key=enable_metrics --value=$enable_metrics +fi +if [ -z "$metrics_listen_port" ] +then + metrics_listen_port="127.0.0.1:8001" + ynh_app_setting_set --app=$app --key=metrics_listen_port --value=$metrics_listen_port +fi +if [ -z "$os_name" ] +then + os_name="Mautrix-WhatsApp bridge" + ynh_app_setting_set --app=$app --key=os_name --value=$os_name +fi +if [ -z "$browser_name" ] +then + browser_name="unknown" + ynh_app_setting_set --app=$app --key=browser_name --value=$browser_name +fi +if [ -z "$username_template" ] +then + username_template="whatsapp_{{.}}" + ynh_app_setting_set --app=$app --key=username_template --value=$username_template +fi +if [ -z "$personal_filtering_spaces" ] +then + personal_filtering_spaces="false" + ynh_app_setting_set --app=$app --key=personal_filtering_spaces --value=$personal_filtering_spaces +fi +if [ -z "$delivery_receipts" ] +then + delivery_receipts="false" + ynh_app_setting_set --app=$app --key=delivery_receipts --value=$delivery_receipts +fi +if [ -z "$send_presence_on_typing" ] +then + send_presence_on_typing="false" + ynh_app_setting_set --app=$app --key=send_presence_on_typing --value=$send_presence_on_typing +fi +if [ -z "$url_previews" ] +then + url_previews="false" + ynh_app_setting_set --app=$app --key=url_previews --value=$url_previews +fi +if [ -z "$encryption_default" ] +then + encryption_default="false" + ynh_app_setting_set --app=$app --key=encryption_default --value=$encryption_default +fi +if [ -z "$encryption_require" ] +then + encryption_require="false" + ynh_app_setting_set --app=$app --key=encryption_require --value=$encryption_require +fi +if [ -z "$enable_relaybot" ] +then + enable_relaybot="true" + ynh_app_setting_set --app=$app --key=enable_relaybot --value=$enable_relaybot +fi +if [ -z "$admin_only" ] +then + admin_only="true" + ynh_app_setting_set --app=$app --key=admin_only --value=$admin_only +fi +if [ -z "$print_level" ] +then + print_level="INFO" + ynh_app_setting_set --app=$app --key=print_level --value=$print_level +fi +if [ -z "$existingUsers" ] +then + existingUsers=$botusers + ynh_app_setting_set --app=$app --key=existingUsers --value=$existingUsers +fi +if [ -z "$existingAdmins" ] +then + existingAdmins=$botadmin + ynh_app_setting_set --app=$app --key=existingAdmins --value=$existingAdmins +fi +if [ -z "$existingRelayUsers" ] +then + existingRelayUsers="*" + ynh_app_setting_set --app=$app --key=existingRelayUsers --value=$existingRelayUsers fi - - -# If db_name doesn't exist, create it -#if [ -z "$mautrix_whatsapp_db_name" ]; then -# mautrix_whatsapp_db_name=$(ynh_sanitize_dbid --db_name=$app) -# ynh_app_setting_set --app=$app --key=db_name --value=$mautrix_whatsapp_db_name -#fi - -# If final_path doesn't exist, create it -#if [ -z "$final_path" ]; then -# final_path=/opt/yunohost/$app -# ynh_app_setting_set --app=$app --key=final_path --value=$final_path -#fi #================================================= # CREATE DEDICATED USER From faa5d5ca9a4e3ff35f79898c3d1bc63649f2d1e3 Mon Sep 17 00:00:00 2001 From: Gredin 67 Date: Fri, 6 Jan 2023 11:28:51 +0100 Subject: [PATCH 07/46] improve config panel structure --- config_panel.toml | 126 +++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 64 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 8298810..a0be1a0 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -1,13 +1,13 @@ version = "1.0" -[homeserver] -name = "Homeserver configuration" +[appservice] +name = "Homeserver Application Service" services = ["__APP__"] - [homeserver.config] - name = "Configuration options" + [appservice.config] + name = "Appservice Settings" - [homeserver.config.async_media] + [appservice.config.async_media] ask = "Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246?" type = "boolean" yes = "true" @@ -15,88 +15,84 @@ services = ["__APP__"] help = "Enables asynchronous media uploads" bind = ":__FINALPATH__/config.yaml" -[appservice] -name = "Application service configuration" -services = ["__APP__"] - - [appservice.config] - name = "General configuration" - [appservice.config.ephemeral_events] - ask = "Whether or not to receive ephemeral events via appservice transactions" + ask = "Receive Ephemeral Events via Appservice transactions?" type = "boolean" yes = "true" no = "false" help = "Requires MSC2409 support (i.e. Synapse 1.22+). You should disable bridge -> sync_with_custom_puppets when this is enabled" bind = ":__FINALPATH__/config.yaml" + [appservice.config.print_level] + ask = "Logging print level (stdout/stderr)" + type = "select" + choices = ["debug", "info", "warn", "error", "fatal"] + help = "Minimum severity for log messages printed to stdout/stderr. This doesn't affect the log file." + bind = ":__FINALPATH__/config.yaml" + [appservice.bot] - name = "Appservice bot configuration" + name = "Robot Settings" [appservice.bot.botname] - ask = "Username of the appservice bot" + ask = "Username of the Appservice Bot" type = "string" help = "Sets bot username. Please keep in mind that the bot admin room for previous bot username will stop working so you may need to create a new one using the new username" bind = ":__FINALPATH__/config.yaml" [appservice.bot.displayname] - ask = "Display name for bot" + ask = "Display name for Bot" type = "string" help = "Set to 'remove' to remove display name, leave empty to leave display name as-is" bind = ":__FINALPATH__/config.yaml" [appservice.bot.avatar] - ask = "Avatar for bot" + ask = "Avatar for Bot" type = "string" help = "Set to 'remove' to remove avatar, leave empty to leave avatar as-is" bind = ":__FINALPATH__/config.yaml" -[metrics] -name = "Prometheus configuration" -services = ["__APP__"] + [appservice.metrics] + name = "Prometheus Metrics" - [metrics.config] - name = "General configuration" - - [metrics.config.enable_metrics] - ask = "Enable prometheus metrics" + [appservice.metrics.enable_metrics] + ask = "Enable Prometheus Metrics?" type = "boolean" yes = "true" no = "false" bind = ":__FINALPATH__/config.yaml" - [metrics.config.metrics_listen_port] - ask = "IP and port where the metrics listener should be" + [appservice.metrics.metrics_listen_port] + ask = "IP and Port for the Metrics listener?" type = "string" - help = "The path is always /metrics" + help = "Default "127.0.0.1:8001". The path is always /metrics" bind = ":__FINALPATH__/config.yaml" [whatsapp] -name = "Whatsapp configuration" -help = "Configuration for things that are directly sent to WhatsApp" +name = "WhatsApp" +help = "Configuration for metadata that are sent to WhatsApp" services = ["__APP__"] [whatsapp.config] - name = "General configuration" + name = "Web API MetaData" [whatsapp.config.os_name] - ask = "Device name that's shown in the 'WhatsApp Web' section in the mobile app" + ask = "Device name in the 'WhatsApp Web' section of the smartphone app" type = "string" bind = ":__FINALPATH__/config.yaml" [whatsapp.config.browser_name] - ask = "Browser name that determines the logo shown in the mobile app" + ask = "Browser name that determines the logo shown in the smartphone app" type = "select" choices = ["unknown", "chrome", "firefox", "ie", "opera", "safari", "edge", "desktop", "ipad", "android_tablet", "ohana", "aloha", "catalina", "tcl_tv"] - help = "Must be 'unknown' for a generic icon or a valid browser name if you want a specific icon" + help = "Must be 'unknown' for a generic icon or a valid browser name if you want a specific logo" bind = ":__FINALPATH__/config.yaml" [bridge] -name = "Bridge configuration" +name = "Bridge" services = ["__APP__"] [bridge.config] - name = "General configuration" + name = "Puppet Settings" [bridge.config.username_template] ask = "Localpart template of MXIDs for WhatsApp users" @@ -105,45 +101,42 @@ services = ["__APP__"] bind = ":__FINALPATH__/config.yaml" [bridge.config.enable_relaybot] - ask = "Whether relay mode should be allowed." + ask = "Should Relay mode be allowed?" type = "boolean" yes = "true" no = "false" - help = "If allowed, `!wa set-relay` can be used to turn any authenticated user into a relaybot for that chat." + help = "If allowed, `!wa set-relay` can be used to turn any authenticated user into a RelayBot for that chat." bind = ":__FINALPATH__/config.yaml" [bridge.config.admin_only] - ask = "Should only admins be allowed to set themselves as relay users?" + ask = "Should only Bridge Admins be allowed to set themselves as relay users?" type = "boolean" yes = "true" no = "false" - help = "see User management -> Admins" + help = "See User management -> Admins" bind = ":__FINALPATH__/config.yaml" -[encryption] -name = "Encryption" -services = ["__APP__"] - [encryption.config] - name = "Encryption settings" + [bridge.portal_rooms] + name = "Portal Rooms & Encryption Settings" - [encryption.config.encryption] - ask = "Enable encryption" + [bridge.portal_rooms.encryption] + ask = "Allow End-to-Bridge (e2b) Encryption?" type = "boolean" yes = "true" no = "false" - help = "Enables end to bridge encryption" + help = "For the Bridge to work in group chat Rooms with End-to-End Encryption (e2ee) enabled." bind = ":__FINALPATH__/config.yaml" - - [encryption.config.encryption_default] - ask = "Default encryption" + + [bridge.portal_rooms.encryption_default] + ask = "Force-enable Encryption in all Portal Rooms the Bridge creates?" type = "boolean" yes = "true" - no = "false" - help = "Force-enable encryption in all portals the bridge creates. This will cause the bridge bot to be in private chats for the encryption to work properly." + no = "false" + help = "This will cause the Bridge Bot to be in private chats for the Encryption to work properly." bind = ":__FINALPATH__/config.yaml" - [encryption.config.encryption_require] - ask = "Require encryption" + [bridge.portal_rooms.encryption_require] + ask = "Require encryption?" type = "boolean" yes = "true" no = "false" @@ -151,14 +144,19 @@ services = ["__APP__"] bind = ":__FINALPATH__/config.yaml" [usermanagement] -name = "User management" +name = "Bridge Permissions" services = ["__APP__"] [usermanagement.config] - name = "User management" + name = "User, Admin, Relay Management" [usermanagement.config.helptext] - ask = "Allowed values:\n  * - All Matrix users\n  domain - All users on that homeserver\n  mxid (@user:matrix.org) - Specific Matrix user\n  username - Specific local user" + ask = ''' + Allowed values: + - * : All Matrix users + - domain.tld : All users on a given homeserver + - mxid (@user:matrix.org) : Specific Matrix user + ''' type = "markdown" [usermanagement.config.listuser] @@ -186,26 +184,26 @@ name = "Privacy" services = ["__APP__"] [privacy.config] - name = "Privacy settings" + name = "Privacy Settings" [privacy.config.delivery_receipts] - ask = "Delivery receipts" + ask = "Enable Delivery Receipts?" type = "boolean" yes = "true" no = "false" - help = "Should the bridge send a read receipt from the bridge bot when a message has been sent to WhatsApp?" + help = "Should the bridge send a read Receipt from the bridge bot when a message has been sent to WhatsApp?" bind = ":__FINALPATH__/config.yaml" [privacy.config.send_presence_on_typing] - ask = "Send presence on typing" + ask = "Send Presence on typing?" type = "boolean" yes = "true" no = "false" - help = "Send the presence as 'available' to whatsapp when users start typing on a portal." + help = "Send the Presence as 'available' to whatsapp when users start typing on a portal." bind = ":__FINALPATH__/config.yaml" [privacy.config.url_previews] - ask = "URL previews" + ask = "Enable URL preview?" type = "boolean" yes = "true" no = "false" From a25dcb70a2279bc272984c5f0a5a22ffa470ec37 Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Fri, 6 Jan 2023 16:29:20 +0100 Subject: [PATCH 08/46] typo and small clean --- config_panel.toml | 2 +- manifest.json | 8 ++++---- scripts/install | 16 ++++++---------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index a0be1a0..18290b1 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -64,7 +64,7 @@ services = ["__APP__"] [appservice.metrics.metrics_listen_port] ask = "IP and Port for the Metrics listener?" type = "string" - help = "Default "127.0.0.1:8001". The path is always /metrics" + help = "Defaults to: '127.0.0.1:8001'. The path is always /metrics" bind = ":__FINALPATH__/config.yaml" [whatsapp] diff --git a/manifest.json b/manifest.json index e647b7d..df4a8f4 100644 --- a/manifest.json +++ b/manifest.json @@ -104,11 +104,11 @@ "en": "Choose Matrix user(s) authorized to bridge with the WhatsApp bot.", "fr": "Choisissez le/les compte(s) Matrix autorisés à utiliser la passerelle WhatsApp." }, - "example": "admin or domain or @johndoe:server.name or server.name or *", - "default": "domain", + "example": "local or @johndoe:server.name or server.name or *", + "default": "local", "help": { - "en": "Either the administrator only (admin), all local Synapse users (domain), a remote or local user (@johndoe:server.name), a remote server (matrix.org), or all remote/local servers (*) can be authorized. Give the Matrix server_name, not the full domain/URL.", - "fr": "L'administrateur seulement (admin), tous les comptes Synapse locaux (domain), un compte local ou distant (@johndoe:server.name), un serveur distant (matrix.org), ou tous les serveurs remote/local (*). Donner le nom du serveur Matrix, pas le domaine/URL complet." + "en": "Either all local Synapse users (local), a remote or local user (@johndoe:server.name), a remote server (matrix.org), or all remote/local servers (*) can be authorized. Give the Matrix server_name, not the full domain/URL.", + "fr": "Soir tous les comptes Synapse locaux (local), un compte local ou distant (@johndoe:server.name), un serveur distant (matrix.org), ou tous les serveurs remote/local (*). Donner le nom du serveur Matrix, pas le domaine/URL complet." } } ] diff --git a/scripts/install b/scripts/install index 1f2effa..259e535 100755 --- a/scripts/install +++ b/scripts/install @@ -33,11 +33,6 @@ botusers=$YNH_APP_ARG_BOTUSERS app=$YNH_APP_INSTANCE_NAME -if [ "$botusers" == "admin" ] -then - botusers=$botadmin -fi - # ToDo check (in manifest?) if the selected synapse instance is not already connected to a mautrix_whatsapp bridge if [ $synapsenumber -eq "1" ] then @@ -49,6 +44,11 @@ server_name=$(ynh_app_setting_get --app $synapse_instance --key server_name) domain=$(ynh_app_setting_get --app $synapse_instance --key domain) synapse_db_name="matrix_$synapse_instance" +if [ "$botusers" == "local" ] +then + botusers="$server_name" +fi + #================================================= # SET STANDARD SETTINGS FROM DEFAULT CONFIG #================================================= @@ -105,10 +105,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -if [ $encryption -eq 1 ]; then - encryption="true" -fi - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -236,7 +232,7 @@ ynh_script_progression --message="Starting a systemd service..." --weight=15 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" # Wait until the synapse user is created sleep 30 - # (Note that, by default, non-admins might not have your homeserver's permission to create communities.) + # (Note that, by default, non-admins might not have your homeserver's permission to create Spaces.) if [ "$bot_synapse_adm" = true ] then ynh_psql_execute_as_root --database=$synapse_db_name --sql="UPDATE users SET admin = 1 WHERE name = ""$botname"";" From f151a35cda9a2c4bf1d15136f3f7cadb4802d1d9 Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Fri, 6 Jan 2023 19:19:12 +0100 Subject: [PATCH 09/46] add bind to match settings --- config_panel.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 18290b1..b235240 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -37,7 +37,7 @@ services = ["__APP__"] ask = "Username of the Appservice Bot" type = "string" help = "Sets bot username. Please keep in mind that the bot admin room for previous bot username will stop working so you may need to create a new one using the new username" - bind = ":__FINALPATH__/config.yaml" + bind = "bot>username:__FINALPATH__/config.yaml" [appservice.bot.displayname] ask = "Display name for Bot" @@ -59,13 +59,13 @@ services = ["__APP__"] type = "boolean" yes = "true" no = "false" - bind = ":__FINALPATH__/config.yaml" + bind = "metrics>enabled:__FINALPATH__/config.yaml" [appservice.metrics.metrics_listen_port] ask = "IP and Port for the Metrics listener?" type = "string" help = "Defaults to: '127.0.0.1:8001'. The path is always /metrics" - bind = ":__FINALPATH__/config.yaml" + bind = "metrics>listen:__FINALPATH__/config.yaml" [whatsapp] name = "WhatsApp" @@ -106,7 +106,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "If allowed, `!wa set-relay` can be used to turn any authenticated user into a RelayBot for that chat." - bind = ":__FINALPATH__/config.yaml" + bind = "relay>enabled:__FINALPATH__/config.yaml" [bridge.config.admin_only] ask = "Should only Bridge Admins be allowed to set themselves as relay users?" @@ -125,7 +125,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "For the Bridge to work in group chat Rooms with End-to-End Encryption (e2ee) enabled." - bind = ":__FINALPATH__/config.yaml" + bind = "encryption>allow:__FINALPATH__/config.yaml" [bridge.portal_rooms.encryption_default] ask = "Force-enable Encryption in all Portal Rooms the Bridge creates?" @@ -133,7 +133,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "This will cause the Bridge Bot to be in private chats for the Encryption to work properly." - bind = ":__FINALPATH__/config.yaml" + bind = "encryption>default:__FINALPATH__/config.yaml" [bridge.portal_rooms.encryption_require] ask = "Require encryption?" @@ -141,7 +141,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Require encryption, drop any unencrypted messages." - bind = ":__FINALPATH__/config.yaml" + bind = "encryption>require:__FINALPATH__/config.yaml" [usermanagement] name = "Bridge Permissions" From 83cb70b7edf4e77778ce56bfc2a85140954870fc Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Tue, 10 Jan 2023 13:07:57 +0100 Subject: [PATCH 10/46] init tags listuser,admin,relay --- conf/config.yaml | 10 ++++------ config_panel.toml | 2 +- scripts/install | 26 +++++++++++--------------- scripts/upgrade | 43 +++++++++++++++++++++++++------------------ 4 files changed, 41 insertions(+), 40 deletions(-) diff --git a/conf/config.yaml b/conf/config.yaml index a2b61eb..e4d18d7 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -75,7 +75,7 @@ metrics: # Enable prometheus metrics? enabled: __ENABLE_METRICS__ # IP and port where the metrics listener should be. The path is always /metrics - listen: __METRICS_LISTEN_PORT__ + listen: __LISTEN_PORT__ # Config for things that are directly sent to WhatsApp. whatsapp: @@ -395,11 +395,9 @@ bridge: # domain - All users on that homeserver # mxid - Specific user permissions: - "*": relay - #"example.com": user - "__BOTUSERS__": user - #"@admin:example.com": admin - "__BOTADMIN__": admin + "__LISTRELAY__": relay + "__LISTUSER__": user + "__LISTADMIN__": admin # Settings for relay mode relay: diff --git a/config_panel.toml b/config_panel.toml index b235240..a41e12e 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -61,7 +61,7 @@ services = ["__APP__"] no = "false" bind = "metrics>enabled:__FINALPATH__/config.yaml" - [appservice.metrics.metrics_listen_port] + [appservice.metrics.listen_port] ask = "IP and Port for the Metrics listener?" type = "string" help = "Defaults to: '127.0.0.1:8001'. The path is always /metrics" diff --git a/scripts/install b/scripts/install index 259e535..fef5738 100755 --- a/scripts/install +++ b/scripts/install @@ -28,8 +28,8 @@ synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER botname=$YNH_APP_ARG_BOTNAME bot_synapse_adm=$YNH_APP_ARG_BOT_SYNAPSE_ADM encryption=$YNH_APP_ARG_ENCRYPTION -botadmin=$YNH_APP_ARG_BOTADMIN -botusers=$YNH_APP_ARG_BOTUSERS +listadmin=$YNH_APP_ARG_BOTADMIN +listuser=$YNH_APP_ARG_BOTUSERS app=$YNH_APP_INSTANCE_NAME @@ -44,9 +44,9 @@ server_name=$(ynh_app_setting_get --app $synapse_instance --key server_name) domain=$(ynh_app_setting_get --app $synapse_instance --key domain) synapse_db_name="matrix_$synapse_instance" -if [ "$botusers" == "local" ] +if [ "$listuser" == "local" ] then - botusers="$server_name" + listuser="$server_name" fi #================================================= @@ -58,7 +58,7 @@ displayname="WhatsApp bridge bot" avatar="mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr" ephemeral_events="true" enable_metrics="false" -metrics_listen_port="127.0.0.1:8001" +listen_port="127.0.0.1:8001" os_name="Mautrix-WhatsApp bridge" browser_name="unknown" username_template="whatsapp_{{.}}" @@ -68,19 +68,17 @@ send_presence_on_typing="false" url_previews="false" encryption_default="false" encryption_require="false" -enable_relaybot="true" admin_only="true" print_level="INFO" -existingUsers=$botusers -existingAdmins=$botadmin -existingRelayUsers="*" +enable_relaybot="true" +listrelay="*" ynh_app_setting_set --app=$app --key=async_media --value=$async_media ynh_app_setting_set --app=$app --key=displayname --value=$displayname ynh_app_setting_set --app=$app --key=avatar --value=$avatar ynh_app_setting_set --app=$app --key=ephemeral_events --value=$ephemeral_events ynh_app_setting_set --app=$app --key=enable_metrics --value=$enable_metrics -ynh_app_setting_set --app=$app --key=metrics_listen_port --value=$metrics_listen_port +ynh_app_setting_set --app=$app --key=listen_port --value=$listen_port ynh_app_setting_set --app=$app --key=os_name --value=$os_name ynh_app_setting_set --app=$app --key=browser_name --value=$browser_name ynh_app_setting_set --app=$app --key=username_template --value=$username_template @@ -93,9 +91,7 @@ ynh_app_setting_set --app=$app --key=encryption_require --value=$encryption_requ ynh_app_setting_set --app=$app --key=enable_relaybot --value=$enable_relaybot ynh_app_setting_set --app=$app --key=admin_only --value=$admin_only ynh_app_setting_set --app=$app --key=print_level --value=$print_level -ynh_app_setting_set --app=$app --key=existingUsers --value=$existingUsers -ynh_app_setting_set --app=$app --key=existingAdmins --value=$existingAdmins -ynh_app_setting_set --app=$app --key=existingRelayUsers --value=$existingRelayUsers +ynh_app_setting_set --app=$app --key=listrelay --value=$listrelay #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -114,8 +110,8 @@ ynh_app_setting_set --app=$app --key=appserviceid --value=$appserviceid ynh_app_setting_set --app=$app --key=botname --value=$botname ynh_app_setting_set --app=$app --key=bot_synapse_adm --value=$bot_synapse_adm ynh_app_setting_set --app=$app --key=encryption --value=$encryption -ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin -ynh_app_setting_set --app=$app --key=botusers --value=$botusers +ynh_app_setting_set --app=$app --key=listuser --value=$listuser +ynh_app_setting_set --app=$app --key=listadmin --value=$listadmin ynh_app_setting_set --app=$app --key=synapse_instance --value=$synapse_instance ynh_app_setting_set --app=$app --key=server_name --value=$server_name ynh_app_setting_set --app=$app --key=domain --value=$domain diff --git a/scripts/upgrade b/scripts/upgrade index fc05304..df48d67 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,8 +19,6 @@ app=$YNH_APP_INSTANCE_NAME appserviceid=$(ynh_app_setting_get --app=$app --key=appserviceid) botname=$(ynh_app_setting_get --app=$app --key=botname) encryption=$(ynh_app_setting_get --app=$app --key=encryption) -botadmin=$(ynh_app_setting_get --app=$app --key=botadmin) -botusers=$(ynh_app_setting_get --app=$app --key=botusers) domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -40,7 +38,7 @@ displayname=$(ynh_app_setting_get --app=$app --key=displayname) avatar=$(ynh_app_setting_get --app=$app --key=avatar) ephemeral_events=$(ynh_app_setting_get --app=$app --key=ephemeral_events) enable_metrics=$(ynh_app_setting_get --app=$app --key=enable_metrics) -metrics_listen_port=$(ynh_app_setting_get --app=$app --key=metrics_listen_port) +listen_port=$(ynh_app_setting_get --app=$app --key=listen_port) os_name=$(ynh_app_setting_get --app=$app --key=os_name) browser_name=$(ynh_app_setting_get --app=$app --key=browser_name) username_template=$(ynh_app_setting_get --app=$app --key=username_template) @@ -53,9 +51,9 @@ encryption_require=$(ynh_app_setting_get --app=$app --key=encryption_require) enable_relaybot=$(ynh_app_setting_get --app=$app --key=enable_relaybot) admin_only=$(ynh_app_setting_get --app=$app --key=admin_only) print_level=$(ynh_app_setting_get --app=$app --key=print_level) -existingUsers=$(ynh_app_setting_get --app=$app --key=existingUsers) -existingAdmins=$(ynh_app_setting_get --app=$app --key=existingAdmins) -existingRelayUsers=$(ynh_app_setting_get --app=$app --key=existingRelayUsers) +listrelay=$(ynh_app_setting_get --app=$app --key=listrelay) +listuser=$(ynh_app_setting_get --app=$app --key=listuser) +listadmin=$(ynh_app_setting_get --app=$app --key=listadmin) #================================================= @@ -120,10 +118,10 @@ then enable_metrics="false" ynh_app_setting_set --app=$app --key=enable_metrics --value=$enable_metrics fi -if [ -z "$metrics_listen_port" ] +if [ -z "$listen_port" ] then - metrics_listen_port="127.0.0.1:8001" - ynh_app_setting_set --app=$app --key=metrics_listen_port --value=$metrics_listen_port + listen_port="127.0.0.1:8001" + ynh_app_setting_set --app=$app --key=listen_port --value=$listen_port fi if [ -z "$os_name" ] then @@ -185,20 +183,29 @@ then print_level="INFO" ynh_app_setting_set --app=$app --key=print_level --value=$print_level fi -if [ -z "$existingUsers" ] +if [ -z "$listrelay" ] then - existingUsers=$botusers - ynh_app_setting_set --app=$app --key=existingUsers --value=$existingUsers + listrelay="*" + ynh_app_setting_set --app=$app --key=listrelay --value=$listrelay fi -if [ -z "$existingAdmins" ] +if [ -z "$enable_relaybot" ] then - existingAdmins=$botadmin - ynh_app_setting_set --app=$app --key=existingAdmins --value=$existingAdmins + enable_relaybot="true" + ynh_app_setting_set --app=$app --key=enable_relaybot --value=$enable_relaybot fi -if [ -z "$existingRelayUsers" ] + +if [ -z "$listuser" ] then - existingRelayUsers="*" - ynh_app_setting_set --app=$app --key=existingRelayUsers --value=$existingRelayUsers + listuser=$(ynh_app_setting_get --app=$app --key=botusers) + ynh_app_setting_set --app=$app --key=listuser --value=$listuser + ynh_app_setting_delete --app=$app --key=botusers +fi + +if [ -z "$listadmin" ] +then + listadmin=$(ynh_app_setting_get --app=$app --key=botadmin) + ynh_app_setting_set --app=$app --key=listadmin --value=$listadmin + ynh_app_setting_delete --app=$app --key=botadmin fi #================================================= From a690e9b2eb709e2b3224153bd725c6c192fcb2f1 Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Wed, 11 Jan 2023 12:39:05 +0100 Subject: [PATCH 11/46] try apply config panel to avoid wrong permission list formatting --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index df48d67..d98f885 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -305,6 +305,8 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" +yunohost app config set mautrix_whatsapp usermanagement.config.role -v + #================================================= # END OF SCRIPT #================================================= From cfdfa99b34f0099e61cfb28711c2a3d3e647cee3 Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Wed, 11 Jan 2023 14:17:06 +0100 Subject: [PATCH 12/46] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index d98f885..8c28b98 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -305,7 +305,7 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" -yunohost app config set mautrix_whatsapp usermanagement.config.role -v +yunohost app config set mautrix_whatsapp usermanagement.config.role #================================================= # END OF SCRIPT From d427bd3ab5df2385a17f87a67da89ea88a685345 Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Thu, 12 Jan 2023 11:48:10 +0100 Subject: [PATCH 13/46] Update upgrade --- scripts/upgrade | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 8c28b98..5ea0a8f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -305,6 +305,12 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" +# Re-apply permissions to avoid wrong syntax "domain.tld,domain2.tld: admin" +role="user" +yunohost app config set mautrix_whatsapp usermanagement.config.role +role="admin" +yunohost app config set mautrix_whatsapp usermanagement.config.role +role="relay" yunohost app config set mautrix_whatsapp usermanagement.config.role #================================================= From 98391bdb465d7719320efc32008e78d860767459 Mon Sep 17 00:00:00 2001 From: Dante Date: Mon, 16 Jan 2023 13:08:30 +0000 Subject: [PATCH 14/46] Fix set role for command line calls --- scripts/config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/config b/scripts/config index caf3da0..3f68aaa 100644 --- a/scripts/config +++ b/scripts/config @@ -31,7 +31,7 @@ function get__listuser { existingUsers=$(grep -- "\".*: user" "$final_path/config.yaml" | sed -r 's/: user//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',') cat < Date: Mon, 16 Jan 2023 13:08:46 +0000 Subject: [PATCH 15/46] Auto-update README --- README_fr.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README_fr.md b/README_fr.md index fd25968..2de1596 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,15 +5,15 @@ It shall NOT be edited by hand. # Matrix-WhatsApp bridge pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/mautrix_whatsapp.svg)](https://dash.yunohost.org/appci/app/mautrix_whatsapp) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/mautrix_whatsapp.svg)](https://dash.yunohost.org/appci/app/mautrix_whatsapp) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.maintain.svg) [![Installer Matrix-WhatsApp bridge avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mautrix_whatsapp) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer Matrix-WhatsApp bridge rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* +> *Ce package vous permet d’installer Matrix-WhatsApp bridge rapidement et simplement sur un serveur YunoHost. +Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.* -## Vue d'ensemble +## Vue d’ensemble Une passerelle entre Matrix et WhatsApp empaquetée comme un service YunoHost. Les messages, médias et notifications sont relayées entre un compte WhatsApp et un compte Matrix. @@ -100,9 +100,9 @@ Si vous devez téléverser vos fichiers log quelque-part, soyez avertis qu'ils c ## Documentations et ressources -* Site officiel de l'app : -* Documentation officielle de l'admin : -* Dépôt de code officiel de l'app : +* Site officiel de l’app : +* Documentation officielle de l’admin : +* Dépôt de code officiel de l’app : * Documentation YunoHost pour cette app : * Signaler un bug : @@ -118,4 +118,4 @@ ou sudo yunohost app upgrade mautrix_whatsapp -u https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file From 19b35021a7d918b345c4ca95f63055786dc13ef8 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 10:16:35 +0100 Subject: [PATCH 16/46] merge conflict --- config_panel.toml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index a41e12e..d97cfea 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -148,7 +148,7 @@ name = "Bridge Permissions" services = ["__APP__"] [usermanagement.config] - name = "User, Admin, Relay Management" + name = "Permissions for using the bridge." [usermanagement.config.helptext] ask = ''' @@ -160,24 +160,19 @@ services = ["__APP__"] type = "markdown" [usermanagement.config.listuser] - ask = "Users" + ask = "Bridge Users" type = "tags" - visible = "role == 'user'" + help = "Access to use the bridge to chat with a WhatsApp account." [usermanagement.config.listadmin] - ask = "Admins" + ask = "Bride Administrators" type = "tags" - visible = "role == 'admin'" + help = "User level and some additional administration tools." [usermanagement.config.listrelay] - ask = "Relay users" + ask = "Bridge Users of the Relaybot Mode" type = "tags" - visible = "role == 'relay'" - - [usermanagement.config.role] - ask = "Role" - type = "select" - choices = ["user", "admin", "relay"] + help = "Talk through the relaybot (if enabled), no access otherwise." [privacy] name = "Privacy" From d0a7cf72e5c6ec570457f2a736d9590776dacfd6 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 11:19:06 +0100 Subject: [PATCH 17/46] refactor config_panel structure --- config_panel.toml | 318 ++++++++++++++++++++++++---------------------- 1 file changed, 163 insertions(+), 155 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index d97cfea..9cee78f 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -1,156 +1,13 @@ version = "1.0" -[appservice] -name = "Homeserver Application Service" +[main] +name = "Main Settings" services = ["__APP__"] - [appservice.config] - name = "Appservice Settings" - - [appservice.config.async_media] - ask = "Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246?" - type = "boolean" - yes = "true" - no = "false" - help = "Enables asynchronous media uploads" - bind = ":__FINALPATH__/config.yaml" - - [appservice.config.ephemeral_events] - ask = "Receive Ephemeral Events via Appservice transactions?" - type = "boolean" - yes = "true" - no = "false" - help = "Requires MSC2409 support (i.e. Synapse 1.22+). You should disable bridge -> sync_with_custom_puppets when this is enabled" - bind = ":__FINALPATH__/config.yaml" - - [appservice.config.print_level] - ask = "Logging print level (stdout/stderr)" - type = "select" - choices = ["debug", "info", "warn", "error", "fatal"] - help = "Minimum severity for log messages printed to stdout/stderr. This doesn't affect the log file." - bind = ":__FINALPATH__/config.yaml" - - [appservice.bot] - name = "Robot Settings" - - [appservice.bot.botname] - ask = "Username of the Appservice Bot" - type = "string" - help = "Sets bot username. Please keep in mind that the bot admin room for previous bot username will stop working so you may need to create a new one using the new username" - bind = "bot>username:__FINALPATH__/config.yaml" - - [appservice.bot.displayname] - ask = "Display name for Bot" - type = "string" - help = "Set to 'remove' to remove display name, leave empty to leave display name as-is" - bind = ":__FINALPATH__/config.yaml" - - [appservice.bot.avatar] - ask = "Avatar for Bot" - type = "string" - help = "Set to 'remove' to remove avatar, leave empty to leave avatar as-is" - bind = ":__FINALPATH__/config.yaml" - - [appservice.metrics] - name = "Prometheus Metrics" - - [appservice.metrics.enable_metrics] - ask = "Enable Prometheus Metrics?" - type = "boolean" - yes = "true" - no = "false" - bind = "metrics>enabled:__FINALPATH__/config.yaml" - - [appservice.metrics.listen_port] - ask = "IP and Port for the Metrics listener?" - type = "string" - help = "Defaults to: '127.0.0.1:8001'. The path is always /metrics" - bind = "metrics>listen:__FINALPATH__/config.yaml" - -[whatsapp] -name = "WhatsApp" -help = "Configuration for metadata that are sent to WhatsApp" -services = ["__APP__"] - - [whatsapp.config] - name = "Web API MetaData" - - [whatsapp.config.os_name] - ask = "Device name in the 'WhatsApp Web' section of the smartphone app" - type = "string" - bind = ":__FINALPATH__/config.yaml" - - [whatsapp.config.browser_name] - ask = "Browser name that determines the logo shown in the smartphone app" - type = "select" - choices = ["unknown", "chrome", "firefox", "ie", "opera", "safari", "edge", "desktop", "ipad", "android_tablet", "ohana", "aloha", "catalina", "tcl_tv"] - help = "Must be 'unknown' for a generic icon or a valid browser name if you want a specific logo" - bind = ":__FINALPATH__/config.yaml" - -[bridge] -name = "Bridge" -services = ["__APP__"] - - [bridge.config] - name = "Puppet Settings" - - [bridge.config.username_template] - ask = "Localpart template of MXIDs for WhatsApp users" - type = "string" - help = "{{.}} is replaced with the phone number of the WhatsApp user" - bind = ":__FINALPATH__/config.yaml" - - [bridge.config.enable_relaybot] - ask = "Should Relay mode be allowed?" - type = "boolean" - yes = "true" - no = "false" - help = "If allowed, `!wa set-relay` can be used to turn any authenticated user into a RelayBot for that chat." - bind = "relay>enabled:__FINALPATH__/config.yaml" - - [bridge.config.admin_only] - ask = "Should only Bridge Admins be allowed to set themselves as relay users?" - type = "boolean" - yes = "true" - no = "false" - help = "See User management -> Admins" - bind = ":__FINALPATH__/config.yaml" - - [bridge.portal_rooms] - name = "Portal Rooms & Encryption Settings" - - [bridge.portal_rooms.encryption] - ask = "Allow End-to-Bridge (e2b) Encryption?" - type = "boolean" - yes = "true" - no = "false" - help = "For the Bridge to work in group chat Rooms with End-to-End Encryption (e2ee) enabled." - bind = "encryption>allow:__FINALPATH__/config.yaml" - - [bridge.portal_rooms.encryption_default] - ask = "Force-enable Encryption in all Portal Rooms the Bridge creates?" - type = "boolean" - yes = "true" - no = "false" - help = "This will cause the Bridge Bot to be in private chats for the Encryption to work properly." - bind = "encryption>default:__FINALPATH__/config.yaml" - - [bridge.portal_rooms.encryption_require] - ask = "Require encryption?" - type = "boolean" - yes = "true" - no = "false" - help = "Require encryption, drop any unencrypted messages." - bind = "encryption>require:__FINALPATH__/config.yaml" - -[usermanagement] -name = "Bridge Permissions" -services = ["__APP__"] - - [usermanagement.config] + [main.permissions] name = "Permissions for using the bridge." - [usermanagement.config.helptext] + [main.permissions.helptext] ask = ''' Allowed values: - * : All Matrix users @@ -159,25 +16,100 @@ services = ["__APP__"] ''' type = "markdown" - [usermanagement.config.listuser] + [main.permissions.listuser] ask = "Bridge Users" type = "tags" help = "Access to use the bridge to chat with a WhatsApp account." - [usermanagement.config.listadmin] + [main.permissions.listadmin] ask = "Bride Administrators" type = "tags" help = "User level and some additional administration tools." - [usermanagement.config.listrelay] - ask = "Bridge Users of the Relaybot Mode" + [main.permissions.listrelay] + ask = "Users bridged thanks to Relay Mode" type = "tags" - help = "Talk through the relaybot (if enabled), no access otherwise." + help = "Talk on WhatsApp through the RelayBot in a room where it's activated '!wa set-relay', no access otherwise." + visible = "enable_relaybot" + + [main.bridge] + name = "Puppetting Bridge Settings" + + [main.bridge.enable_relaybot] + ask = "Should Relay Mode be allowed?" + type = "boolean" + yes = "true" + no = "false" + help = "If allowed, '!wa set-relay' can be used to turn any Bridge User into a RelayBot for that chat. This allows people to talk on WhatsApp without an own account." + bind = "relay>enabled:__FINALPATH__/config.yaml" + + [main.bridge.admin_only] + ask = "Should only Bridge Admins be allowed to set themselves as Relay Users?" + type = "boolean" + yes = "true" + no = "false" + help = "See User management -> Admins" + bind = ":__FINALPATH__/config.yaml" + visible = "enable_relaybot" + + [main.bot] + name = "Robot Settings" + + [main.bot.botname] + ask = "Username of the AppService Bot" + type = "string" + help = "Sets bot username. Please keep in mind that the bot admin room for previous bot username will stop working so you may need to create a new one using the new username" + bind = "bot>username:__FINALPATH__/config.yaml" + + [main.bot.displayname] + ask = "Display name for Bot" + type = "string" + help = "Set to 'remove' to remove display name, leave empty to set default 'WhatsApp bridge bot'" + bind = ":__FINALPATH__/config.yaml" + + [main.bot.avatar] + ask = "Avatar for Bot" + type = "string" + help = "Should be in format 'mxc://__SERVER_NAME__/NeXNQarUbrlYBiPCpprYsRqr', see README for tutorial. Set to 'remove' to remove avatar, leave empty to use standard WhatsApp logo." + bind = ":__FINALPATH__/config.yaml" [privacy] name = "Privacy" services = ["__APP__"] + [privacy.portal_rooms] + name = "Portal Rooms & Encryption Settings" + + [privacy.portal_rooms.text] + ask = "!! Inviting the Bridge in an encrypted room **breaks End-to-End Encryption (e2ee)** !! Messages will be unencrypted on the Bridge Server!" + type = "markdown" + + [privacy.portal_rooms.encryption] + ask = "Allow Encryption from Matrix Client to Bridge Server?" + type = "boolean" + yes = "true" + no = "false" + help = "Enable so-called End-to-Bridge (e2b) Encryption. For the Bridge to work in group chat Rooms with End-to-End Encryption (e2ee) enabled." + bind = "encryption>allow:__FINALPATH__/config.yaml" + + [privacy.portal_rooms.encryption_default] + ask = "Force-enable Encryption in all Portal Rooms the Bridge creates?" + type = "boolean" + yes = "true" + no = "false" + help = "This will cause the Bridge Bot to be in private chats for the Encryption to work properly." + bind = "encryption>default:__FINALPATH__/config.yaml" + visible = "encryption" + + [privacy.portal_rooms.encryption_require] + ask = "Require encryption?" + type = "boolean" + yes = "true" + no = "false" + help = "Require encryption, drop any unencrypted messages." + bind = "encryption>require:__FINALPATH__/config.yaml" + visible = "encryption" + [privacy.config] name = "Privacy Settings" @@ -194,13 +126,89 @@ services = ["__APP__"] type = "boolean" yes = "true" no = "false" - help = "Send the Presence as 'available' to whatsapp when users start typing on a portal." + help = "Send the Presence as 'available' to WhatsApp when Users start typing on a Portal." bind = ":__FINALPATH__/config.yaml" [privacy.config.url_previews] - ask = "Enable URL preview?" + ask = "Enable URL Preview?" type = "boolean" yes = "true" no = "false" - help = "Should the bridge detect URLs in outgoing messages, ask the homeserver to generate a preview, and send it to WhatsApp?" + help = "Should the Bridge detect URLs in outgoing messages, ask the HomeServer to generate a Preview, and send it to WhatsApp?" bind = ":__FINALPATH__/config.yaml" + +[advanced] +name = "Advanced Settings" +services = ["__APP__"] + + [advanced.help] + name = "SETTINGS FOR EXPERTS IN SERVER ADMINISTRATION" + + [advanced.help.text] + ask = "!! There are **security and privacy risks** if you change these settings without knowing what you do !!" + type = "markdown" + + [advanced.whatsapp] + name = "WhatsApp Web API MetaData" + + [advanced.whatsapp.username_template] + ask = "Localpart template of MXIDs for WhatsApp users" + type = "string" + help = "Defaults to 'whatsapp_{{.}}'. '{{.}}' is replaced with the phone number 'msidsn' of the WhatsApp user." + bind = ":__FINALPATH__/config.yaml" + + [advanced.whatsapp.os_name] + ask = "Device name in the 'WhatsApp Web' section of the smartphone app" + type = "string" + bind = ":__FINALPATH__/config.yaml" + + [advanced.whatsapp.browser_name] + ask = "Browser name that determines the logo shown in the smartphone app" + type = "select" + choices = ["unknown", "chrome", "firefox", "ie", "opera", "safari", "edge", "desktop", "ipad", "android_tablet", "ohana", "aloha", "catalina", "tcl_tv"] + help = "Must be 'unknown' for a generic icon or a valid browser name if you want a specific logo." + bind = ":__FINALPATH__/config.yaml" + + [advanced.appservice] + name = "HomeServer Application Service" + + [advanced.appservice.async_media] + ask = "Enable asynchronous media uploads?" + type = "boolean" + yes = "true" + no = "false" + help = "Enable only if HomeServer supports https://github.com/matrix-org/matrix-spec-proposals/pull/2246?" + bind = ":__FINALPATH__/config.yaml" + + [advanced.appservice.ephemeral_events] + ask = "Receive Ephemeral Events via AppService transactions?" + type = "boolean" + yes = "true" + no = "false" + help = "Enable only if HomeServer supports MSC2409 (i.e. Synapse 1.22+). If enabled, you should disable bridge -> 'sync_with_custom_puppets'." + bind = ":__FINALPATH__/config.yaml" + + [advanced.appservice.print_level] + ask = "Logging print level for Standard Output" + type = "select" + choices = ["debug", "info", "warn", "error", "fatal"] + help = "Minimum severity for log messages printed to stdout/stderr. This doesn't affect the log file." + bind = ":__FINALPATH__/config.yaml" + + [advanced.metrics] + name = "Prometheus Metrics" + + [advanced.metrics.enable_metrics] + ask = "Enable Prometheus Metrics?" + type = "boolean" + yes = "true" + no = "false" + bind = "metrics>enabled:__FINALPATH__/config.yaml" + + [advanced.metrics.listen_port] + ask = "IP and Port for the Metrics listener?" + type = "string" + help = "Defaults to: '127.0.0.1:8001'. The path is always /metrics" + bind = "metrics>listen:__FINALPATH__/config.yaml" + visible = "enable_metrics" + From 2440fac35f9041d0c3633ccc105aa84ae274e3f5 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 11:50:14 +0100 Subject: [PATCH 18/46] try improve permission mgmt --- config_panel.toml | 19 +++++++++++-------- scripts/config | 22 +++++++++++++++------- scripts/upgrade | 12 ++++++------ 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 9cee78f..92bbcd6 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,25 +13,26 @@ services = ["__APP__"] - * : All Matrix users - domain.tld : All users on a given homeserver - mxid (@user:matrix.org) : Specific Matrix user + Increasing Power: Relay Date: Thu, 19 Jan 2023 12:02:11 +0100 Subject: [PATCH 19/46] correct reset after upgrade --- scripts/upgrade | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index ee45c7d..5721054 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -306,12 +306,15 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" # Re-apply permissions to avoid wrong syntax "domain.tld,domain2.tld: admin" -yunohost app config get mautrix_whatsapp main.permissions.listuser -yunohost app config set mautrix_whatsapp main.permissions.listuser -yunohost app config get mautrix_whatsapp main.permissions.listrelay -yunohost app config set mautrix_whatsapp main.permissions.listrelay -yunohost app config get mautrix_whatsapp main.permissions.listadmin -yunohost app config set mautrix_whatsapp main.permissions.listadmin +x="$(yunohost app config get mautrix_whatsapp main.permissions.listuser)" +yunohost app config set mautrix_whatsapp main.permissions.listuser -v "" +yunohost app config set mautrix_whatsapp main.permissions.listuser -v "$x" +x="$(yunohost app config get mautrix_whatsapp main.permissions.listrelay)" +yunohost app config set mautrix_whatsapp main.permissions.listrelay -v "" +yunohost app config set mautrix_whatsapp main.permissions.listrelay -v "$x" +x="$(yunohost app config get mautrix_whatsapp main.permissions.listadmin)" +yunohost app config set mautrix_whatsapp main.permissions.listadmin -v "" +yunohost app config set mautrix_whatsapp main.permissions.listadmin -v "$x" #================================================= # END OF SCRIPT From b99c05e5e79f88e1c8c3d48fce7cbccaff7b6b05 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 12:21:25 +0100 Subject: [PATCH 20/46] try --- scripts/config | 84 ++++++++++++++++++++++++++++--------------------- scripts/upgrade | 22 ++++++------- 2 files changed, 59 insertions(+), 47 deletions(-) diff --git a/scripts/config b/scripts/config index 4c22efc..4620850 100644 --- a/scripts/config +++ b/scripts/config @@ -4,30 +4,16 @@ ynh_abort_if_errors final_path=$(ynh_app_setting_get --app=$app --key=final_path) -function get__botname { +#================================================= +# SPECIFIC GETTERS FOR TOML SHORT KEY +#================================================= + +get__botname() { botname=$(ynh_app_setting_get --app $app --key botname) echo "${botname}" } -function set__botname { - old_botname=$(ynh_app_setting_get --app $app --key botname) - if [ "$botname" -eq "$old_botname" ] # Check to avoid updating botname when it's not needed. - then - return - fi - - ynh_app_setting_set --app=$app --key=botname --value="$botname" - synapse_instance=$(ynh_app_setting_get --app $app --key synapse_instance) - - sed -i "s/username:.*/username: $botname/" "$final_path/config.yaml" - "$final_path/mautrix-whatsapp" -g -c "$final_path/config.yaml" -r "/etc/matrix-$synapse_instance/app-service/$app.yaml" - "/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh" || ynh_die --message="Synapse can't restart with the appservice configuration" - chown -R "$app:$app" "$final_path" - ynh_store_file_checksum --file="/etc/matrix-$synapse_instance/app-service/$app.yaml" - ynh_store_file_checksum --file="$final_path/config.yaml" -} - -function get__listuser { +get__listuser() { existingUsers=$(grep -- "\".*: user" "$final_path/config.yaml" | sed -r 's/: user//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',') cat < Date: Thu, 19 Jan 2023 12:49:24 +0100 Subject: [PATCH 21/46] finalize --- config_panel.toml | 20 +++++++++++--------- scripts/install | 2 +- scripts/upgrade | 13 +------------ 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 92bbcd6..27bff09 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -5,33 +5,33 @@ name = "Main Settings" services = ["__APP__"] [main.permissions] - name = "Permissions for using the bridge." + name = "Permissions for using the bridge" [main.permissions.helptext] ask = ''' - Allowed values: + Roles with Increasing Power: Relay Date: Thu, 19 Jan 2023 13:17:53 +0100 Subject: [PATCH 22/46] correct upgrade permissions --- scripts/upgrade | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 3797e14..f7f3d3f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -253,6 +253,10 @@ ynh_script_progression --message="Updating a configuration file..." --weight=2 ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml" +yunohost app config set mautrix_whatsapp main.permissions.listuser +yunohost app config set mautrix_whatsapp main.permissions.listrelay +yunohost app config set mautrix_whatsapp main.permissions.listadmin + chmod 400 "$final_path/config.yaml" chown $app:$app "$final_path/config.yaml" From f36775c04de69a4f5dec278f71f208843169fbe8 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 13:31:13 +0100 Subject: [PATCH 23/46] set list$role in app_setting --- scripts/config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/config b/scripts/config index 4620850..acb53e2 100644 --- a/scripts/config +++ b/scripts/config @@ -94,17 +94,23 @@ set__botname() { set__listuser() { role="user" + ynh_app_setting_set --app=$app --key=listuser --value="$listuser" apply_permissions + ynh_store_file_checksum --file="$final_path/config.yaml" } set__listrelay() { role="relay" + ynh_app_setting_set --app=$app --key=listrelay --value="$listrelay" apply_permissions + ynh_store_file_checksum --file="$final_path/config.yaml" } set__listadmin() { role="admin" + ynh_app_setting_set --app=$app --key=listadmin --value="$listadmin" apply_permissions + ynh_store_file_checksum --file="$final_path/config.yaml" } ynh_app_config_run $1 From 4042f2214bf0702580217cc872f3fe9a634bf45e Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 13:45:38 +0100 Subject: [PATCH 24/46] winner? --- scripts/upgrade | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index f7f3d3f..31844eb 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -51,11 +51,19 @@ encryption_require=$(ynh_app_setting_get --app=$app --key=encryption_require) enable_relaybot=$(ynh_app_setting_get --app=$app --key=enable_relaybot) admin_only=$(ynh_app_setting_get --app=$app --key=admin_only) print_level=$(ynh_app_setting_get --app=$app --key=print_level) + +# reset permissions to be able to apply_permissions with app_setting values after upgrade +listrelay="" +listuser="" +listadmin="" +yunohost app config set mautrix_whatsapp main.permissions.listuser +yunohost app config set mautrix_whatsapp main.permissions.listrelay +yunohost app config set mautrix_whatsapp main.permissions.listadmin + listrelay=$(ynh_app_setting_get --app=$app --key=listrelay) listuser=$(ynh_app_setting_get --app=$app --key=listuser) listadmin=$(ynh_app_setting_get --app=$app --key=listadmin) - #================================================= # CHECK VERSION #================================================= @@ -253,6 +261,7 @@ ynh_script_progression --message="Updating a configuration file..." --weight=2 ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml" +# apply_permissions to have correct syntax in config file yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listrelay yunohost app config set mautrix_whatsapp main.permissions.listadmin From 59154fc4953ae45870b4948d65628a184ea5fe15 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 14:01:12 +0100 Subject: [PATCH 25/46] this is the end? --- scripts/upgrade | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 31844eb..6aee3ba 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -52,6 +52,10 @@ enable_relaybot=$(ynh_app_setting_get --app=$app --key=enable_relaybot) admin_only=$(ynh_app_setting_get --app=$app --key=admin_only) print_level=$(ynh_app_setting_get --app=$app --key=print_level) +listrelay_backup=$(ynh_app_setting_get --app=$app --key=listrelay) +listuser_backup=$(ynh_app_setting_get --app=$app --key=listuser) +listadmin_backup=$(ynh_app_setting_get --app=$app --key=listadmin) + # reset permissions to be able to apply_permissions with app_setting values after upgrade listrelay="" listuser="" @@ -60,9 +64,9 @@ yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listrelay yunohost app config set mautrix_whatsapp main.permissions.listadmin -listrelay=$(ynh_app_setting_get --app=$app --key=listrelay) -listuser=$(ynh_app_setting_get --app=$app --key=listuser) -listadmin=$(ynh_app_setting_get --app=$app --key=listadmin) +listrelay=$listrelay_backup +listuser=$listrelay_backup +listadmin=$listrelay_backup #================================================= # CHECK VERSION From 82483c04513d5993317bce61b8d3c384f376c15d Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 14:10:07 +0100 Subject: [PATCH 26/46] error listrelay="" --- scripts/upgrade | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6aee3ba..0422c5b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -57,12 +57,13 @@ listuser_backup=$(ynh_app_setting_get --app=$app --key=listuser) listadmin_backup=$(ynh_app_setting_get --app=$app --key=listadmin) # reset permissions to be able to apply_permissions with app_setting values after upgrade -listrelay="" -listuser="" -listadmin="" +listrelay="@user:domain.tld" +listuser="@user:domain.tld" +listadmin="@user:domain.tld" yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listrelay yunohost app config set mautrix_whatsapp main.permissions.listadmin +#ynh_store_file_checksum --file="$final_path/config.yaml" listrelay=$listrelay_backup listuser=$listrelay_backup From 3a556d60ec771b3f5bc29c4e30fbfd7a70ebd6a4 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 14:25:23 +0100 Subject: [PATCH 27/46] yaml mapping key "" already --- scripts/upgrade | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0422c5b..bc298fe 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -57,9 +57,9 @@ listuser_backup=$(ynh_app_setting_get --app=$app --key=listuser) listadmin_backup=$(ynh_app_setting_get --app=$app --key=listadmin) # reset permissions to be able to apply_permissions with app_setting values after upgrade -listrelay="@user:domain.tld" +listrelay="@relay:domain.tld" listuser="@user:domain.tld" -listadmin="@user:domain.tld" +listadmin="@admin:domain.tld" yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listrelay yunohost app config set mautrix_whatsapp main.permissions.listadmin @@ -266,14 +266,14 @@ ynh_script_progression --message="Updating a configuration file..." --weight=2 ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml" +chmod 400 "$final_path/config.yaml" +chown $app:$app "$final_path/config.yaml" + # apply_permissions to have correct syntax in config file yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listrelay yunohost app config set mautrix_whatsapp main.permissions.listadmin -chmod 400 "$final_path/config.yaml" -chown $app:$app "$final_path/config.yaml" - #================================================= # REGISTER SYNAPSE APP-SERVICE #================================================= From 745a07d14973b0e97ba410e52229193cd6f4064b Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 14:34:32 +0100 Subject: [PATCH 28/46] again --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index bc298fe..2d9afc3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -57,7 +57,7 @@ listuser_backup=$(ynh_app_setting_get --app=$app --key=listuser) listadmin_backup=$(ynh_app_setting_get --app=$app --key=listadmin) # reset permissions to be able to apply_permissions with app_setting values after upgrade -listrelay="@relay:domain.tld" +listrelay="*" listuser="@user:domain.tld" listadmin="@admin:domain.tld" yunohost app config set mautrix_whatsapp main.permissions.listuser From 4cae1e27225456c4586d8023615ed4f8bad4834a Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 20:26:03 +0100 Subject: [PATCH 29/46] order matters? --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2d9afc3..e8b0728 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -60,8 +60,8 @@ listadmin_backup=$(ynh_app_setting_get --app=$app --key=listadmin) listrelay="*" listuser="@user:domain.tld" listadmin="@admin:domain.tld" -yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listrelay +yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listadmin #ynh_store_file_checksum --file="$final_path/config.yaml" @@ -270,8 +270,8 @@ chmod 400 "$final_path/config.yaml" chown $app:$app "$final_path/config.yaml" # apply_permissions to have correct syntax in config file -yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listrelay +yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listadmin #================================================= From 05f9699eae0aceaa1147d5d10033983ea927c6f6 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 20:40:42 +0100 Subject: [PATCH 30/46] should work... --- scripts/upgrade | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e8b0728..8db8256 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -52,22 +52,9 @@ enable_relaybot=$(ynh_app_setting_get --app=$app --key=enable_relaybot) admin_only=$(ynh_app_setting_get --app=$app --key=admin_only) print_level=$(ynh_app_setting_get --app=$app --key=print_level) -listrelay_backup=$(ynh_app_setting_get --app=$app --key=listrelay) -listuser_backup=$(ynh_app_setting_get --app=$app --key=listuser) -listadmin_backup=$(ynh_app_setting_get --app=$app --key=listadmin) - -# reset permissions to be able to apply_permissions with app_setting values after upgrade -listrelay="*" -listuser="@user:domain.tld" -listadmin="@admin:domain.tld" -yunohost app config set mautrix_whatsapp main.permissions.listrelay -yunohost app config set mautrix_whatsapp main.permissions.listuser -yunohost app config set mautrix_whatsapp main.permissions.listadmin -#ynh_store_file_checksum --file="$final_path/config.yaml" - -listrelay=$listrelay_backup -listuser=$listrelay_backup -listadmin=$listrelay_backup +listrelay=$(ynh_app_setting_get --app=$app --key=listrelay) +listuser=$(ynh_app_setting_get --app=$app --key=listuser) +listadmin=$(ynh_app_setting_get --app=$app --key=listadmin) #================================================= # CHECK VERSION @@ -264,11 +251,29 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=2 +listrelay_=$listrelay +listuser_=$listuser +listadmin_=$listadmin + +# reset permissions to be able to apply_permissions with app_setting values after upgrade +listrelay="*" +listuser="@user:domain.tld" +listadmin="@admin:domain.tld" + ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml" chmod 400 "$final_path/config.yaml" chown $app:$app "$final_path/config.yaml" +yunohost app config set mautrix_whatsapp main.permissions.listrelay +yunohost app config set mautrix_whatsapp main.permissions.listuser +yunohost app config set mautrix_whatsapp main.permissions.listadmin +#ynh_store_file_checksum --file="$final_path/config.yaml" + +listrelay=$listrelay_ +listuser=$listuser_ +listadmin=$listadmin_ + # apply_permissions to have correct syntax in config file yunohost app config set mautrix_whatsapp main.permissions.listrelay yunohost app config set mautrix_whatsapp main.permissions.listuser From dbdbff36a16f5aa759ab23df521bb30aabf9e6f7 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 20:51:34 +0100 Subject: [PATCH 31/46] again --- scripts/upgrade | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8db8256..6cba70e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -265,19 +265,20 @@ ynh_add_config --template="../conf/config.yaml" --destination="$final_path/confi chmod 400 "$final_path/config.yaml" chown $app:$app "$final_path/config.yaml" -yunohost app config set mautrix_whatsapp main.permissions.listrelay -yunohost app config set mautrix_whatsapp main.permissions.listuser -yunohost app config set mautrix_whatsapp main.permissions.listadmin -#ynh_store_file_checksum --file="$final_path/config.yaml" - listrelay=$listrelay_ listuser=$listuser_ listadmin=$listadmin_ -# apply_permissions to have correct syntax in config file yunohost app config set mautrix_whatsapp main.permissions.listrelay yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listadmin +# ynh_store_file_checksum --file="$final_path/config.yaml" + + +# apply_permissions to have correct syntax in config file +# yunohost app config set mautrix_whatsapp main.permissions.listrelay +# yunohost app config set mautrix_whatsapp main.permissions.listuser +# yunohost app config set mautrix_whatsapp main.permissions.listadmin #================================================= # REGISTER SYNAPSE APP-SERVICE From bf7d293c63d48c51e64b5faac862c5bd45415064 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 21:14:25 +0100 Subject: [PATCH 32/46] alltogether --- scripts/upgrade | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6cba70e..473da6a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -265,20 +265,25 @@ ynh_add_config --template="../conf/config.yaml" --destination="$final_path/confi chmod 400 "$final_path/config.yaml" chown $app:$app "$final_path/config.yaml" -listrelay=$listrelay_ -listuser=$listuser_ -listadmin=$listadmin_ +ynh_store_file_checksum --file="$final_path/config.yaml" +ynh_app_setting_set --app=$app --key=listrelay --value=$listrelay +ynh_app_setting_set --app=$app --key=listuser --value=$listuser +ynh_app_setting_set --app=$app --key=listadmin --value=$listadmin yunohost app config set mautrix_whatsapp main.permissions.listrelay yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listadmin -# ynh_store_file_checksum --file="$final_path/config.yaml" +listrelay=$listrelay_ +listuser=$listuser_ +listadmin=$listadmin_ + +ynh_store_file_checksum --file="$final_path/config.yaml" # apply_permissions to have correct syntax in config file -# yunohost app config set mautrix_whatsapp main.permissions.listrelay -# yunohost app config set mautrix_whatsapp main.permissions.listuser -# yunohost app config set mautrix_whatsapp main.permissions.listadmin +yunohost app config set mautrix_whatsapp main.permissions.listrelay +yunohost app config set mautrix_whatsapp main.permissions.listuser +yunohost app config set mautrix_whatsapp main.permissions.listadmin #================================================= # REGISTER SYNAPSE APP-SERVICE From 354343c9d4d6239163ac3592601e0ae30597513b Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 21:35:17 +0100 Subject: [PATCH 33/46] ugly --- scripts/upgrade | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 473da6a..5a5bdc0 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -265,20 +265,32 @@ ynh_add_config --template="../conf/config.yaml" --destination="$final_path/confi chmod 400 "$final_path/config.yaml" chown $app:$app "$final_path/config.yaml" -ynh_store_file_checksum --file="$final_path/config.yaml" -ynh_app_setting_set --app=$app --key=listrelay --value=$listrelay -ynh_app_setting_set --app=$app --key=listuser --value=$listuser -ynh_app_setting_set --app=$app --key=listadmin --value=$listadmin +listrelay = "$(yunohost app config get $app main.permissions.listrelay)" +listuser = "$(yunohost app config get $app main.permissions.listuser)" +listadmin = "$(yunohost app config get $app main.permissions.listadmin)" + +listrelay="*" +listuser="@user:domain.tld" +listadmin="@admin:domain.tld" + +# ynh_store_file_checksum --file="$final_path/config.yaml" +# ynh_app_setting_set --app=$app --key=listrelay --value=$listrelay +# ynh_app_setting_set --app=$app --key=listuser --value=$listuser +# ynh_app_setting_set --app=$app --key=listadmin --value=$listadmin yunohost app config set mautrix_whatsapp main.permissions.listrelay yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listadmin +listrelay = "$(yunohost app config get $app main.permissions.listrelay)" +listuser = "$(yunohost app config get $app main.permissions.listuser)" +listadmin = "$(yunohost app config get $app main.permissions.listadmin)" + listrelay=$listrelay_ listuser=$listuser_ listadmin=$listadmin_ -ynh_store_file_checksum --file="$final_path/config.yaml" +# ynh_store_file_checksum --file="$final_path/config.yaml" # apply_permissions to have correct syntax in config file yunohost app config set mautrix_whatsapp main.permissions.listrelay From 6e0cd33253dfadf32989cfae9d63abbfa25e32f3 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 21:40:33 +0100 Subject: [PATCH 34/46] typo --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5a5bdc0..2638343 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -265,9 +265,9 @@ ynh_add_config --template="../conf/config.yaml" --destination="$final_path/confi chmod 400 "$final_path/config.yaml" chown $app:$app "$final_path/config.yaml" -listrelay = "$(yunohost app config get $app main.permissions.listrelay)" -listuser = "$(yunohost app config get $app main.permissions.listuser)" -listadmin = "$(yunohost app config get $app main.permissions.listadmin)" +listrelay="$(yunohost app config get $app main.permissions.listrelay)" +listuser="$(yunohost app config get $app main.permissions.listuser)" +listadmin="$(yunohost app config get $app main.permissions.listadmin)" listrelay="*" listuser="@user:domain.tld" From e7dbf77a5abf36ee10c09a9b70c509f94c07fa2c Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 21:49:45 +0100 Subject: [PATCH 35/46] typo --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2638343..16a6d17 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -282,9 +282,9 @@ yunohost app config set mautrix_whatsapp main.permissions.listrelay yunohost app config set mautrix_whatsapp main.permissions.listuser yunohost app config set mautrix_whatsapp main.permissions.listadmin -listrelay = "$(yunohost app config get $app main.permissions.listrelay)" -listuser = "$(yunohost app config get $app main.permissions.listuser)" -listadmin = "$(yunohost app config get $app main.permissions.listadmin)" +listrelay="$(yunohost app config get $app main.permissions.listrelay)" +listuser="$(yunohost app config get $app main.permissions.listuser)" +listadmin="$(yunohost app config get $app main.permissions.listadmin)" listrelay=$listrelay_ listuser=$listuser_ From c4a9a5e63afc4b51b228ed98bb15f562da4c0a96 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Fri, 20 Jan 2023 07:01:22 +0100 Subject: [PATCH 36/46] -v $listrelay --- scripts/upgrade | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 16a6d17..4bd25ae 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -251,11 +251,10 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=2 +# reset permissions to be able to apply_permissions with app_setting values after upgrade listrelay_=$listrelay listuser_=$listuser listadmin_=$listadmin - -# reset permissions to be able to apply_permissions with app_setting values after upgrade listrelay="*" listuser="@user:domain.tld" listadmin="@admin:domain.tld" @@ -265,37 +264,13 @@ ynh_add_config --template="../conf/config.yaml" --destination="$final_path/confi chmod 400 "$final_path/config.yaml" chown $app:$app "$final_path/config.yaml" -listrelay="$(yunohost app config get $app main.permissions.listrelay)" -listuser="$(yunohost app config get $app main.permissions.listuser)" -listadmin="$(yunohost app config get $app main.permissions.listadmin)" - -listrelay="*" -listuser="@user:domain.tld" -listadmin="@admin:domain.tld" - -# ynh_store_file_checksum --file="$final_path/config.yaml" -# ynh_app_setting_set --app=$app --key=listrelay --value=$listrelay -# ynh_app_setting_set --app=$app --key=listuser --value=$listuser -# ynh_app_setting_set --app=$app --key=listadmin --value=$listadmin - -yunohost app config set mautrix_whatsapp main.permissions.listrelay -yunohost app config set mautrix_whatsapp main.permissions.listuser -yunohost app config set mautrix_whatsapp main.permissions.listadmin - -listrelay="$(yunohost app config get $app main.permissions.listrelay)" -listuser="$(yunohost app config get $app main.permissions.listuser)" -listadmin="$(yunohost app config get $app main.permissions.listadmin)" - +# apply_permissions to have correct syntax in config file listrelay=$listrelay_ listuser=$listuser_ listadmin=$listadmin_ - -# ynh_store_file_checksum --file="$final_path/config.yaml" - -# apply_permissions to have correct syntax in config file -yunohost app config set mautrix_whatsapp main.permissions.listrelay -yunohost app config set mautrix_whatsapp main.permissions.listuser -yunohost app config set mautrix_whatsapp main.permissions.listadmin +yunohost app config set mautrix_whatsapp main.permissions.listrelay -v $listrelay +yunohost app config set mautrix_whatsapp main.permissions.listuser -v $listuser +yunohost app config set mautrix_whatsapp main.permissions.listadmin -v $listadmin #================================================= # REGISTER SYNAPSE APP-SERVICE From b6cd72bc7b8224d1579d0795a3ba371a96935954 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Fri, 20 Jan 2023 07:10:33 +0100 Subject: [PATCH 37/46] typo --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 4bd25ae..bd0b9ce 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -268,9 +268,9 @@ chown $app:$app "$final_path/config.yaml" listrelay=$listrelay_ listuser=$listuser_ listadmin=$listadmin_ -yunohost app config set mautrix_whatsapp main.permissions.listrelay -v $listrelay -yunohost app config set mautrix_whatsapp main.permissions.listuser -v $listuser -yunohost app config set mautrix_whatsapp main.permissions.listadmin -v $listadmin +yunohost app config set $app main.permissions.listrelay -v "$listrelay" +yunohost app config set $app main.permissions.listuser -v "$listuser" +yunohost app config set $app main.permissions.listadmin -v "$listadmin" #================================================= # REGISTER SYNAPSE APP-SERVICE From febe7bab2f9c561bf40f955ae6ab82e0ac956528 Mon Sep 17 00:00:00 2001 From: Mayeul Cantan Date: Fri, 20 Jan 2023 11:53:50 +0100 Subject: [PATCH 38/46] Fix translation typo --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index be6513d..5cd330b 100644 --- a/manifest.json +++ b/manifest.json @@ -108,7 +108,7 @@ "default": "local", "help": { "en": "Either all local Synapse users (local), a remote or local user (@johndoe:server.name), a remote server (matrix.org), or all remote/local servers (*) can be authorized. Give the Matrix server_name, not the full domain/URL.", - "fr": "Soir tous les comptes Synapse locaux (local), un compte local ou distant (@johndoe:server.name), un serveur distant (matrix.org), ou tous les serveurs remote/local (*). Donner le nom du serveur Matrix, pas le domaine/URL complet." + "fr": "Soit tous les comptes Synapse locaux (local), un compte local ou distant (@johndoe:server.name), un serveur distant (matrix.org), ou tous les serveurs remote/local (*). Donner le nom du serveur Matrix, pas le domaine/URL complet." } } ] From 07d4adb8e0c6918e83a4fe0e49f3151d6ba5866e Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Mon, 30 Jan 2023 18:20:14 +0100 Subject: [PATCH 39/46] config set after service start --- scripts/upgrade | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 26293c0..5110b2a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -284,13 +284,14 @@ ynh_add_config --template="../conf/config.yaml" --destination="$final_path/confi chmod 400 "$final_path/config.yaml" chown $app:$app "$final_path/config.yaml" -# apply_permissions to have correct syntax in config file listrelay=$listrelay_ listuser=$listuser_ listadmin=$listadmin_ -yunohost app config set $app main.permissions.listrelay -v "$listrelay" -yunohost app config set $app main.permissions.listuser -v "$listuser" -yunohost app config set $app main.permissions.listadmin -v "$listadmin" +# MIGRATION from previous version without config panel -> config panel does not exist yet, so we upgrade the config after starting the systemd service +# apply_permissions to have correct syntax in config file +#yunohost app config set $app main.permissions.listrelay -v "$listrelay" +#yunohost app config set $app main.permissions.listuser -v "$listuser" +#yunohost app config set $app main.permissions.listadmin -v "$listadmin" #================================================= # REGISTER SYNAPSE APP-SERVICE @@ -341,6 +342,12 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" +# MIGRATION from previous version without config panel -> config panel does not exist yet, so we upgrade the config after starting the systemd service +# apply_permissions to have correct syntax in config file +yunohost app config set $app main.permissions.listrelay -v "$listrelay" +yunohost app config set $app main.permissions.listuser -v "$listuser" +yunohost app config set $app main.permissions.listadmin -v "$listadmin" + #================================================= # END OF SCRIPT #================================================= From 8a927fba0e1c46ed473f5d1c117addda41b50aa6 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 30 Jan 2023 17:20:17 +0000 Subject: [PATCH 40/46] 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 b59f872..4bc2f65 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Matrix-WhatsApp bridge for YunoHost -[![Integration level](https://dash.yunohost.org/integration/mautrix_whatsapp.svg)](https://dash.yunohost.org/appci/app/mautrix_whatsapp) ![Working status](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/mautrix_whatsapp.svg)](https://dash.yunohost.org/appci/app/mautrix_whatsapp) ![Working status](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.maintain.svg) [![Install Matrix-WhatsApp bridge with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mautrix_whatsapp) *[Lire ce readme en français.](./README_fr.md)* diff --git a/README_fr.md b/README_fr.md index e4e77c2..b0681c4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Matrix-WhatsApp bridge pour YunoHost -[![Niveau d’intégration](https://dash.yunohost.org/integration/mautrix_whatsapp.svg)](https://dash.yunohost.org/appci/app/mautrix_whatsapp) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/mautrix_whatsapp.svg)](https://dash.yunohost.org/appci/app/mautrix_whatsapp) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.maintain.svg) [![Installer Matrix-WhatsApp bridge avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mautrix_whatsapp) *[Read this readme in english.](./README.md)* From e1fb76799c319bd84ac6ff5d7bdefeab38bcf940 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 6 Feb 2023 19:40:09 +0100 Subject: [PATCH 41/46] Upgrade to version 0.8.1 (#86) * Upgrade to v0.8.1 * Auto-update README * Add new config options --------- Co-authored-by: yunohost-bot Co-authored-by: yunohost-bot Co-authored-by: Dante --- README.md | 2 +- README_fr.md | 2 +- conf/amd64.src | 4 ++-- conf/arm64.src | 4 ++-- conf/armhf.src | 4 ++-- conf/config.yaml | 10 ++++++++++ manifest.json | 2 +- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4bc2f65..6fbd8bb 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Therefore, [Synapse for YunoHost](https://github.com/YunoHost-Apps/synapse_ynh) ** Attention: always backup and restore the Yunohost matrix_synapse et mautrix_whatsapp apps together!** -**Shipped version:** 0.8.0~ynh1 +**Shipped version:** 0.8.1~ynh1 ## Disclaimers / important information ## List of known public services diff --git a/README_fr.md b/README_fr.md index b0681c4..821a823 100644 --- a/README_fr.md +++ b/README_fr.md @@ -24,7 +24,7 @@ C'est pourquoi [Synapse for YunoHost](https://github.com/YunoHost-Apps/synapse_y ** Attention : sauvegardez et restaurez toujours les deux applications Yunohost matrix_synapse et mautrix_whatsapp en même temps!** -**Version incluse :** 0.8.0~ynh1 +**Version incluse :** 0.8.1~ynh1 ## Avertissements / informations importantes ## Liste de passerelles publiques diff --git a/conf/amd64.src b/conf/amd64.src index 17056fd..e0b3a81 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/mautrix/whatsapp/releases/download/v0.8.0/mautrix-whatsapp-amd64 -SOURCE_SUM=b7fcef1d665c08fb3fd0c24f65ab179aeef24d1558ef539374887f635bcd7c0e +SOURCE_URL=https://github.com/mautrix/whatsapp/releases/download/v0.8.1/mautrix-whatsapp-amd64 +SOURCE_SUM=d50af9a4c65593bff3bb3a10382567505cde79929856304f35ae083066955d55 SOURCE_SUM_PRG=sha256sum SOURCE_IN_SUBDIR=false SOURCE_FILENAME=mautrix-whatsapp diff --git a/conf/arm64.src b/conf/arm64.src index 3916508..4807a62 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/mautrix/whatsapp/releases/download/v0.8.0/mautrix-whatsapp-arm64 -SOURCE_SUM=389f126bb25ad0d8173a761f59a731a351eb02f1d95478cc5e3e2af1ff97b1c3 +SOURCE_URL=https://github.com/mautrix/whatsapp/releases/download/v0.8.1/mautrix-whatsapp-arm64 +SOURCE_SUM=49e1b5308fd8b90e0871b27aa2febc324fbd78c175815312865b54102d04c966 SOURCE_SUM_PRG=sha256sum SOURCE_IN_SUBDIR=false SOURCE_FILENAME=mautrix-whatsapp diff --git a/conf/armhf.src b/conf/armhf.src index 5296888..4a8213c 100644 --- a/conf/armhf.src +++ b/conf/armhf.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/mautrix/whatsapp/releases/download/v0.8.0/mautrix-whatsapp-arm -SOURCE_SUM=5ebe0488106ed1377a76380639a41eca473eafb3b8f24396005a2999a350de46 +SOURCE_URL=https://github.com/mautrix/whatsapp/releases/download/v0.8.1/mautrix-whatsapp-arm +SOURCE_SUM=5f734a40793fc7223b6e15d781f02fae222507c125d12995a85bbb79e1e4370d SOURCE_SUM_PRG=sha256sum SOURCE_IN_SUBDIR=false SOURCE_FILENAME=mautrix-whatsapp diff --git a/conf/config.yaml b/conf/config.yaml index 43ad784..9d0ede6 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -137,6 +137,16 @@ bridge: # Should the bridge request a full sync from the phone when logging in? # This bumps the size of history syncs from 3 months to 1 year. request_full_sync: false + # Configuration parameters that are sent to the phone along with the request full sync flag. + # By default (when the values are null or 0), the config isn't sent at all. + full_sync_config: + # Number of days of history to request. + # The limit seems to be around 3 years, but using higher values doesn't break. + days_limit: null + # This is presumably the maximum size of the transferred history sync blob, which may affect what the phone includes in the blob. + size_mb_limit: null + # This is presumably the local storage quota, which may affect what the phone includes in the history sync blob. + storage_quota_mb: null # Settings for media requests. If the media expired, then it will not # be on the WA servers. # Media can always be requested by reacting with the ♻️ (recycle) emoji. diff --git a/manifest.json b/manifest.json index 5cd330b..3a353cc 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Matrix / Synapse puppeting bridge for WhatsApp", "fr": "Passerelle Matrix / Synapse pour WhatsApp" }, - "version": "0.8.0~ynh1", + "version": "0.8.1~ynh1", "url": "https://github.com/mautrix/whatsapp", "upstream": { "license": "AGPL-3.0-or-later", From 95c125fe76219b4ff5dfb2ab0f93cbab94384fbe Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Mon, 6 Feb 2023 19:45:11 +0100 Subject: [PATCH 42/46] check upgrade from 0.4.0 and 0.6.1 --- check_process | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/check_process b/check_process index 8e8ca52..a30309e 100644 --- a/check_process +++ b/check_process @@ -17,17 +17,17 @@ setup_private=0 setup_public=0 upgrade=1 - # 0.3.0 - upgrade=1 from_commit=42df5b910927283241e185dcb8a62089adeb9c85 - # 0.2.4 - upgrade=1 from_commit=23cd51919e2b09865256a21214865d798bd843f6 + # 0.4.0 + upgrade=1 from_commit=717b32f454819c1bb936152c69d9693d34434741 + # 0.6.1 + upgrade=1 from_commit=fdd1e0ff652ae47b5e3c62477eea678c465659cf backup_restore=1 multi_instance=1 ;;; Options Email= Notification=none ;;; Upgrade options - ; commit=42df5b910927283241e185dcb8a62089adeb9c85 - name=0.3.0 - ; commit=23cd51919e2b09865256a21214865d798bd843f6 - name=0.2.4 + ; commit=717b32f454819c1bb936152c69d9693d34434741 + name=0.4.0 + ; commit=fdd1e0ff652ae47b5e3c62477eea678c465659cf + name=0.6.1 From 8e4713f642074b1aded82c0fc2f9ecbe4183f809 Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Thu, 9 Feb 2023 21:29:08 +0100 Subject: [PATCH 43/46] config setters in common for upgrade --- scripts/_common.sh | 58 ++++++++++++++++++++++++++++++++++++++++------ scripts/config | 51 +--------------------------------------- scripts/upgrade | 14 ++++------- 3 files changed, 56 insertions(+), 67 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index a73f262..1aa2562 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,13 +8,57 @@ pkg_dependencies="g++ postgresql ffmpeg" #================================================= -# PERSONAL HELPERS +# CONFIG PANEL SETTERS #================================================= -#================================================= -# EXPERIMENTAL HELPERS -#================================================= +apply_permissions() { + set -o noglob # Disable globbing to avoid expansions when passing * as value. + declare values="list$role" + newValues="${!values}" # Here we expand the dynamic variable we created in the previous line. ! Does the trick + newValues="${newValues//\"}" + usersArray=(${newValues//,/ }) # Split the values using comma (,) as separator. -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= + if [ -n "$newValues" ] + then + #ynh_systemd_action --service_name="$app" --action=stop + # Get all entries between "permissions:" and "relay:" keys, remove the role part, remove commented parts, format it with newlines and clean whitespaces and double quotes. + allDefinedEntries=$(awk '/permissions:/{flag=1; next} /relay:/{flag=0} flag' "$final_path/config.yaml" | sed "/: $role/d" | sed -r 's/: (admin|user|relay)//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr ',' '\n' ) + # Delete everything from the corresponding role to insert the new defined values. This way we also handle deletion of users. + sed -i "/permissions:/,/relay:/{/: $role/d;}" "$final_path/config.yaml" + for user in "${usersArray[@]}" + do + if grep -q -x "${user}" <<< "$allDefinedEntries" + then + ynh_print_info "User $user already defined in another role." + else + sed -i "/permissions:/a \ \\\"$user\": $role" "$final_path/config.yaml" # Whitespaces are needed so that the file can be correctly parsed + fi + done + fi + set +o noglob + + ynh_print_info "Users with role $role added in $final_path/config.yaml" +} + + + +set__listuser() { + role="user" + ynh_app_setting_set --app=$app --key=listuser --value="$listuser" + apply_permissions + ynh_store_file_checksum --file="$final_path/config.yaml" +} + +set__listrelay() { + role="relay" + ynh_app_setting_set --app=$app --key=listrelay --value="$listrelay" + apply_permissions + ynh_store_file_checksum --file="$final_path/config.yaml" +} + +set__listadmin() { + role="admin" + ynh_app_setting_set --app=$app --key=listadmin --value="$listadmin" + apply_permissions + ynh_store_file_checksum --file="$final_path/config.yaml" +} \ No newline at end of file diff --git a/scripts/config b/scripts/config index acb53e2..b1a5de1 100644 --- a/scripts/config +++ b/scripts/config @@ -1,4 +1,5 @@ #!/bin/bash +source _common.sh source /usr/share/yunohost/helpers ynh_abort_if_errors @@ -45,35 +46,6 @@ EOF # SPECIFIC SETTERS FOR TOML SHORT KEYS #================================================= -apply_permissions() { - set -o noglob # Disable globbing to avoid expansions when passing * as value. - declare values="list$role" - newValues="${!values}" # Here we expand the dynamic variable we created in the previous line. ! Does the trick - newValues="${newValues//\"}" - usersArray=(${newValues//,/ }) # Split the values using comma (,) as separator. - - if [ -n "$newValues" ] - then - #ynh_systemd_action --service_name="$app" --action=stop - # Get all entries between "permissions:" and "relay:" keys, remove the role part, remove commented parts, format it with newlines and clean whitespaces and double quotes. - allDefinedEntries=$(awk '/permissions:/{flag=1; next} /relay:/{flag=0} flag' "$final_path/config.yaml" | sed "/: $role/d" | sed -r 's/: (admin|user|relay)//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr ',' '\n' ) - # Delete everything from the corresponding role to insert the new defined values. This way we also handle deletion of users. - sed -i "/permissions:/,/relay:/{/: $role/d;}" "$final_path/config.yaml" - for user in "${usersArray[@]}" - do - if grep -q -x "${user}" <<< "$allDefinedEntries" - then - ynh_print_info "User $user already defined in another role." - else - sed -i "/permissions:/a \ \\\"$user\": $role" "$final_path/config.yaml" # Whitespaces are needed so that the file can be correctly parsed - fi - done - fi - set +o noglob - - ynh_print_info "Users with role $role added in $final_path/config.yaml" -} - set__botname() { old_botname=$(ynh_app_setting_get --app $app --key botname) if [ "$botname" -eq "$old_botname" ] # Check to avoid updating botname when it's not needed. @@ -92,25 +64,4 @@ set__botname() { ynh_store_file_checksum --file="$final_path/config.yaml" } -set__listuser() { - role="user" - ynh_app_setting_set --app=$app --key=listuser --value="$listuser" - apply_permissions - ynh_store_file_checksum --file="$final_path/config.yaml" -} - -set__listrelay() { - role="relay" - ynh_app_setting_set --app=$app --key=listrelay --value="$listrelay" - apply_permissions - ynh_store_file_checksum --file="$final_path/config.yaml" -} - -set__listadmin() { - role="admin" - ynh_app_setting_set --app=$app --key=listadmin --value="$listadmin" - apply_permissions - ynh_store_file_checksum --file="$final_path/config.yaml" -} - ynh_app_config_run $1 diff --git a/scripts/upgrade b/scripts/upgrade index 5110b2a..90e378a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -287,11 +287,11 @@ chown $app:$app "$final_path/config.yaml" listrelay=$listrelay_ listuser=$listuser_ listadmin=$listadmin_ -# MIGRATION from previous version without config panel -> config panel does not exist yet, so we upgrade the config after starting the systemd service + # apply_permissions to have correct syntax in config file -#yunohost app config set $app main.permissions.listrelay -v "$listrelay" -#yunohost app config set $app main.permissions.listuser -v "$listuser" -#yunohost app config set $app main.permissions.listadmin -v "$listadmin" +yunohost app config set $app main.permissions.listrelay -v "$listrelay" +yunohost app config set $app main.permissions.listuser -v "$listuser" +yunohost app config set $app main.permissions.listadmin -v "$listadmin" #================================================= # REGISTER SYNAPSE APP-SERVICE @@ -342,12 +342,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" -# MIGRATION from previous version without config panel -> config panel does not exist yet, so we upgrade the config after starting the systemd service -# apply_permissions to have correct syntax in config file -yunohost app config set $app main.permissions.listrelay -v "$listrelay" -yunohost app config set $app main.permissions.listuser -v "$listuser" -yunohost app config set $app main.permissions.listadmin -v "$listadmin" - #================================================= # END OF SCRIPT #================================================= From 5194006b319775013e264878ba1ea41e63b302d5 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 24 Feb 2023 00:19:02 +0100 Subject: [PATCH 44/46] [autopatch] Upgrade auto-updater --- .github/workflows/updater.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index fb72ba0..a56d7cb 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Fetch the source code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - name: Run the updater script @@ -33,7 +33,7 @@ jobs: - name: Create Pull Request id: cpr if: ${{ env.PROCEED == 'true' }} - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: Update to version ${{ env.VERSION }} From 2bb7fcf0fdc025184d1abca0c69be0eee9b07c41 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 23 Feb 2023 23:19:04 +0000 Subject: [PATCH 45/46] Auto-update README --- README.md | 1 + README_fr.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 6fbd8bb..d8fb8e2 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ It shall NOT be edited by hand. # Matrix-WhatsApp bridge for YunoHost [![Integration level](https://dash.yunohost.org/integration/mautrix_whatsapp.svg)](https://dash.yunohost.org/appci/app/mautrix_whatsapp) ![Working status](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.maintain.svg) + [![Install Matrix-WhatsApp bridge with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mautrix_whatsapp) *[Lire ce readme en français.](./README_fr.md)* diff --git a/README_fr.md b/README_fr.md index 821a823..67862ca 100644 --- a/README_fr.md +++ b/README_fr.md @@ -6,6 +6,7 @@ It shall NOT be edited by hand. # Matrix-WhatsApp bridge pour YunoHost [![Niveau d’intégration](https://dash.yunohost.org/integration/mautrix_whatsapp.svg)](https://dash.yunohost.org/appci/app/mautrix_whatsapp) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/mautrix_whatsapp.maintain.svg) + [![Installer Matrix-WhatsApp bridge avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mautrix_whatsapp) *[Read this readme in english.](./README.md)* From 16208c1f17a2609c2ad5a69ad87c56b432e0fdf7 Mon Sep 17 00:00:00 2001 From: Dante Date: Tue, 28 Feb 2023 18:45:01 +0000 Subject: [PATCH 46/46] Fix upgrade when restoring permissions --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 90e378a..7a9535b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -289,9 +289,9 @@ listuser=$listuser_ listadmin=$listadmin_ # apply_permissions to have correct syntax in config file -yunohost app config set $app main.permissions.listrelay -v "$listrelay" -yunohost app config set $app main.permissions.listuser -v "$listuser" -yunohost app config set $app main.permissions.listadmin -v "$listadmin" +set__listuser +set__listrelay +set__listadmin #================================================= # REGISTER SYNAPSE APP-SERVICE