跳转到主要内容

"一个模块,用于基于被邀请者的域名防止向Matrix房间发送邀请。"

项目描述

Synapse Domain Rule Checker

一个模块,用于通过检查涉及的服务器(们)的域名来防止向Matrix房间发送邀请和加入。

安装

从您为Synapse使用的虚拟环境中安装此模块

pip install synapse-domain-rule-checker

(如果遇到问题,您可能需要首先升级pip,例如通过运行pip install --upgrade pip)

然后修改您的 homeserver 配置,将以下内容添加到您的modules配置中

modules:
  - module: synapse_domain_rule_checker.DomainRuleChecker
    config:
      # A mapping describing which servers a server can invite into a room.
      # Default is any server can invite any other server.
      domain_mapping:
        "inviter_domain": [ "invitee_domain_permitted", "other_domain_permitted" ]
        "other_inviter_domain": [ "invitee_domain_permitted" ]

      # Whether an invite should be allowed through if the inviting server doesn't appear
      # in the domain_mapping.
      # Required.
      can_invite_if_not_in_domain_mapping: false

      # Whether a user on this server needs to be invited to be allowed into a room,
      # regardless of the room's settings.
      # Defaults to false.
      can_only_join_rooms_with_invite: false

      # Whether a user on this server can only invite when creating a room.
      # Default is false.
      can_only_invite_during_room_creation: false

      # List of servers that can't be invited to rooms that have been published to the
      # public room directory. This setting only really works in a closed federation in
      # which every server agrees on the list.
      # Defaults to all servers being allowed.
      domains_prevented_from_being_invited_to_published_rooms: []

      # Whether a local user can invite another user using a third-party identifier (e.g.
      # an email address).
      # Defaults to true.
      can_invite_by_third_party_id: true

请注意,在定义domain_mappingdomains_prevented_from_being_invited_to_published_rooms的值时,需要考虑两个本地用户之间的邀请。

开发

在一个具有pip ≥ 21.1的虚拟环境中运行

pip install -e .[dev]

要运行单元测试,您可以使用

tox -e py

或者

trial tests

要运行linters和mypy类型检查器,请使用./scripts-dev/lint.sh

发布

发布的确切步骤可能会有所不同;但这是Synapse开发者采取的方法(假设是类Unix的shell)

  1. 设置一个shell变量,其值为您要发布的版本(这只是为了使后续步骤更容易)

    version=X.Y.Z
    
  2. 更新setup.cfg,以便版本正确。

  3. 暂存更改的文件并提交。

    git add -u
    git commit -m v$version -n
    
  4. 推送您的更改。

    git push
    
  5. 准备就绪时,为发布创建一个已签名的标签

    git tag -s v$version
    

    根据变更日志制定标签信息。

  6. 推送标签。

    git push origin tag v$version
    
  7. 创建源分发布并将其上传到PyPI

    python -m build
    twine upload dist/synapse_domain_rule_checker-$version*
    

项目详情


下载文件

下载适用于您平台的应用程序文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发布

synapse_domain_rule_checker-1.0.0.tar.gz (6.3 kB 查看哈希值)

上传时间 源码

构建分发版

synapse_domain_rule_checker-1.0.0-py3-none-any.whl (6.5 kB 查看哈希值)

上传时间 Python 3

由以下机构支持