Add option to not make publicly joinable channels public on Matrix. Fixes #128
This commit is contained in:
@@ -98,6 +98,8 @@ bridge:
|
||||
# Only enable this if your displayname_template has some static part that the bridge can use to
|
||||
# reliably identify what is a plaintext highlight.
|
||||
plaintext_highlights: false
|
||||
# Whether or not to make portals of publicly joinable channels/supergroups publicly joinable on Matrix.
|
||||
public_portals: true
|
||||
|
||||
# The prefix for commands. Only required in non-management rooms.
|
||||
command_prefix: "!tg"
|
||||
|
||||
@@ -175,6 +175,7 @@ class Config(DictWithRecursion):
|
||||
copy("bridge.allow_matrix_login")
|
||||
copy("bridge.inline_images")
|
||||
copy("bridge.plaintext_highlights")
|
||||
copy("bridge.public_portals")
|
||||
|
||||
copy("bridge.command_prefix")
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ class Portal:
|
||||
self._main_intent = puppet.intent if direct else self.az.intent
|
||||
|
||||
if self.peer_type == "channel" and entity.username:
|
||||
public = True
|
||||
public = config["bridge.public_portals"]
|
||||
alias = self._get_alias_localpart(entity.username)
|
||||
self.username = entity.username
|
||||
else:
|
||||
@@ -403,7 +403,8 @@ class Portal:
|
||||
self.username = username or None
|
||||
if self.username:
|
||||
await self.main_intent.add_room_alias(self.mxid, self._get_alias_localpart())
|
||||
await self.main_intent.set_join_rule(self.mxid, "public")
|
||||
if config["bridge.public_portals"]:
|
||||
await self.main_intent.set_join_rule(self.mxid, "public")
|
||||
else:
|
||||
await self.main_intent.set_join_rule(self.mxid, "invite")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user