diff --git a/README.md b/README.md index 98444c4..7b3fa1d 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,11 @@ muc_mention_compat = true # will leave the MUC. dont_ignore_offline = true +# If true, when receiving a file to embed in Discord, the bridge will remove the URL from +# the content, leaving only the embed behind. This prevents Discord users who disabled +# link previews from viewing the embed. +remove_url_on_embed = true + # When sending files from Discord to XMPP, proxy the URLS with this template. "" and # and "" will be substituted. Proxy will not be used if not set. proxy_discord_urls_to = "https://proxy.server.example/proxy//" diff --git a/xmpp_discord_bridge/main.py b/xmpp_discord_bridge/main.py index e779ef7..0942749 100644 --- a/xmpp_discord_bridge/main.py +++ b/xmpp_discord_bridge/main.py @@ -58,6 +58,7 @@ class BridgeComponent(ComponentXMPP): self._dont_ignore_offline = self._config["general"].get("dont_ignore_offline", True) self._reactions_compat = self._config["general"].get("reactions_compat", True) self._muc_mention_compat = self._config["general"].get("muc_mention_compat", True) + self._remove_url_on_embed = self._config["general"].get("remove_url_on_embed", False) register_stanza_plugin(Message, OOBData) @@ -260,7 +261,7 @@ class BridgeComponent(ComponentXMPP): embed.set_image(url=message["oob"]["url"]) # I mean, this should always be true, but you never know - if content == message["oob"]["url"]: + if content == message["oob"]["url"] and self._remove_url_on_embed: # NOTE: To prevent the URL being visible in Discord, remove the content. # Makes it feel more native. content = None