Make no-cgo build work without source changes
This commit is contained in:
parent
baae66ed04
commit
f89fcf7212
1
go.mod
1
go.mod
@ -11,6 +11,7 @@ require (
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
||||
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8
|
||||
gopkg.in/yaml.v2 v2.2.8
|
||||
maunium.net/go/mauflag v1.0.0
|
||||
maunium.net/go/maulogger/v2 v2.1.1
|
||||
|
2
go.sum
2
go.sum
@ -59,6 +59,8 @@ github.com/tulir/go-whatsapp v0.2.6 h1:d58cqz/iqcCDeT+uFjLso8oSgMTYqoxGhGhGOyyHB
|
||||
github.com/tulir/go-whatsapp v0.2.6/go.mod h1:gyw9zGup1/Y3ZQUueZaqz3iR/WX9a2Lth4aqEbXjkok=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8 h1:6WW6V3x1P/jokJBpRQYUJnMHRP6isStQwCozxnU7XQw=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
|
@ -18,9 +18,21 @@
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"image"
|
||||
"io"
|
||||
|
||||
"golang.org/x/image/webp"
|
||||
)
|
||||
|
||||
func (bridge *Bridge) initCrypto() error {
|
||||
if !bridge.Config.Bridge.Encryption.Allow {
|
||||
bridge.Log.Warnln("Bridge built without end-to-bridge encryption, but encryption is enabled in config")
|
||||
}
|
||||
bridge.Log.Debugln("Bridge built without end-to-bridge encryption")
|
||||
return nil
|
||||
}
|
||||
|
||||
func decodeWebp(r io.Reader) (image.Image, error) {
|
||||
return webp.Decode(r)
|
||||
}
|
@ -34,7 +34,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/chai2010/webp"
|
||||
"github.com/pkg/errors"
|
||||
log "maunium.net/go/maulogger/v2"
|
||||
|
||||
@ -989,7 +988,7 @@ func (portal *Portal) HandleMediaMessage(source *User, download func() ([]byte,
|
||||
|
||||
// synapse doesn't handle webp well, so we convert it. This can be dropped once https://github.com/matrix-org/synapse/issues/4382 is fixed
|
||||
if mimeType == "image/webp" {
|
||||
img, err := webp.Decode(bytes.NewReader(data))
|
||||
img, err := decodeWebp(bytes.NewReader(data))
|
||||
if err != nil {
|
||||
portal.log.Errorfln("Failed to decode media for %s: %v", err)
|
||||
return
|
||||
@ -1188,7 +1187,7 @@ func (portal *Portal) sendMatrixConnectionError(sender *User, eventID id.EventID
|
||||
if sender.IsLoginInProgress() {
|
||||
reconnect = "You have a login attempt in progress, please wait."
|
||||
}
|
||||
msg := format.RenderMarkdown("\u26a0 You are not connected to WhatsApp, so your message was not bridged. " + reconnect, true, false)
|
||||
msg := format.RenderMarkdown("\u26a0 You are not connected to WhatsApp, so your message was not bridged. "+reconnect, true, false)
|
||||
msg.MsgType = event.MsgNotice
|
||||
_, err := portal.sendMainIntentMessage(msg)
|
||||
if err != nil {
|
||||
@ -1229,7 +1228,6 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event) {
|
||||
}
|
||||
portal.log.Debugfln("Received event %s", evt.ID)
|
||||
|
||||
|
||||
ts := uint64(evt.Timestamp / 1000)
|
||||
status := waProto.WebMessageInfo_ERROR
|
||||
fromMe := true
|
||||
|
Loading…
Reference in New Issue
Block a user