Compare commits
13 Commits
12474f4a63
...
c865e9a8d5
Author | SHA1 | Date |
---|---|---|
Marco Antonio Alvarez | c865e9a8d5 | |
Tulir Asokan | de605d6161 | |
Tulir Asokan | 62aee50dcb | |
Tulir Asokan | b3d29954f3 | |
Tulir Asokan | bcdfa04c57 | |
Tulir Asokan | fee357b652 | |
Tulir Asokan | 46420c1319 | |
Tulir Asokan | d1bc6871d0 | |
Marco Alvarez | 38128830cc | |
Marco Alvarez | 995b3ea207 | |
Marco Alvarez | 0ebb235e61 | |
Marco Alvarez | 598e6e68fc | |
Marco Alvarez | c9175c3f36 |
|
@ -1,8 +1,9 @@
|
|||
# v0.10.6 (unreleased)
|
||||
# v0.10.6 (2024-03-16)
|
||||
|
||||
* Bumped minimum Go version to 1.21.
|
||||
* Added 8-letter code pairing support to provisioning API.
|
||||
* Added more bugs to fix later.
|
||||
* Renamed default branch from `master` to `main`.
|
||||
|
||||
# v0.10.5 (2023-12-16)
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ All setup and usage instructions are located on [docs.mau.fi]. Some quick links:
|
|||
* Basic usage: [Authentication](https://docs.mau.fi/bridges/go/whatsapp/authentication.html)
|
||||
|
||||
### Features & Roadmap
|
||||
[ROADMAP.md](https://github.com/mautrix/whatsapp/blob/master/ROADMAP.md)
|
||||
contains a general overview of what is supported by the bridge.
|
||||
[ROADMAP.md](ROADMAP.md) contains a general overview of what is supported by the bridge.
|
||||
|
||||
## Discussion
|
||||
Matrix room: [#whatsapp:maunium.net](https://matrix.to/#/#whatsapp:maunium.net)
|
||||
|
|
|
@ -54,10 +54,10 @@ const (
|
|||
`
|
||||
updateUserQuery = `
|
||||
UPDATE "user"
|
||||
SET username=$1, agent=$2, device=$3,
|
||||
management_room=$4, space_room=$5,
|
||||
phone_last_seen=$6, phone_last_pinged=$7, timezone=$8
|
||||
WHERE mxid=$9
|
||||
SET username=$2, agent=$3, device=$4,
|
||||
management_room=$5, space_room=$6,
|
||||
phone_last_seen=$7, phone_last_pinged=$8, timezone=$9
|
||||
WHERE mxid=$1
|
||||
`
|
||||
getUserLastAppStateKeyIDQuery = "SELECT key_id FROM whatsmeow_app_state_sync_keys WHERE jid=$1 ORDER BY timestamp DESC LIMIT 1"
|
||||
)
|
||||
|
@ -126,9 +126,9 @@ func (user *User) sqlVariables() []any {
|
|||
device = dbutil.NumPtr(user.JID.Device)
|
||||
}
|
||||
return []any{
|
||||
username, agent, device, user.ManagementRoom, user.SpaceRoom,
|
||||
user.MXID, username, agent, device, user.ManagementRoom, user.SpaceRoom,
|
||||
dbutil.UnixPtr(user.PhoneLastSeen), dbutil.UnixPtr(user.PhoneLastPinged),
|
||||
user.Timezone, user.MXID,
|
||||
user.Timezone,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
11
go.mod
11
go.mod
|
@ -12,14 +12,14 @@ require (
|
|||
github.com/rs/zerolog v1.32.0
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
github.com/tidwall/gjson v1.17.1
|
||||
go.mau.fi/util v0.4.1-0.20240311141448-53cb04950f7e
|
||||
go.mau.fi/util v0.4.1
|
||||
go.mau.fi/webp v0.1.0
|
||||
go.mau.fi/whatsmeow v0.0.0-20240311200223-e9bca1903462
|
||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225
|
||||
go.mau.fi/whatsmeow v0.0.0-20240316104858-18372a0653fa
|
||||
golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f
|
||||
golang.org/x/image v0.15.0
|
||||
golang.org/x/net v0.22.0
|
||||
google.golang.org/protobuf v1.33.0
|
||||
maunium.net/go/mautrix v0.18.0-beta.1.0.20240311183606-94246ffc85aa
|
||||
maunium.net/go/mautrix v0.18.0
|
||||
)
|
||||
|
||||
require (
|
||||
|
@ -48,6 +48,3 @@ require (
|
|||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
maunium.net/go/mauflag v1.0.0 // indirect
|
||||
)
|
||||
|
||||
//replace go.mau.fi/util => ../../Go/go-util
|
||||
//replace maunium.net/go/mautrix => ../mautrix-go
|
||||
|
|
16
go.sum
16
go.sum
|
@ -69,18 +69,18 @@ github.com/yuin/goldmark v1.7.0 h1:EfOIvIMZIzHdB/R/zVrikYLPPwJlfMcNczJFMs1m6sA=
|
|||
github.com/yuin/goldmark v1.7.0/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
go.mau.fi/libsignal v0.1.0 h1:vAKI/nJ5tMhdzke4cTK1fb0idJzz1JuEIpmjprueC+c=
|
||||
go.mau.fi/libsignal v0.1.0/go.mod h1:R8ovrTezxtUNzCQE5PH30StOQWWeBskBsWE55vMfY9I=
|
||||
go.mau.fi/util v0.4.1-0.20240311141448-53cb04950f7e h1:e1jDj/MjleSS5r9DMRbuCZYKy5Rr+sbsu8eWjtLqrGk=
|
||||
go.mau.fi/util v0.4.1-0.20240311141448-53cb04950f7e/go.mod h1:jOAREC/go8T6rGic01cu6WRa90xi9U4z3QmDjRf8xpo=
|
||||
go.mau.fi/util v0.4.1 h1:3EC9KxIXo5+h869zDGf5OOZklRd/FjeVnimTwtm3owg=
|
||||
go.mau.fi/util v0.4.1/go.mod h1:GjkTEBsehYZbSh2LlE6cWEn+6ZIZTGrTMM/5DMNlmFY=
|
||||
go.mau.fi/webp v0.1.0 h1:BHObH/DcFntT9KYun5pDr0Ot4eUZO8k2C7eP7vF4ueA=
|
||||
go.mau.fi/webp v0.1.0/go.mod h1:e42Z+VMFrUMS9cpEwGRIor+lQWO8oUAyPyMtcL+NMt8=
|
||||
go.mau.fi/whatsmeow v0.0.0-20240311200223-e9bca1903462 h1:QOGjCIh2WEfkgX/38KLjnNof79GWx0T+KLrhTHiws3s=
|
||||
go.mau.fi/whatsmeow v0.0.0-20240311200223-e9bca1903462/go.mod h1:lQHbhaG/fI+6hfGqz5Vzn2OBJBEZ05H0kCP6iJXriN4=
|
||||
go.mau.fi/whatsmeow v0.0.0-20240316104858-18372a0653fa h1:ifQivrTMLAAkBkIqdE/D56uAZyc7ziRdhUU59VfNPFg=
|
||||
go.mau.fi/whatsmeow v0.0.0-20240316104858-18372a0653fa/go.mod h1:kNI5foyzqd77d5HaWc1Jico6/rxtZ/UE8nr80hIsbIk=
|
||||
go.mau.fi/zeroconfig v0.1.2 h1:DKOydWnhPMn65GbXZOafgkPm11BvFashZWLct0dGFto=
|
||||
go.mau.fi/zeroconfig v0.1.2/go.mod h1:NcSJkf180JT+1IId76PcMuLTNa1CzsFFZ0nBygIQM70=
|
||||
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
|
||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
|
||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
|
||||
golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f h1:3CW0unweImhOzd5FmYuRsD4Y4oQFKZIjAnKbjV4WIrw=
|
||||
golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
|
||||
golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8=
|
||||
golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
|
||||
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
|
||||
|
@ -103,5 +103,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M=
|
||||
maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA=
|
||||
maunium.net/go/mautrix v0.18.0-beta.1.0.20240311183606-94246ffc85aa h1:TLSWIAWKIWxLghgzWfp7o92pVCcFR3yLsArc0s/tsMs=
|
||||
maunium.net/go/mautrix v0.18.0-beta.1.0.20240311183606-94246ffc85aa/go.mod h1:0sfLB2ejW+lhgio4UlZMmn5i9SuZ8mxFkonFSamrfTE=
|
||||
maunium.net/go/mautrix v0.18.0 h1:sNsApeSWB8x0hLjGcdmi5JqO6Tvp2PVkiSStz+Yas6k=
|
||||
maunium.net/go/mautrix v0.18.0/go.mod h1:STwJZ+6CAeiEQs7fYCkd5aC12XR5DXANE6Swy/PBKGo=
|
||||
|
|
|
@ -526,6 +526,7 @@ func (user *User) storeHistorySync(evt *waProto.HistorySync) {
|
|||
Msg("Storing history sync")
|
||||
|
||||
successfullySavedTotal := 0
|
||||
failedToSaveTotal := 0
|
||||
totalMessageCount := 0
|
||||
for _, conv := range evt.GetConversations() {
|
||||
jid, err := types.ParseJID(conv.GetId())
|
||||
|
@ -578,6 +579,7 @@ func (user *User) storeHistorySync(evt *waProto.HistorySync) {
|
|||
var minTimeIndex, maxTimeIndex int
|
||||
|
||||
successfullySaved := 0
|
||||
failedToSave := 0
|
||||
unsupportedTypes := 0
|
||||
for i, rawMsg := range conv.GetMessages() {
|
||||
// Don't store messages that will just be skipped.
|
||||
|
@ -614,6 +616,7 @@ func (user *User) storeHistorySync(evt *waProto.HistorySync) {
|
|||
Str("msg_id", msgEvt.Info.ID).
|
||||
Time("msg_time", msgEvt.Info.Timestamp).
|
||||
Msg("Failed to save historical message")
|
||||
failedToSave++
|
||||
continue
|
||||
}
|
||||
err = message.Insert(ctx)
|
||||
|
@ -623,12 +626,16 @@ func (user *User) storeHistorySync(evt *waProto.HistorySync) {
|
|||
Str("msg_id", msgEvt.Info.ID).
|
||||
Time("msg_time", msgEvt.Info.Timestamp).
|
||||
Msg("Failed to save historical message")
|
||||
failedToSave++
|
||||
} else {
|
||||
successfullySaved++
|
||||
}
|
||||
successfullySaved++
|
||||
}
|
||||
successfullySavedTotal += successfullySaved
|
||||
failedToSaveTotal += failedToSave
|
||||
log.Debug().
|
||||
Int("saved_count", successfullySaved).
|
||||
Int("failed_count", failedToSave).
|
||||
Int("unsupported_msg_type_count", unsupportedTypes).
|
||||
Time("lowest_time", minTime).
|
||||
Int("lowest_time_index", minTimeIndex).
|
||||
|
@ -646,6 +653,7 @@ func (user *User) storeHistorySync(evt *waProto.HistorySync) {
|
|||
}
|
||||
log.Info().
|
||||
Int("total_saved_count", successfullySavedTotal).
|
||||
Int("total_failed_count", failedToSaveTotal).
|
||||
Int("total_message_count", totalMessageCount).
|
||||
Msg("Finished storing history sync")
|
||||
|
||||
|
|
2
main.go
2
main.go
|
@ -278,7 +278,7 @@ func main() {
|
|||
Name: "mautrix-whatsapp",
|
||||
URL: "https://github.com/mautrix/whatsapp",
|
||||
Description: "A Matrix-WhatsApp puppeting bridge.",
|
||||
Version: "0.10.5",
|
||||
Version: "0.10.6",
|
||||
ProtocolName: "WhatsApp",
|
||||
BeeperServiceName: "whatsapp",
|
||||
BeeperNetworkName: "whatsapp",
|
||||
|
|
11
portal.go
11
portal.go
|
@ -1814,6 +1814,7 @@ func (portal *Portal) GetBasePowerLevels() *event.PowerLevelsEventContent {
|
|||
InvitePtr: &invite,
|
||||
Users: map[id.UserID]int{
|
||||
portal.MainIntent().UserID: 100,
|
||||
portal.bridge.Bot.UserID: 100,
|
||||
},
|
||||
Events: map[string]int{
|
||||
event.StateRoomName.Type: anyone,
|
||||
|
@ -1831,6 +1832,9 @@ func (portal *Portal) applyPowerLevelFixes(levels *event.PowerLevelsEventContent
|
|||
changed = levels.EnsureEventLevel(event.EventReaction, 0) || changed
|
||||
changed = levels.EnsureEventLevel(event.EventRedaction, 0) || changed
|
||||
changed = levels.EnsureEventLevel(TypeMSC3381PollResponse, 0) || changed
|
||||
if portal.IsPrivateChat() {
|
||||
changed = levels.EnsureUserLevel(portal.bridge.Bot.UserID, 100) || changed
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
|
@ -3732,6 +3736,13 @@ func (portal *Portal) convertMediaMessage(ctx context.Context, intent *appservic
|
|||
return portal.makeMediaBridgeFailureMessage(info, fmt.Errorf("failed to upload media: %w", err), converted, nil, "")
|
||||
}
|
||||
}
|
||||
|
||||
// Sticker events require the URL field to be present https://spec.matrix.org/v1.9/client-server-api/#events-16
|
||||
// This seems to affect only clients based on the Rust SDK on encrypted channels (like Element X)
|
||||
if typeName == "sticker" && converted.Content.File != nil {
|
||||
converted.Extra["url"] = ""
|
||||
}
|
||||
|
||||
return converted
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue