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 }}
diff --git a/README.md b/README.md
index b59f872..d8fb8e2 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,8 @@ It shall NOT be edited by hand.
# Matrix-WhatsApp bridge for YunoHost
-[](https://dash.yunohost.org/appci/app/mautrix_whatsapp)  
+[](https://dash.yunohost.org/appci/app/mautrix_whatsapp)  
+
[](https://install-app.yunohost.org/?app=mautrix_whatsapp)
*[Lire ce readme en français.](./README_fr.md)*
@@ -24,7 +25,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 e4e77c2..67862ca 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -5,7 +5,8 @@ It shall NOT be edited by hand.
# Matrix-WhatsApp bridge pour YunoHost
-[](https://dash.yunohost.org/appci/app/mautrix_whatsapp)  
+[](https://dash.yunohost.org/appci/app/mautrix_whatsapp)  
+
[](https://install-app.yunohost.org/?app=mautrix_whatsapp)
*[Read this readme in english.](./README.md)*
@@ -24,7 +25,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/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
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 4f40caa..9d0ede6 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.
@@ -56,13 +56,13 @@ appservice:
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: 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__
# Should incoming events be handled asynchronously?
# This may be necessary for large public instances with lots of messages going through.
@@ -79,24 +79,24 @@ segment_key: null
# Prometheus config.
metrics:
# Enable prometheus metrics?
- enabled: false
+ enabled: __ENABLE_METRICS__
# IP and port where the metrics listener should be. The path is always /metrics
- listen: 127.0.0.1:8001
+ listen: __LISTEN_PORT__
# 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
@@ -107,9 +107,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.
@@ -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.
@@ -226,7 +236,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)?
#
@@ -298,7 +308,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
@@ -342,11 +352,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: __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: false
+ 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
@@ -403,20 +413,18 @@ 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:
# 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: __ENABLE_RELAYBOT__
# 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 }}"
@@ -445,4 +453,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/config_panel.toml b/config_panel.toml
new file mode 100644
index 0000000..27bff09
--- /dev/null
+++ b/config_panel.toml
@@ -0,0 +1,219 @@
+version = "1.0"
+
+[main]
+name = "Main Settings"
+services = ["__APP__"]
+
+ [main.permissions]
+ name = "Permissions for using the bridge"
+
+ [main.permissions.helptext]
+ ask = '''
+ Roles with Increasing Power: Relay0.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"
-
-# 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
+# DB Backup missing because of wrong Upgrade from <=0.2.0
if [ -z "$botname" ]
then
botname=$(ynh_app_setting_get --app=$app --key=whatsappbot)
@@ -97,26 +107,126 @@ 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
fi
+ynh_app_setting_delete --app=$app --key=whatsappbot
+ynh_app_setting_delete --app=$app --key=mautrix_whatsapp_db_name
+ynh_app_setting_delete --app=$app --key=mautrix_whatsapp_db_pwd
-# If appserviceid doesn't exist, create it
-if [ -z "$appserviceid" ]
+# SET STANDARD SETTINGS FROM DEFAULT CONFIG
+
+if [ -z "$async_media" ]
then
- appserviceid=$app
- ynh_app_setting_set --app=$app --key=appserviceid --value=$appserviceid
+ async_media="false"
+ ynh_app_setting_set --app=$app --key=async_media --value=$async_media
+fi
+if [ -z "$displayname" ]
+then
+ displayname="WhatsApp bridge bot"
+ ynh_app_setting_set --app=$app --key=displayname --value=$displayname
+fi
+if [ -z "$avatar" ]
+then
+ avatar="mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr"
+ ynh_app_setting_set --app=$app --key=avatar --value=$avatar
+fi
+if [ -z "$ephemeral_events" ]
+then
+ 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 "$listen_port" ]
+then
+ 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
+ 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 "$listrelay" ]
+then
+ listrelay="*"
+ ynh_app_setting_set --app=$app --key=listrelay --value=$listrelay
+fi
+if [ -z "$enable_relaybot" ]
+then
+ enable_relaybot="true"
+ ynh_app_setting_set --app=$app --key=enable_relaybot --value=$enable_relaybot
fi
+if [ -z "$listuser" ]
+then
+ 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 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
+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
#=================================================
# CREATE DEDICATED USER
@@ -161,11 +271,28 @@ 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
+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"
+listrelay=$listrelay_
+listuser=$listuser_
+listadmin=$listadmin_
+
+# apply_permissions to have correct syntax in config file
+set__listuser
+set__listrelay
+set__listadmin
+
#=================================================
# REGISTER SYNAPSE APP-SERVICE
#=================================================