Update to woodstock release v0.3.1
This commit is contained in:
parent
165683ee9f
commit
18698a578e
3 changed files with 11 additions and 6 deletions
2
go.mod
2
go.mod
|
@ -8,5 +8,5 @@ require (
|
||||||
github.com/mitchellh/go-wordwrap v1.0.1
|
github.com/mitchellh/go-wordwrap v1.0.1
|
||||||
github.com/smartystreets/goconvey v1.6.4 // indirect
|
github.com/smartystreets/goconvey v1.6.4 // indirect
|
||||||
gopkg.in/ini.v1 v1.62.0
|
gopkg.in/ini.v1 v1.62.0
|
||||||
mcmillian.dev/go/woodstock v0.0.0-20220820203043-62b10b5c3c0d
|
mcmillian.dev/go/woodstock v0.3.1
|
||||||
)
|
)
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -26,5 +26,5 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
|
||||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
|
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
|
||||||
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
mcmillian.dev/go/woodstock v0.0.0-20220820203043-62b10b5c3c0d h1:TTvGSHCAy5HsIV9p5ruxKX+C5XoJyQ/RlcWTmySV9SI=
|
mcmillian.dev/go/woodstock v0.3.1 h1:m88zZQ726dw+jBpPXhqbdeTXHL5/rnJ4g1MOzV+oMm0=
|
||||||
mcmillian.dev/go/woodstock v0.0.0-20220820203043-62b10b5c3c0d/go.mod h1:1CUHYZ1VUVX22aCcG9Pc/W9ZnwtFzHoyN4YHaAguO/I=
|
mcmillian.dev/go/woodstock v0.3.1/go.mod h1:1CUHYZ1VUVX22aCcG9Pc/W9ZnwtFzHoyN4YHaAguO/I=
|
||||||
|
|
|
@ -17,11 +17,11 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mcmillian.dev/go/woodstock"
|
|
||||||
"github.com/gabriel-vasile/mimetype"
|
"github.com/gabriel-vasile/mimetype"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/mitchellh/go-wordwrap"
|
"github.com/mitchellh/go-wordwrap"
|
||||||
"gopkg.in/ini.v1"
|
"gopkg.in/ini.v1"
|
||||||
|
"mcmillian.dev/go/woodstock"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cfgfile *string
|
var cfgfile *string
|
||||||
|
@ -109,6 +109,11 @@ type PnutOembed struct {
|
||||||
Height int `json:"height"`
|
Height int `json:"height"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Raw struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Value interface{} `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
func subscribe(connectionID string, accessToken string, rooms []Room) {
|
func subscribe(connectionID string, accessToken string, rooms []Room) {
|
||||||
params := url.Values{}
|
params := url.Values{}
|
||||||
params.Set("connection_id", connectionID)
|
params.Set("connection_id", connectionID)
|
||||||
|
@ -214,7 +219,7 @@ func bridgeMsgHandler(conf *Config, msg MbMessage) {
|
||||||
channelID := getPnutChannel(conf.Rooms, msg.Gateway)
|
channelID := getPnutChannel(conf.Rooms, msg.Gateway)
|
||||||
|
|
||||||
text := msg.Text
|
text := msg.Text
|
||||||
var raw []woodstock.Raw
|
var raw []Raw
|
||||||
for _, file := range msg.Extra.File {
|
for _, file := range msg.Extra.File {
|
||||||
fdata, err := base64.StdEncoding.DecodeString(file.Data)
|
fdata, err := base64.StdEncoding.DecodeString(file.Data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -235,7 +240,7 @@ func bridgeMsgHandler(conf *Config, msg MbMessage) {
|
||||||
Width: im.Width,
|
Width: im.Width,
|
||||||
Height: im.Height,
|
Height: im.Height,
|
||||||
}
|
}
|
||||||
raw = append(raw, woodstock.Raw{Type: "io.pnut.core.oembed", Value: oembed})
|
raw = append(raw, Raw{Type: "io.pnut.core.oembed", Value: oembed})
|
||||||
} else {
|
} else {
|
||||||
text = text + "\n" + file.URL
|
text = text + "\n" + file.URL
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue