Giter Club home page Giter Club logo

matrix-bifrost's People

Contributors

ara4n avatar bodqhrohro avatar britiger avatar dependabot[bot] avatar fariszr avatar half-shot avatar maranda avatar tadzik avatar turt2live avatar uhoreg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

matrix-bifrost's Issues

when using yarn: ERROR Program Failed to start: M_UNKNOWN_TOKEN: Unrecognised access token

When I run yarn start -- -p 9555 I get an error:

M_UNKNOWN_TOKEN: Unrecognised access token. WARN bridge [-] POST http://localhost:8008/_matrix/client/r0/createRoom (AS) HTTP 401 Error: "{\"errcode\":\"M_UNKNOWN_TOKEN\",\"error\":\"Invalid access token passed.\",\"soft_logout\":false}"
datetimeredacted ERROR Program Homeserver cannot reach the bridge. You probably need to adjust your configuration. M_UNKNOWN_TOKEN: Invalid access token passed.

Here is my config:

bridge:
  # Your homeserver server_name.
  domain: "synapse.local"
  # A internally reachable endpoint for the CS api of the homeserver.
  homeserverUrl: "http://localhost:8008"
  #homeserverUrl: "http://synapse.local"
  # Prefix of all users of the bridge.
  userPrefix: "_bf_"
  # If homeserverUrl is not reachable publically, the public address that media can be reached on.
  # mediaserverUrl: "http://example.com:8008"
  # Set this to the port you want the bridge to listen on.
  appservicePort: 9555
  # Specify a Bridge Administrator mxID
  #adminMxID: "@adman:synapse.local"

roomRules: []
# - room: "#badroom:example.com"
#   action: "deny"
# - room: "!badroom:example.com"
#   action: "deny"

datastore:
  # The datastore engine to use, either "nedb" or "postgres"
  engine: "postgres"

  # For NeDB:
  #   Location of the user and room database files, by default will be stored in the working directory.
  # For Postgres:
  #   A postgres style connection string.
  connectionString: "postgres://bifroster:password@localhost/bifrost"

purple:
  # For selecting a specific backend. One of "node-purple", "xmpp-js".
# -- For xmpp.js - You need an existing xmpp server for this to work.
  backend: "xmpp-js"
  backendOpts:
    # endpoint to reach the component on. The default port is 5347
    service: "xmpp://localhost:5347"
    # domin assigned to the component.
    domain: "matrix.localhost"
    # password needed by the component.
    password: "jam"

  # Default settings to set for new accounts, useful for node-purple. NOT used for xmpp.js
  # defaultAccountSettings:
  #   # The protocol ID (e.g. prpl-sipe)
  #   prpl-plugin:
  #     # A set of strings -> values for a plugin's settings.
  #     # Consult the documentation for your protocol for options in here
  #     server: sip.unstable.technology:5061
  #     encryption-policy: obey-server
  # backendOpts:
  # # Should the backend output extra logging.
  #   debugEnabled: false
  # # Where are the plugin libraries stored.
  #   pluginsDir: "/usr/lib/purple-2"
  # # Where should purple account data be stored.
  #   dataDir: "./purple-data"
  # # Should only one plugin be enabled (to simplify userIds / commands).
  #   soloProtocol: "prpl-sipe"
  # # Extra options for protocols.
  #   protocolOptions:
  #   # The protocol ID (e.g. prpl-sipe)
  #     prpl-plugin:
  #       # When the user passes in a username to "accounts add", it should use this format.
  #       # The format will replace % with the passed in username.
  #       usernameFormat: "%@my-domain"

  # OR
  # backend: "node-purple"
  # backendOpts:
  #   # endpoint to reach the component on. The default port is 5347
  #   service: "xmpp://localhost:5347"
  #   # domin assigned to the component.
  #   domain: "matrix.localhost"
  #   # password needed by the component.
  #   password: "jam"

# Matrix forwards room aliases join requests matching a regex in the
# registration file to the owner's bridge, if the room doesn't exist.
# The following options allow you to configure how the purple bridge may
# match those aliases to remote rooms.
portals:
  # Enable gateway support for protocols that support them, e.g. xmpp.js
  enableGateway: false
  # List of regexes to match a alias that can be turned into a bridge.
  aliases:
    # This matches #_bifrost_ followed by anything
    "/^_bifrost_(.+)$/":
      # Use the xmpp-js protocol.
      protocol: "xmpp-js"
      properties:
        # Set room to the first regex match
        room: "regex:1"
        # Set the server to be conf.localhost
        server: "regex:2"
      

# Automatically register users with accounts if they join/get invited
# a room with a protocol they are not bound to.
# This is REQUIRED for xmpp.js to work.
autoRegistration:
  enabled: true
  protocolSteps:
  # For xmpp.js, please use:
    xmpp-js:
      type: "implicit"
      parameters:
        username: "<T_LOCALPART>_<T_DOMAIN>@matrix.localhost"

# Set up access controls for the bridge
# access:
#   accountCreation:
#     whitelist:
#       - "^@.*:yourdomain$"

# Available subsitution variables for parameters:
# <T_MXID> - The users mxid.
# <T_MXID_SANE> - The users mxid, with an : replaced with _ and the @ discarded.
# <T_DOMAIN> - The users domain.
# <T_LOCALPART> - The users localpart.
# <T_DISPLAYNAME> - The users displayname, or localpart if not set.
# <T_GENERATEPWD> - Generates a 32 char password
# <T_AVATAR> - The MXC url of the users avatar, if available.


## This is how to autoregister folks with prosody (xmpp)
## with the included lua script in extras. This applies to node-purple (NOT xmpp.js)
#   protocolSteps:
#       prpl-jabber:
#           type: "http"
#           path: "http://localhost:5280/register_account/"
#           opts:
#               method: "post"
#               usernameResult: null
#           parameters:
#               username: "m_<T_LOCALPART>"
#               nick: "<T_DISPLAYNAME>"
#               password: "<T_GENERATEPWD>"
#               auth_token: "bridge-token"
#               ip: "127.0.0.1"
#           paramsToStore:
#               - password

# Enable prometheus metrics reporting.
# This will report metrics on /metrics on the same port as the bridge.
metrics:
  enabled: true

provisioning:
  # Can users use ""!purple" in a room to bridge it to a group.
  enablePlumbing: false
  # Required power level to bridge a room into a group.
  requiredUserPL: 100

logging:
  # Set the logging level for stdout.
  # Lower levels are inclusive of higher levels e.g. info will contain warn and error logging.
  console: "info" # "debug", "info", "warn", "error", "off"
  # A list of files and their associated logging levels.
  files:
    "./info.log": "info"
#    "./error.log": "error"
#    "./warn.log": "warn"
#    "./debug.log": "debug"

# These are specific flags or values to tune the bridge to different setups.
# The defaults are usually fine, but adjust as needed.
tuning:
    # Do not send a message or join a room before setting a users profile for
    # the first time. This should help clients hide ugly mxids better behind
    # displaynames.
    waitOnProfileBeforeSend: true
    #  A nasty hack to check the domain for conf* to see if the PM is coming from a MUC.
    # This is only really needed for legacy clients that don't implement xmlns.
    # This is specific to the XMPP.js bridge.
    # conferencePMFallbackCheck: false
    # Don't send messages from the remote protocol until we have seen them join.
    # A list of prefixes to check for a userId.
    # This is useful for talking to remote IRC users who might not see a message
    # until after they have joined.
    # waitOnJoinBeforePM: string[];

I edited the homeserver.yaml to include the full path of the registration file (although this is different then other matrix bridges registration files which i just stuck in the /etc/matrix-synapse/app-service/ directory)

app_service_config_files:
  - "/home/dl/matrix-bifrost/bifrost-registration.yaml"

I'm not sure what to try next. Any advice or help?

XMPP User can't join Matrix Rooms with uppercase letter in the adress.

Describe the bug
When the adress-name of a Matrix-Room contains uppercases, xmpp users can't join the Room.

To Reproduce
Create a public Room in Matrix with a uppercase adress and try to join this room with a xmpp account.

You will see a error like this in the logs:

Aug-29 22:22:29.518 INFO ServiceHandler Handling iq request
Aug-29 22:22:29.518 INFO GatewayHandler Trying to discover #betterkingde:matrix.org
Aug-29 22:22:29.633 WARN bridge [-] GET https://aria-net.org/_matrix/client/r0/directory/room/%23betterkingde%3Amatrix.org (AS) HTTP 404 Error: "{\"errcode\":\"M_NOT_FOUND\",\"error\":\"Room alias #betterkingde:matrix.org not found\"}"
Aug-29 22:22:29.634 WARN GatewayHandler Room not found: M_NOT_FOUND: Room alias #betterkingde:matrix.org not found
    at parseErrorResponse (/app/node_modules/matrix-js-sdk/lib/http-api.js:827:13)
    at /app/node_modules/matrix-js-sdk/lib/http-api.js:782:17
    at /app/node_modules/matrix-js-sdk/lib/http-api.js:716:9
    at Request._callback (/app/node_modules/matrix-appservice-bridge/src/components/client-factory.ts:119:17)
    at Request.self.callback (/app/node_modules/request/request.js:185:22)
    at Request.emit (events.js:400:28)
    at Request.<anonymous> (/app/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:400:28)
    at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:519:28) {
  errcode: 'M_NOT_FOUND',
  data: {
    errcode: 'M_NOT_FOUND',
    error: 'Room alias #betterkingde:matrix.org not found'
  },
  httpStatus: 404
}

Source:
https://matrix.to/#/!vKsKNErebdRaQvsUkQ:half-shot.uk/$1kTcPGTZmWlpEPxqtPcyAfqlkNg0_fag4lyGl7tRUsA?via=half-shot.uk&via=matrix.org&via=libera.chat

Expected behavior
You should be able to join a room with uppercase letter.
e.G. This could be archived by a "Escape"symbol which is written before the Uppercase letter.

Additional context
A Workaround would be creating a local adress for the Matrix Room with only lower cases.

(Copy of matrix-org#281 )

Room/MUC should have the same Room rights as the bridged Room

Describe the bug
When i have a Matrix room where only Moderators/Admins can write, XMPP-Usern shouldn't be able to write as well.

To Reproduce

  1. Create a Matrix Room where only Moderators/Admins can write
  2. join it with a XMPP Account.
  3. you can write messages which won't be bridged to the Matrix-Room but can be seen by other XMPP-Users.

Expected behavior
The XMPP/Matrix rights should be nearly* the same
(* as far as possible. e.G. when a XMPP User joins a Matrix Room where only Moderators and Admins are allowed to join, then a moderated MUC should be created.)

Additional context
Perhaps a quick and dirty solution for Moderated Rooms/MUC could be allowing to write, but if the other bridged MUC/Room "reject" the message, it get deleted in the Gateway-Room/MUC aswell.
(Copy of matrix-org#282 )

Transform automatically non allowed character in Nickname ( Matrix -> XMPP )

Describe the bug
When a Nickname of Matrix user contains in XMPP not allowed character like emoji, they should be converted automatically to prevent that other xmpp users can't read his messages.

To Reproduce

Change your Global Nick of a matrix account to something with a emoji in it
join a XMPP Room
Send a message
Some XMPP User won't be able to read the messages.

Expected behavior
Variant 1:
The bridge changed the nickname of the Person automatically.

Variant 2:
The bridge messages the user and tell him, that he need to change his room nickname otherwise not every XMPP User will be able to read his messages.

(Copy of matrix-org#311 )

Give admin permissions to invited users when creating DMs

When I get a message from XMPP for the first time, the bridge creates a room and invites my matrix user to it. But I have little permissions in that room.
I'm using the aria-net gateway with jmp.chat and I would like to be able to change room names for rooms that I have been invited to, so I don't have to remember phone numbers or xmpp IDs.

Support SRV records

I had a bit of a harebrained idea and I have no idea how feasible it would be, but I was thinking that SRV (and maybe TXT) DNS records could be used to simplify interoperability between XMPP and Matrix through bifrost. For example, if someone from Matrix tries to reach out to someone on XMPP, if the XMPP server has the right records setup, it could look like a typical Matrix address ( @user:example.com ) via records something like this:

srv-host=_matrix._tcp.example.com,aria-net.org,443,0,0
srv-host=_matrix._tcp.conference.example.com,aria-net.org,443,0,0

It can tell what XMPP server is wanted via the header. From there, at least from a typical naming scheme for the different XMPP components, bifrost could tell if it's trying to connect to a MUC or a user. Bifrost specific TXT DNS records could be added as well to directly tell bifrost if the address is to a MUC component or not

The reverse will probably depend on bifrost to figure out if a XMPP user is trying to join a channel or message a user purely based on if there's a # in front of the address or not. Otherwise, Matrix servers could have SRV records like:

srv-host=_xmpp-server._tcp.example.com,aria-net.org,5269,0,0
srv-host=_xmpps-server._tcp.example.com,aria-net.org,5270,0,0

I have no idea if this would be a worthwhile idea or if it's more trouble than it's worth

Remove messages deleted on xmpp side from matrix view as well

For plumped rooms, at least the admins could remove it manually from the other side, but for gateway room (connected using the pattern address) it cannot even be removed manually. So some explicit images sent in public groups are still there with no way to remove them.

Support profile picture sync

I heard Matrix supports setting profile pics per group, not sure if xmpp offers muc specific profile pics. One user recently changed their group specific picture based on feedback from users, but their change was not visible on the xmpp side.

Support bridging moderated xmpp groups

Related to #6 with many clients and servers still not supporting message moderation https://xmpp.org/extensions/xep-0425.html the only short term reasonable solution to spam/explicit images seems to turning on moderation. This means messages from matrix side won't get through without a request for voice. Can bridge request voice for its mapped users if they speak something on matrix side and forward that only if voice request is granted?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.