mirror of
https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh.git
synced 2024-09-03 19:46:01 +02:00
add __foobar__ settings
This commit is contained in:
parent
f0b9772e47
commit
f58912baed
3 changed files with 71 additions and 38 deletions
|
@ -15,7 +15,7 @@ homeserver:
|
||||||
# Endpoint for reporting per-message status.
|
# Endpoint for reporting per-message status.
|
||||||
message_send_checkpoint_endpoint: null
|
message_send_checkpoint_endpoint: null
|
||||||
# Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246?
|
# 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.
|
# Application service host/registration related details.
|
||||||
# Changing these values requires regeneration of the registration.
|
# Changing these values requires regeneration of the registration.
|
||||||
|
@ -52,16 +52,16 @@ appservice:
|
||||||
bot:
|
bot:
|
||||||
# Username of the appservice bot.
|
# Username of the appservice bot.
|
||||||
#username: whatsappbot
|
#username: whatsappbot
|
||||||
username: __BOTNAME__
|
username: __USERNAME__
|
||||||
# Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
|
# Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
|
||||||
# to leave display name/avatar as-is.
|
# to leave display name/avatar as-is.
|
||||||
displayname: WhatsApp bridge bot
|
displayname: __DISPLAYNAME__
|
||||||
avatar: mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr
|
avatar: __AVATAR__
|
||||||
|
|
||||||
# Whether or not to receive ephemeral events via appservice transactions.
|
# Whether or not to receive ephemeral events via appservice transactions.
|
||||||
# Requires MSC2409 support (i.e. Synapse 1.22+).
|
# Requires MSC2409 support (i.e. Synapse 1.22+).
|
||||||
# You should disable bridge -> sync_with_custom_puppets when this is enabled.
|
# 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.
|
# Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
|
||||||
as_token: "This value is generated when generating the registration"
|
as_token: "This value is generated when generating the registration"
|
||||||
|
@ -73,24 +73,24 @@ segment_key: null
|
||||||
# Prometheus config.
|
# Prometheus config.
|
||||||
metrics:
|
metrics:
|
||||||
# Enable prometheus metrics?
|
# Enable prometheus metrics?
|
||||||
enabled: false
|
enabled: __METRICS_ENABLED__
|
||||||
# IP and port where the metrics listener should be. The path is always /metrics
|
# 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.
|
# Config for things that are directly sent to WhatsApp.
|
||||||
whatsapp:
|
whatsapp:
|
||||||
# Device name that's shown in the "WhatsApp Web" section in the mobile app.
|
# 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.
|
# 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.
|
# 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
|
# 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 config
|
||||||
bridge:
|
bridge:
|
||||||
# Localpart template of MXIDs for WhatsApp users.
|
# Localpart template of MXIDs for WhatsApp users.
|
||||||
# {{.}} is replaced with the phone number of the WhatsApp user.
|
# {{.}} is replaced with the phone number of the WhatsApp user.
|
||||||
username_template: whatsapp_{{.}}
|
username_template: __USERNAME_TEMPLATE__
|
||||||
# Displayname template for WhatsApp users.
|
# Displayname template for WhatsApp users.
|
||||||
# {{.PushName}} - nickname set by the WhatsApp user
|
# {{.PushName}} - nickname set by the WhatsApp user
|
||||||
# {{.BusinessName}} - validated WhatsApp business name
|
# {{.BusinessName}} - validated WhatsApp business name
|
||||||
|
@ -101,9 +101,9 @@ bridge:
|
||||||
displayname_template: "{{if .BusinessName}}{{.BusinessName}}{{else if .PushName}}{{.PushName}}{{else}}{{.JID}}{{end}} (WA)"
|
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?
|
# 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.
|
# 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?
|
# 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.
|
# Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
|
||||||
message_status_events: false
|
message_status_events: false
|
||||||
# Whether the bridge should send error notices via m.notice events when a message fails to bridge.
|
# 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.
|
# 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
|
# 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.
|
# 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)
|
# 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)?
|
# 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,
|
# 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`
|
# 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.
|
# 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.
|
# 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.
|
# This is currently not supported in most clients.
|
||||||
caption_in_message: false
|
caption_in_message: false
|
||||||
|
@ -334,11 +334,11 @@ bridge:
|
||||||
# Default to encryption, force-enable encryption in all portals the bridge creates
|
# 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.
|
# 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.
|
# 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.
|
# Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
|
||||||
appservice: false
|
appservice: false
|
||||||
# Require encryption, drop any unencrypted messages.
|
# 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.
|
# 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.
|
# You must use a client that supports requesting keys from other users to use this feature.
|
||||||
allow_key_sharing: false
|
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
|
# 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.
|
# authenticated user into a relaybot for that chat.
|
||||||
#enabled: false
|
#enabled: false
|
||||||
enabled: true
|
enabled: __ENABLED__
|
||||||
# Should only admins be allowed to set themselves as relay users?
|
# 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.
|
# The formats to use when sending messages to WhatsApp via the relaybot.
|
||||||
message_formats:
|
message_formats:
|
||||||
m.text: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
|
m.text: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
|
||||||
|
@ -437,4 +437,4 @@ logging:
|
||||||
timestamp_format: "Jan _2, 2006 15:04:05"
|
timestamp_format: "Jan _2, 2006 15:04:05"
|
||||||
# Minimum severity for log messages printed to stdout/stderr. This doesn't affect the log file.
|
# Minimum severity for log messages printed to stdout/stderr. This doesn't affect the log file.
|
||||||
# Options: debug, info, warn, error, fatal
|
# Options: debug, info, warn, error, fatal
|
||||||
print_level: INFO
|
print_level: __PRINT_LEVEL__
|
||||||
|
|
|
@ -4,26 +4,11 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
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 {
|
function get__botname {
|
||||||
botname=$(ynh_app_setting_get --app $app --key botname)
|
botname=$(ynh_app_setting_get --app $app --key botname)
|
||||||
echo "${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 {
|
function set__botname {
|
||||||
old_botname=$(ynh_app_setting_get --app $app --key 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.
|
if [ "$botname" -eq "$old_botname" ] # Check to avoid updating botname when it's not needed.
|
||||||
|
|
|
@ -25,7 +25,7 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
appserviceid=$YNH_APP_INSTANCE_NAME
|
appserviceid=$YNH_APP_INSTANCE_NAME
|
||||||
synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER
|
synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER
|
||||||
botname=$YNH_APP_ARG_BOTNAME
|
username=$YNH_APP_ARG_BOTNAME
|
||||||
bot_synapse_adm=$YNH_APP_ARG_BOT_SYNAPSE_ADM
|
bot_synapse_adm=$YNH_APP_ARG_BOT_SYNAPSE_ADM
|
||||||
encryption=$YNH_APP_ARG_ENCRYPTION
|
encryption=$YNH_APP_ARG_ENCRYPTION
|
||||||
botadmin=$YNH_APP_ARG_BOTADMIN
|
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)
|
domain=$(ynh_app_setting_get --app $synapse_instance --key domain)
|
||||||
synapse_db_name="matrix_$synapse_instance"
|
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
|
# 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_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=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=bot_synapse_adm --value=$bot_synapse_adm
|
||||||
ynh_app_setting_set --app=$app --key=encryption --value=$encryption
|
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=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.)
|
# (Note that, by default, non-admins might not have your homeserver's permission to create communities.)
|
||||||
if [ "$bot_synapse_adm" = true ]
|
if [ "$bot_synapse_adm" = true ]
|
||||||
then
|
then
|
||||||
ynh_psql_execute_as_root --database=$synapse_db_name --sql="UPDATE users SET admin = 1 WHERE name = ""$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=$botname
|
#yunohost app action run $synapse_instance set_admin_user -a username=$username
|
||||||
fi
|
fi
|
||||||
ynh_systemd_action --service_name=$app --action="restart"
|
ynh_systemd_action --service_name=$app --action="restart"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue