Announcing xjtu.app chat service based on Matrix

Matrix (sometimes stylized as [matrix]) is an open standard and communication protocol for real-time communication.

It supports online chat, voice over IP, and videotelephony.

Homepage: https://chat.xjtu.app
Login method: only support Single Sign-On (SSO) (one-click login with your 交大門 account)
On a mobile device, you can use the Element App filled with homeserver URL: xjtu.app.
For Android users, we build a pre-configured 交大門-branded apk for you(link: https://xjtu.app/xjtumen-g/chat.xjtu.app-latest.apk).

Current pitfalls:

  • can only search account with the format like @admin:xjtu.app

  • Re-Authentication Needed(加密升级可用) never ended on mobile app

    • Temporary workaround: App hangs and circles on Re-Authentication Needed dialog · Issue #6490 · element-hq/element-android · GitHub
      • As a workaround it’s possible to bootstrap cross-signing via settings → security → cross-signing or on a different client(login on Element Web/Desktop). Then the popup also disappeared in the cases I observed.
    • Culprit: This issue happens when SSO / OAuth login are setup and the account is logged using a 3rd party system. There’s a loop because the client is not able to contact the login provider. As @lub said, doing it manually will fix it.
  • Cannot synchronize username with Discourse (if you change your username here, when you log in chat, it will be a brand new account.)

1 Like

快进到門友视频裸聊 :shuiyuan3:

1 Like

已经通过这个插件实现了类似 RSS 的效果

选择 continue with 交大門账户 后就会爆 500 internal server error

再试试,我看到早上有人注册成功的

我知道了,synapse 每隔一段时间发生卡死,单核 CPU 占用 100%,导致 500 error. 动态语言 python 写的东西容易出问题。

troubleshooting:
日志里有大量的 federation error

2024-01-21 03:02:30,509 - synapse.handlers.federation_event - 1726 - WARNING - sync_partial_state_room-0-$yWcwWfHaeILxryn21VH8zKjHXxSsZnVietZflRpbyc0-$VGe6xJYJYSap6pcUlhQ5i-6ec8x_BN7jcLbIh8JKai4-$1gNHvtl7y_0kLjY-x5dOQCCbz77D0gazyS_bKoSBkN0 - Dropping event <FrozenEventV3 event_id=$1gNHvtl7y_0kLjY-x5dOQCCbz77D0gazyS_bKoSBkN0, type=m.room.member, state_key=@denaelepine:rgb.us.eu.org, outlier=False>, which relies on auth_event $wgL9NuoEvI1hiTQKA-1disiT9yapclKF1bjizQT6yZo, which could not be found
2024-01-21 03:02:38,371 - synapse.handlers.federation_event - 1726 - WARNING - sync_partial_state_room-0-$yWcwWfHaeILxryn21VH8zKjHXxSsZnVietZflRpbyc0-$VGe6xJYJYSap6pcUlhQ5i-6ec8x_BN7jcLbIh8JKai4-$1x6sFRSffSTDPNLLS9fIEzR7ijK8BzM2Nssc_AJGo8s - Dropping event <FrozenEventV3 event_id=$1x6sFRSffSTDPNLLS9fIEzR7ijK8BzM2Nssc_AJGo8s, type=m.room.member, state_key=@odyssey:trygve.me, outlier=False>, which relies on auth_event $d4zpOma730qisM0gC4LH7yiYFjScvcxklcUNkkQZSl0, which could not be found

把 federation 关了,应该不会再跑飞了

现在 Matrix 的新用户默认启用我统一设置的表情包

今天下午之前登录过 Matrix 的用户需要人工启用(如果偷懒可以在 discourse 里换个 username 重新登录 matrix 获得一个新账号),参考 Create new page · maunium/stickerpicker Wiki · GitHub

在聊天框输入 /devtools,之后选择 Other → Explore account data in Element Web (注意不是 room account data), 搜索 m.widgets,把 m.widgets 内容改成:

{
  "type": "m.widgets",
  "content": {
    "stickerpicker": {
      "content": {
        "type": "m.stickerpicker",
        "url": "https://xjtu.app/xjtumen-g/stickerpicker.web/?theme=$theme",
        "name": "Stickerpicker",
        "creatorUserId": "@えしりなか:xjtu.app",
        "data": {}
      },
      "sender": "@えしりなか:xjtu.app",
      "state_key": "stickerpicker",
      "type": "m.widget",
      "id": "stickerpicker"
    }
  }
}

正常的效果是这样的:

修复了 OIDC/SSO 的问题
日志

2024-01-22 19:51:23,929 - synapse.http.server - 220 - ERROR - GET-6587 - Failed handle request <XForwardedForRequest at 0x7f9c185ddae0 method='GET' uri='/_synapse/client/oidc/callback?sso=YWRtaW49ZmFsc2UmYXZhdGFyX3VybD1odHRwcyUzQSUyRiUyRnhqdHUubWVuJTJGdXBsb2FkcyUyRmRlZmF1bHQlMkZvcmlnaW5hbCUyRjFYJTJGMjllYjUyYmRlMDE5MDE0Y2ZjOTI1OWQ5NzYwMmJiYzI0MTUwYWRiMS5qcGVnJmVtYWlsPW1lJTQwaHVpem0uY24mZXh0ZXJuYWxfaWQ9NDMxJmdyb3Vwcz12ZXJpZmllZF94anR1X21haWxfb3JfaXAlMkN0YWxlbnRzJTJDdHJ1c3RfbGV2ZWxfNCUyQ3RydXN0X2xldmVsXzAlMkN0cnVzdF9sZXZlbF8yJTJDbW9kZXJhdG9ycyUyQ3N0YWZmJTJDdHJ1c3RfbGV2ZWxfMyUyQ3RydXN0X2xldmVsXzElMkNQYXJ0aWFsRGV2ZWxvcGVycyZtb2RlcmF0b3I9dHJ1ZSZuYW1lPSZub25jZT1ZU2ZpOE9ZbDdMU3NWQ3VTbFdEcmtLOHdLeUxIMVImcmV0dXJuX3Nzb191cmw9aHR0cHMlM0ElMkYlMkZ4anR1Lm1lbiUyRl9zeW5hcHNlJTJGY2xpZW50JTJGb2lkYyUyRmNhbGxiYWNrJnVzZXJuYW1lPUp1aWN5T3lzdGVyMzMxOA%3D%3D&sig=131ae6c979eb759c31b4c475710a0bbef5979e955827cf6b9974969f777d4a1f' clientproto='HTTP/1.1' site='8008'>
Traceback (most recent call last):
  File "/var/synapse/synapse/http/server.py", line 331, in _async_render_wrapper
    callback_return = await self._async_render(request)
  File "/var/synapse/synapse/http/server.py", line 363, in _async_render
    callback_return = await raw_callback_return
  File "/var/synapse/synapse/rest/synapse/client/oidc/callback_resource.py", line 41, in _async_render_GET
    await self._oidc_handler.handle_oidc_callback(request)
  File "/var/synapse/synapse/handlers/oidc.py", line 358, in handle_oidc_callback
    await oidc_provider.handle_oidc_callback(request, session_data,
  File "/var/synapse/synapse/handlers/oidc.py", line 1249, in handle_oidc_callback
    await self._complete_oidc_login(
  File "/var/synapse/synapse/handlers/oidc.py", line 1371, in _complete_oidc_login
    await self._sso_handler.complete_sso_login_request(
  File "/var/synapse/synapse/handlers/sso.py", line 509, in complete_sso_login_request
    user_id = await self._register_mapped_user(
  File "/var/synapse/synapse/handlers/sso.py", line 728, in _register_mapped_user
    raise MappingException("localpart is invalid: %s" % (attributes.localpart,))
synapse.handlers.sso.MappingException: localpart is invalid: JuicyOyster3318

根据 Appendices | Matrix Specification :

Users within Matrix are uniquely identified by their Matrix user ID. The user ID is namespaced to the homeserver which allocated the account and has the form: @localpart:domain

The localpart of a user ID is an opaque identifier for that user. It MUST NOT be empty, and MUST contain only the characters a-z, 0-9, ., _, =, -, and /.

而 Discourse 的用户名(username)可以是大写字母。