From d0a7cf72e5c6ec570457f2a736d9590776dacfd6 Mon Sep 17 00:00:00 2001 From: gredin67 Date: Thu, 19 Jan 2023 11:19:06 +0100 Subject: [PATCH] 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" +