From d39001a081e6b07c18ba091665dae064ab84b70f Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Sat, 26 Oct 2024 22:08:11 +0100 Subject: [PATCH] Pull mautrix config - Include server name in discord channel room name - Enable setting room info in gmessages --- servers/ansible/playbook.yaml | 3 ++ servers/mautrix/.gitignore | 3 ++ servers/mautrix/discord/config.yaml | 31 ++++++++------------- servers/mautrix/discord/registration.yaml | 8 +++--- servers/mautrix/gmessages/config.yaml | 11 ++++++-- servers/mautrix/gmessages/registration.yaml | 14 ++++++++++ 6 files changed, 43 insertions(+), 27 deletions(-) create mode 100644 servers/mautrix/.gitignore create mode 100644 servers/mautrix/gmessages/registration.yaml diff --git a/servers/ansible/playbook.yaml b/servers/ansible/playbook.yaml index 64305baf..8fb754b7 100644 --- a/servers/ansible/playbook.yaml +++ b/servers/ansible/playbook.yaml @@ -53,6 +53,9 @@ ansible.posix.synchronize: src: ../stalwart/ dest: /etc/stalwart + # Pull mautrix config: + # rsync --rsync-path="sudo rsync" -r -t -z -P --include "*/" --include="*.yaml" --exclude="*" ansible@213.32.25.24:/var/opt/mautrix/ ./mautrix + # - name: install linux-system-roles # package: # name: linux-system-roles diff --git a/servers/mautrix/.gitignore b/servers/mautrix/.gitignore new file mode 100644 index 00000000..ffd03e54 --- /dev/null +++ b/servers/mautrix/.gitignore @@ -0,0 +1,3 @@ +*.db +*.db-* +*/logs/ \ No newline at end of file diff --git a/servers/mautrix/discord/config.yaml b/servers/mautrix/discord/config.yaml index 573b67ce..5984a97b 100644 --- a/servers/mautrix/discord/config.yaml +++ b/servers/mautrix/discord/config.yaml @@ -2,10 +2,9 @@ homeserver: # The address that this appservice can use to connect to the homeserver. address: https://matrix.ellis.link - # address: http://conduwuit # The domain of the homeserver (also known as server_name, used for MXIDs, etc). domain: ellis.link - + # What software is the homeserver running? # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. software: standard @@ -16,7 +15,6 @@ 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? - # Doesn't seem to show up in conduwuit source as of 032b199 async_media: false # Should the bridge use a websocket for connecting to the homeserver? # The server side is currently not documented anywhere and is only implemented by mautrix-wsproxy, @@ -30,12 +28,11 @@ homeserver: appservice: # The address that the homeserver can use to connect to this appservice. address: https://mautrix-discord.ellis.link - # address: http://mautrix-discord - + # The hostname and port where this appservice should listen. hostname: 0.0.0.0 port: 29334 - + # Database config. database: # The database type. "sqlite3-fk-wal" and "postgres" are supported. @@ -53,7 +50,7 @@ appservice: # Parsed with https://pkg.go.dev/time#ParseDuration max_conn_idle_time: null max_conn_lifetime: null - + # The unique ID of this appservice. id: mautrix-discord # Appservice bot details. @@ -71,7 +68,7 @@ appservice: # This may be necessary for large public instances with lots of messages going through. # However, messages will not be guaranteed to be bridged in the same order they were sent in. async_transactions: false - + # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify. as_token: "BeqHdZlIs5kscUgQG03TxLO6dWjjuFKTL0T0T5CGoBNxUfsAaYMGuNONgzrvXSni" hs_token: "IvmSDAdVFV63hR7hjQDEDOptyyNm81JRvkr3l5l653lWG0MLJKlOc7mbNm0extWA" @@ -99,7 +96,7 @@ bridge: # .GuildName - Guild name. # .NSFW - Whether the channel is marked as NSFW. # .Type - Channel type (see values at https://github.com/bwmarrin/discordgo/blob/v0.25.0/structs.go#L251-L267) - channel_name_template: '{{if or (eq .Type 3) (eq .Type 4)}}{{.Name}}{{else}}#{{.Name}}{{end}}' + channel_name_template: '{{if or (eq .Type 3) (eq .Type 1)}}{{.Name}}{{else}}#{{.Name}} ({{.GuildName}}){{end}}' # Displayname template for Discord guilds (bridged as spaces). # Available variables: # .Name - Guild name @@ -213,10 +210,10 @@ bridge: login_shared_secret_map: ellis.link: "as_token:fR52cysNJ2s7MbQ7PscEfHIyiW" pissing.dev: "as_token:fR52cysNJ2s7MbQ7PscEfHIyiW" - + # The prefix for commands. Only required in non-management rooms. command_prefix: '!discord' - + # Messages sent upon joining a management room. # Markdown is supported. The defaults are listed below. management_room_text: @@ -251,7 +248,7 @@ bridge: # This can be used as a rough heuristic to disable backfilling in channels that are too active. # Currently only applies to missed message backfill. max_guild_members: -1 - + # End-to-bridge encryption support options. # # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info. @@ -328,7 +325,7 @@ bridge: # Disable rotating keys when a user's devices change? # You should not enable this option unless you understand all the implications. disable_device_change_key_rotation: false - + # Settings for provisioning API provisioning: # Prefix for the provisioning API paths. @@ -338,7 +335,7 @@ bridge: shared_secret: KC4cswhfFcp59TP0Bdv1IEuw8lVPk7GXcyigzF8UBNAkPavCuiV6Khdg9dmcxD0W # Enable debug API at /debug with provisioning authentication. debug_endpoints: false - + # Permissions for using the bridge. # Permitted values: # relay - Talk through the relaybot (if enabled), no access otherwise @@ -359,9 +356,3 @@ logging: writers: - type: stdout format: pretty-colored - # - type: file - # format: json - # filename: ./logs/mautrix-discord.log - # max_size: 100 - # max_backups: 10 - # compress: true \ No newline at end of file diff --git a/servers/mautrix/discord/registration.yaml b/servers/mautrix/discord/registration.yaml index b6bdef96..c92ed566 100644 --- a/servers/mautrix/discord/registration.yaml +++ b/servers/mautrix/discord/registration.yaml @@ -1,8 +1,8 @@ id: mautrix-discord url: http://mautrix-discord -as_token: 5ngb86SSXij50hLfnt1BC0K7NVmxiXlagCtmcXXVFFTqh76zUkX3FI7NyERXaAFD -hs_token: 1ni0upPYy21f5GTLvCGCvTqdYrv7d6NWiRvMaC2XahWluAL6fjqLvSCd5S3PiMsv -sender_localpart: K3hPufeGniHhdywShci90i8ZGRYu0YRF +as_token: BeqHdZlIs5kscUgQG03TxLO6dWjjuFKTL0T0T5CGoBNxUfsAaYMGuNONgzrvXSni +hs_token: IvmSDAdVFV63hR7hjQDEDOptyyNm81JRvkr3l5l653lWG0MLJKlOc7mbNm0extWA +sender_localpart: zByRv7CUznpsLSEXztOuO05F3qhgRiqG rate_limited: false namespaces: users: @@ -11,4 +11,4 @@ namespaces: - regex: ^@discord_mautrix_.*:ellis\.link$ exclusive: true de.sorunome.msc2409.push_ephemeral: true -push_ephemeral: true \ No newline at end of file +push_ephemeral: true diff --git a/servers/mautrix/gmessages/config.yaml b/servers/mautrix/gmessages/config.yaml index ff07ea79..782bbc8a 100644 --- a/servers/mautrix/gmessages/config.yaml +++ b/servers/mautrix/gmessages/config.yaml @@ -30,9 +30,10 @@ bridge: personal_filtering_spaces: true # Whether the bridge should set names and avatars explicitly for DM portals. # This is only necessary when using clients that don't support MSC4171. - private_chat_portal_meta: false + private_chat_portal_meta: true # Should events be handled asynchronously within portal rooms? # If true, events may end up being out of order, but slow events won't block other ones. + # This is not yet safe to use. async_events: false # Should every user have their own portals rather than sharing them? # By default, users who are in the same group on the remote network will be @@ -182,8 +183,12 @@ homeserver: # Changing these values requires regeneration of the registration (except when noted otherwise) appservice: # The address that the homeserver can use to connect to this appservice. + # Like the homeserver address, a local non-https address is recommended when the bridge is on the same machine. + # If the bridge is elsewhere, you must secure the connection yourself (e.g. with https or wireguard) + # If you want to use https, you need to use a reverse proxy. The bridge does not have TLS support built in. address: https://mautrix-gmessages.ellis.link # A public address that external services can use to reach this appservice. + # This is only needed for things like public media. A reverse proxy is generally necessary when using this field. # This value doesn't affect the registration file. public_address: https://mautrix-gmessages.ellis.link @@ -312,7 +317,7 @@ backfill: # Settings for backfilling threads within other backfills. threads: # Maximum number of messages to backfill in a new thread. - max_initial_messages: 5000 + max_initial_messages: 50000 # Settings for the backwards backfill queue. This only applies when connecting to # Beeper as standard Matrix servers don't support inserting messages into history. queue: @@ -425,4 +430,4 @@ logging: min_level: debug writers: - type: stdout - format: pretty-colored \ No newline at end of file + format: pretty-colored diff --git a/servers/mautrix/gmessages/registration.yaml b/servers/mautrix/gmessages/registration.yaml new file mode 100644 index 00000000..109105b9 --- /dev/null +++ b/servers/mautrix/gmessages/registration.yaml @@ -0,0 +1,14 @@ +id: gmessages +url: https://mautrix-gmessages.ellis.link +as_token: APWnNkbbzv0qLd9ipuK7r6uYpSZz7p9PrbNU77YSPor6zaXAL8InKxPkgMpKH6KP +hs_token: Q8Ide055pQfvQwfDXusifJSscHkbB07DRaGoHQN39oj50DCbXiGXmTAYyCb61spa +sender_localpart: IDSTAgz6EZUIU4rLdnGkbeCT0fFUH14E +rate_limited: false +namespaces: + users: + - regex: ^@gmessagesbot:ellis\.link$ + exclusive: true + - regex: ^@gmessages_mautrix_.*:ellis\.link$ + exclusive: true +de.sorunome.msc2409.push_ephemeral: true +push_ephemeral: true