Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit af26a81d3b506954b2f660b2e5430c8bc90ed256 Author: Wim <wim@42.be> Date: Thu May 14 00:37:41 2020 +0000 Add an option to disable sending HTML to matrix. Fixes #1022 (#1135) diff --git a/bridge/config/config.go b/bridge/config/config.go index dfb71ee..031f5a8 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -846 +847 @@ type Protocol struct {   DisableWebPagePreview bool // telegram   EditSuffix string // mattermost, slack, discord, telegram, gitter   EditDisable bool // mattermost, slack, discord, telegram, gitter + HTMLDisable bool // matrix   IconURL string // mattermost, slack   IgnoreFailureOnStart bool // general   IgnoreNicks string // all protocols diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go index 78779c8..6521fe8 100644 --- a/bridge/matrix/matrix.go +++ b/bridge/matrix/matrix.go @@ -1246 +12414 @@ func (b *Bmatrix) Send(msg config.Message) (string, error) {   return resp.EventID, err   }   + if b.GetBool("HTMLDisable") { + resp, err := b.mc.SendText(channel, msg.Username+msg.Text) + if err != nil { + return "", err + } + return resp.EventID, err + } +   username := html.EscapeString(msg.Username)   // check if we have a </tag>. if we have, we don't escape HTML. #696   if b.htmlTag.MatchString(msg.Username) { diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index 4082b6d..e0942c6 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -12096 +120911 @@ Password="yourpass"  #OPTIONAL (default false)  NoHomeServerSuffix=false   +#Whether to disable sending of HTML content to matrix +#See https://github.com/42wim/matterbridge/issues/1022 +#OPTIONAL (default false) +HTMLDisable=false +  ## RELOADABLE SETTINGS  ## Settings below can be reloaded by editing the file