Skip to content

WIP: Matrix: support for appservice#1544

Closed
nightmared wants to merge 3 commits into
42wim:masterfrom
nightmared:mautrix_appservice
Closed

WIP: Matrix: support for appservice#1544
nightmared wants to merge 3 commits into
42wim:masterfrom
nightmared:mautrix_appservice

Conversation

@nightmared

Copy link
Copy Markdown
Contributor

Builds on top of the work done in #1543.

It seems to work for me, in a discord<->matrix setting.

To reproduce, here is my configuration:

$ cat appservice_synapse.yml
id: "Matterbridge"
url: "http://192.168.1.13:1234"
as_token: "<RANDOM HERE>"
hs_token: "<RANDOM HERE>"
sender_localpart: "_bridge_bot"
namespaces:
  users:
    - exclusive: true
      regex: "@__bridge_.*"
  aliases:
    - exclusive: false
      regex: "#__bridge_.*"
  rooms: []

Note that the @__bridge_ part is currently hardcoded in the source of matterbridge, I haven't devised a smart way to extract that information properly from the namespaces.users.regex yet.

I have a room (hosted on another matrix server, so that works withotu any change, which is a lot nicer than the pain I expected) with a local alias that matches the `#_bridge' I defined namespaces.aliases.regex (that part isn't hardcoded, you should be able to change it).

You can see an example here: https://nightmared.fr/files/2021-07-10-1625933690.png

Finally my matterbridge configuation:

[matrix]
[matrix.main]
Server="https://matrix.montaigne.nightmared.fr"
Login="matterbridge"
Password="a bad password was here"

[discord]
[discord.main]
Token="YEEAAH A TOKEN"
Server="some number"
RemoteNickFormat="{NICK}[{PROTOCOL}]"
AutoWebhooks=true

[general]
RemoteNickFormat="<{NICK}> "
UseAppService=true
AppServiceHost="192.168.1.13"
AppServicePort=1234
AppServiceConfigPath="appservice_synapse.yml"

[[gateway]]
    name="test1"
    enable=true

    [[gateway.inout]]
    account="matrix.main"
    channel="#test:some_server"

    [[gateway.inout]]
    account="discord.main"
    channel="ID:some number"

[[gateway]]
    name="test2"
    enable=true

    [[gateway.inout]]
    account="matrix.main"
    channel="#test2:some_server"

    [[gateway.inout]]
    account="discord.main"
    channel="ID:some number"

Reviews/tests would be much appreciated!

Work that remains to be done:

  • showing usernames properly when in appservice mode (example: https://nightmared.fr/files/2021-07-10-1625934431.png)
  • fixing the harcoded @__bridge_ mentionned earlier
  • accepting rooms not defined in the config (that is the whole point of app services after all, yet currently it only relays messages for rooms that are already defined in the config AND that have an alias matching the regexp in namespaces.aliases.regex)

@qlty-cloud-legacy qlty-cloud-legacy Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 27240 lines exceeds the maximum allowed for the inline comments feature.

@qlty-cloud-legacy

Copy link
Copy Markdown

Code Climate has analyzed commit 72b063a and detected 0 issues on this pull request.

View more on Code Climate.

@nightmared

Copy link
Copy Markdown
Contributor Author

I'm not currently working on this, so I'm gonna close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant