Thumbnail

rani/matterbridge.git

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

commit 7c6901ba7edc5062683942d783d374726a6e37cd Author: Wim <wim@42.be> Date: Tue Jul 04 01:34:02 2017 +0000 Add UseInsecureURL option (telegram) diff --git a/bridge/config/config.go b/bridge/config/config.go index fc41fe0..69a13e4 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -776 +777 @@ type Protocol struct {   UseSASL bool // IRC   UseTLS bool // IRC   UseFirstName bool // telegram + UseInsecureURL bool // telegram   WebhookBindAddress string // mattermost, slack   WebhookURL string // mattermost, slack   WebhookUse string // mattermost, slack, discord diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 48ad672..ce43b34 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -11418 +11418 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {   if username == "" {   username = "unknown"   } - if message.Sticker != nil { + if message.Sticker != nil && b.Config.UseInsecureURL {   text = text + " " + b.getFileDirectURL(message.Sticker.FileID)   } - if message.Video != nil { + if message.Video != nil && b.Config.UseInsecureURL {   text = text + " " + b.getFileDirectURL(message.Video.FileID)   } - if message.Photo != nil { + if message.Photo != nil && b.Config.UseInsecureURL {   photos := *message.Photo   // last photo is the biggest   text = text + " " + b.getFileDirectURL(photos[len(photos)-1].FileID)   } - if message.Document != nil { + if message.Document != nil && b.Config.UseInsecureURL {   text = text + " " + message.Document.FileName + " : " + b.getFileDirectURL(message.Document.FileID)   }   if text != "" { diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index c725b14..dac68da 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -5036 +50312 @@ MessageFormat=""  #OPTIONAL (default false)  UseFirstName=false   +#WARNING! If enabled this will relay GIF/stickers/documents and other attachments as URLs +#Those URLs will contain your bot-token. This may not be what you want. +#For now there is no secure way to relay GIF/stickers/documents without seeing your token. +#OPTIONAL (default false) +UseInsecureURL=false +  #Disable sending of edits to other bridges  #OPTIONAL (default false)  EditDisable=false