mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-26 16:39:24 +00:00
Add initial support for an external mediaserver. #278
Add 2 extra options `MediaServerUpload` and `MediaServerDownload`, where the URL for upload and download can be specified. See https://github.com/42wim/matterbridge/wiki/Mediaserver-setup-%5Badvanced%5D for an example with caddy
This commit is contained in:
@ -36,6 +36,7 @@ type FileInfo struct {
|
||||
Name string
|
||||
Data *[]byte
|
||||
Comment string
|
||||
URL string
|
||||
}
|
||||
|
||||
type ChannelInfo struct {
|
||||
@ -48,17 +49,19 @@ type ChannelInfo struct {
|
||||
}
|
||||
|
||||
type Protocol struct {
|
||||
AuthCode string // steam
|
||||
BindAddress string // mattermost, slack // DEPRECATED
|
||||
Buffer int // api
|
||||
Charset string // irc
|
||||
EditSuffix string // mattermost, slack, discord, telegram, gitter
|
||||
EditDisable bool // mattermost, slack, discord, telegram, gitter
|
||||
IconURL string // mattermost, slack
|
||||
IgnoreNicks string // all protocols
|
||||
IgnoreMessages string // all protocols
|
||||
Jid string // xmpp
|
||||
Login string // mattermost, matrix
|
||||
AuthCode string // steam
|
||||
BindAddress string // mattermost, slack // DEPRECATED
|
||||
Buffer int // api
|
||||
Charset string // irc
|
||||
EditSuffix string // mattermost, slack, discord, telegram, gitter
|
||||
EditDisable bool // mattermost, slack, discord, telegram, gitter
|
||||
IconURL string // mattermost, slack
|
||||
IgnoreNicks string // all protocols
|
||||
IgnoreMessages string // all protocols
|
||||
Jid string // xmpp
|
||||
Login string // mattermost, matrix
|
||||
MediaServerDownload string
|
||||
MediaServerUpload string
|
||||
MessageQueue int // IRC, size of message queue for flood control
|
||||
MessageDelay int // IRC, time in millisecond to wait between messages
|
||||
MessageLength int // IRC, max length of a message allowed
|
||||
|
@ -178,6 +178,21 @@ func (b *Birc) Send(msg config.Message) (string, error) {
|
||||
msg.Text = buf.String()
|
||||
}
|
||||
|
||||
if msg.Extra != nil {
|
||||
if len(msg.Extra["file"]) > 0 {
|
||||
for _, f := range msg.Extra["file"] {
|
||||
fi := f.(config.FileInfo)
|
||||
if fi.URL != "" {
|
||||
msg.Text = fi.URL
|
||||
b.Local <- config.Message{Text: msg.Text, Username: msg.Username, Channel: msg.Channel, Event: msg.Event}
|
||||
} else {
|
||||
b.Local <- config.Message{Text: msg.Text, Username: msg.Username, Channel: msg.Channel, Event: msg.Event}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
for _, text := range strings.Split(msg.Text, "\n") {
|
||||
if len(text) > b.Config.MessageLength {
|
||||
text = text[:b.Config.MessageLength] + " <message clipped>"
|
||||
|
Reference in New Issue
Block a user