diff --git a/.gitignore b/.gitignore index 8c8540e..ec61c09 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ *.json *.db *.log + +/mautrix-whatsapp diff --git a/crypto.go b/crypto.go index 53b63d1..2d3808e 100644 --- a/crypto.go +++ b/crypto.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// +build cgo +// +build cgo,!nocrypto package main @@ -29,10 +29,11 @@ import ( "maunium.net/go/maulogger/v2" "maunium.net/go/mautrix" - "maunium.net/go/mautrix-whatsapp/database" "maunium.net/go/mautrix/crypto" "maunium.net/go/mautrix/event" "maunium.net/go/mautrix/id" + + "maunium.net/go/mautrix-whatsapp/database" ) var levelTrace = maulogger.Level{ diff --git a/database/cryptostore.go b/database/cryptostore.go index eab7e7e..618d150 100644 --- a/database/cryptostore.go +++ b/database/cryptostore.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// +build cgo +// +build cgo,!nocrypto package database diff --git a/go.mod b/go.mod index 0ffed15..d6bb7c0 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( gopkg.in/yaml.v2 v2.3.0 maunium.net/go/mauflag v1.0.0 maunium.net/go/maulogger/v2 v2.1.1 - maunium.net/go/mautrix v0.7.0-rc.2 + maunium.net/go/mautrix v0.7.0-rc.3 ) replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.3.7 diff --git a/go.sum b/go.sum index c52ba65..ed26aa2 100644 --- a/go.sum +++ b/go.sum @@ -128,6 +128,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM= golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/image v0.0.0-20200618115811-c13761719519 h1:1e2ufUJNM3lCHEY5jIgac/7UTjd6cgJNdatjPdFWf34= golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -216,3 +217,5 @@ maunium.net/go/mautrix v0.6.1 h1:OFxAEnjEtkstE5J3RLv+vVrUORY6UTXV8pD/qWRBTPI= maunium.net/go/mautrix v0.6.1/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo= maunium.net/go/mautrix v0.7.0-rc.2 h1:139raRbbLft9i+g0zGVOT8rrHKRQmeo0SsZnFpZDEXE= maunium.net/go/mautrix v0.7.0-rc.2/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo= +maunium.net/go/mautrix v0.7.0-rc.3 h1:GVmrVvY5vDASMyZ2xJ9kNynWsgqKl1yerKP7c6RsM7o= +maunium.net/go/mautrix v0.7.0-rc.3/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo= diff --git a/no-cgo.go b/no-cgo.go index 88b359a..d7be10c 100644 --- a/no-cgo.go +++ b/no-cgo.go @@ -1,19 +1,3 @@ -// mautrix-whatsapp - A Matrix-WhatsApp puppeting bridge. -// Copyright (C) 2020 Tulir Asokan -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - // +build !cgo package main @@ -25,14 +9,6 @@ import ( "golang.org/x/image/webp" ) -func NewCryptoHelper(bridge *Bridge) Crypto { - 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) } diff --git a/no-crypto.go b/no-crypto.go new file mode 100644 index 0000000..a339a0a --- /dev/null +++ b/no-crypto.go @@ -0,0 +1,11 @@ +// +build !cgo nocrypto + +package main + +func NewCryptoHelper(bridge *Bridge) Crypto { + 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 +}