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
|
# Only enable this if your displayname_template has some static part that the bridge can use to
|
||||||
# reliably identify what is a plaintext highlight.
|
# reliably identify what is a plaintext highlight.
|
||||||
plaintext_highlights: false
|
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.
|
# The prefix for commands. Only required in non-management rooms.
|
||||||
command_prefix: "!tg"
|
command_prefix: "!tg"
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ class Config(DictWithRecursion):
|
|||||||
copy("bridge.allow_matrix_login")
|
copy("bridge.allow_matrix_login")
|
||||||
copy("bridge.inline_images")
|
copy("bridge.inline_images")
|
||||||
copy("bridge.plaintext_highlights")
|
copy("bridge.plaintext_highlights")
|
||||||
|
copy("bridge.public_portals")
|
||||||
|
|
||||||
copy("bridge.command_prefix")
|
copy("bridge.command_prefix")
|
||||||
|
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ class Portal:
|
|||||||
self._main_intent = puppet.intent if direct else self.az.intent
|
self._main_intent = puppet.intent if direct else self.az.intent
|
||||||
|
|
||||||
if self.peer_type == "channel" and entity.username:
|
if self.peer_type == "channel" and entity.username:
|
||||||
public = True
|
public = config["bridge.public_portals"]
|
||||||
alias = self._get_alias_localpart(entity.username)
|
alias = self._get_alias_localpart(entity.username)
|
||||||
self.username = entity.username
|
self.username = entity.username
|
||||||
else:
|
else:
|
||||||
@@ -403,7 +403,8 @@ class Portal:
|
|||||||
self.username = username or None
|
self.username = username or None
|
||||||
if self.username:
|
if self.username:
|
||||||
await self.main_intent.add_room_alias(self.mxid, self._get_alias_localpart())
|
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:
|
else:
|
||||||
await self.main_intent.set_join_rule(self.mxid, "invite")
|
await self.main_intent.set_join_rule(self.mxid, "invite")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user