Compare commits
10 Commits
bcea28d8dd
...
c8b4578409
Author | SHA1 | Date |
---|---|---|
Timo Ley | c8b4578409 | |
Tulir Asokan | 223f43cf64 | |
Timo Ley | 196e5bc106 | |
Timo Ley | 1bbfd603be | |
Timo Ley | e418e7df7c | |
Timo Ley | 074745a3b5 | |
Timo Ley | 805d84776a | |
Timo Ley | 7c692aebae | |
Timo Ley | fae313fa32 | |
Timo Ley | 5c80732064 |
|
@ -1,3 +1,8 @@
|
|||
# v0.10.7 (2024-04-16)
|
||||
|
||||
* Changed media download retries to be handled asynchronously instead of
|
||||
blocking other messages.
|
||||
|
||||
# v0.10.6 (2024-03-16)
|
||||
|
||||
* Bumped minimum Go version to 1.21.
|
||||
|
|
|
@ -95,27 +95,28 @@ type BridgeConfig struct {
|
|||
|
||||
DoublePuppetConfig bridgeconfig.DoublePuppetConfig `yaml:",inline"`
|
||||
|
||||
PrivateChatPortalMeta string `yaml:"private_chat_portal_meta"`
|
||||
ParallelMemberSync bool `yaml:"parallel_member_sync"`
|
||||
BridgeNotices bool `yaml:"bridge_notices"`
|
||||
ResendBridgeInfo bool `yaml:"resend_bridge_info"`
|
||||
MuteBridging bool `yaml:"mute_bridging"`
|
||||
ArchiveTag string `yaml:"archive_tag"`
|
||||
PinnedTag string `yaml:"pinned_tag"`
|
||||
TagOnlyOnCreate bool `yaml:"tag_only_on_create"`
|
||||
MarkReadOnlyOnCreate bool `yaml:"mark_read_only_on_create"`
|
||||
EnableStatusBroadcast bool `yaml:"enable_status_broadcast"`
|
||||
MuteStatusBroadcast bool `yaml:"mute_status_broadcast"`
|
||||
StatusBroadcastTag string `yaml:"status_broadcast_tag"`
|
||||
WhatsappThumbnail bool `yaml:"whatsapp_thumbnail"`
|
||||
AllowUserInvite bool `yaml:"allow_user_invite"`
|
||||
FederateRooms bool `yaml:"federate_rooms"`
|
||||
URLPreviews bool `yaml:"url_previews"`
|
||||
CaptionInMessage bool `yaml:"caption_in_message"`
|
||||
BeeperGalleries bool `yaml:"beeper_galleries"`
|
||||
ExtEvPolls bool `yaml:"extev_polls"`
|
||||
CrossRoomReplies bool `yaml:"cross_room_replies"`
|
||||
DisableReplyFallbacks bool `yaml:"disable_reply_fallbacks"`
|
||||
PrivateChatPortalMeta string `yaml:"private_chat_portal_meta"`
|
||||
ParallelMemberSync bool `yaml:"parallel_member_sync"`
|
||||
BridgeNotices bool `yaml:"bridge_notices"`
|
||||
ResendBridgeInfo bool `yaml:"resend_bridge_info"`
|
||||
MuteBridging bool `yaml:"mute_bridging"`
|
||||
ArchiveTag string `yaml:"archive_tag"`
|
||||
PinnedTag string `yaml:"pinned_tag"`
|
||||
TagOnlyOnCreate bool `yaml:"tag_only_on_create"`
|
||||
MarkReadOnlyOnCreate bool `yaml:"mark_read_only_on_create"`
|
||||
EnableStatusBroadcast bool `yaml:"enable_status_broadcast"`
|
||||
MuteStatusBroadcast bool `yaml:"mute_status_broadcast"`
|
||||
StatusBroadcastTag string `yaml:"status_broadcast_tag"`
|
||||
WhatsappThumbnail bool `yaml:"whatsapp_thumbnail"`
|
||||
AllowUserInvite bool `yaml:"allow_user_invite"`
|
||||
FederateRooms bool `yaml:"federate_rooms"`
|
||||
URLPreviews bool `yaml:"url_previews"`
|
||||
CaptionInMessage bool `yaml:"caption_in_message"`
|
||||
BeeperGalleries bool `yaml:"beeper_galleries"`
|
||||
ExtEvPolls bool `yaml:"extev_polls"`
|
||||
CrossRoomReplies bool `yaml:"cross_room_replies"`
|
||||
DisableReplyFallbacks bool `yaml:"disable_reply_fallbacks"`
|
||||
PrivateChatSelfPuppets bool `yaml:"private_chat_self_puppets"`
|
||||
|
||||
MessageHandlingTimeout struct {
|
||||
ErrorAfterStr string `yaml:"error_after"`
|
||||
|
|
|
@ -116,6 +116,7 @@ func DoUpgrade(helper *up.Helper) {
|
|||
}
|
||||
helper.Copy(up.Bool, "bridge", "cross_room_replies")
|
||||
helper.Copy(up.Bool, "bridge", "disable_reply_fallbacks")
|
||||
helper.Copy(up.Bool, "bridge", "private_chat_self_puppets")
|
||||
helper.Copy(up.Str|up.Null, "bridge", "message_handling_timeout", "error_after")
|
||||
helper.Copy(up.Str|up.Null, "bridge", "message_handling_timeout", "deadline")
|
||||
|
||||
|
|
|
@ -315,6 +315,10 @@ bridge:
|
|||
# Disable generating reply fallbacks? Some extremely bad clients still rely on them,
|
||||
# but they're being phased out and will be completely removed in the future.
|
||||
disable_reply_fallbacks: false
|
||||
# Invite the puppet which represents the bridge user into private chats?
|
||||
# This allows proper backfilling in private chats without double puppeting enabled,
|
||||
# but adds an additional puppet user to each private chat.
|
||||
private_chat_self_puppets: false
|
||||
# Maximum time for handling Matrix events. Duration strings formatted for https://pkg.go.dev/time#ParseDuration
|
||||
# Null means there's no enforced timeout.
|
||||
message_handling_timeout:
|
||||
|
|
6
go.mod
6
go.mod
|
@ -12,7 +12,7 @@ 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.2-0.20240318211948-d27d5a4cda9e
|
||||
go.mau.fi/util v0.4.2
|
||||
go.mau.fi/webp v0.1.0
|
||||
go.mau.fi/whatsmeow v0.0.0-20240327124018-350073db195c
|
||||
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8
|
||||
|
@ -20,7 +20,7 @@ require (
|
|||
golang.org/x/net v0.24.0
|
||||
golang.org/x/sync v0.7.0
|
||||
google.golang.org/protobuf v1.33.0
|
||||
maunium.net/go/mautrix v0.18.1-0.20240413105730-423d32ddf6d6
|
||||
maunium.net/go/mautrix v0.18.1
|
||||
)
|
||||
|
||||
require (
|
||||
|
@ -39,7 +39,7 @@ require (
|
|||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tidwall/sjson v1.2.5 // indirect
|
||||
github.com/yuin/goldmark v1.7.0 // indirect
|
||||
github.com/yuin/goldmark v1.7.1 // indirect
|
||||
go.mau.fi/libsignal v0.1.0 // indirect
|
||||
go.mau.fi/zeroconfig v0.1.2 // indirect
|
||||
golang.org/x/crypto v0.22.0 // indirect
|
||||
|
|
12
go.sum
12
go.sum
|
@ -65,12 +65,12 @@ github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
|||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
|
||||
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
|
||||
github.com/yuin/goldmark v1.7.0 h1:EfOIvIMZIzHdB/R/zVrikYLPPwJlfMcNczJFMs1m6sA=
|
||||
github.com/yuin/goldmark v1.7.0/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U=
|
||||
github.com/yuin/goldmark v1.7.1/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.2-0.20240318211948-d27d5a4cda9e h1:2jdYsZTTIwSo4TGmVrqLgeCqaxexJ9nY2Tuj1MzDIwc=
|
||||
go.mau.fi/util v0.4.2-0.20240318211948-d27d5a4cda9e/go.mod h1:GjkTEBsehYZbSh2LlE6cWEn+6ZIZTGrTMM/5DMNlmFY=
|
||||
go.mau.fi/util v0.4.2 h1:RR3TOcRHmCF9Bx/3YG4S65MYfa+nV6/rn8qBWW4Mi30=
|
||||
go.mau.fi/util v0.4.2/go.mod h1:PlAVfUUcPyHPrwnvjkJM9UFcPE7qGPDJqk+Oufa1Gtw=
|
||||
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-20240327124018-350073db195c h1:a5O4nqmwUWvmC+27RUdefkuy5XzMOEUqR9ji+/BcHZA=
|
||||
|
@ -105,5 +105,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.1-0.20240413105730-423d32ddf6d6 h1:zSGNGm31EzKYDmKJG2VS5wYqYDAT5pJhFfGauR6r4yU=
|
||||
maunium.net/go/mautrix v0.18.1-0.20240413105730-423d32ddf6d6/go.mod h1:STwJZ+6CAeiEQs7fYCkd5aC12XR5DXANE6Swy/PBKGo=
|
||||
maunium.net/go/mautrix v0.18.1 h1:a6mUsJixegBNTXUoqC5RQ9gsumIPzKvCubKwF+zmCt4=
|
||||
maunium.net/go/mautrix v0.18.1/go.mod h1:2oHaq792cSXFGvxLvYw3Gf1L4WVVP4KZcYys5HVk/h8=
|
||||
|
|
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.6",
|
||||
Version: "0.10.7",
|
||||
ProtocolName: "WhatsApp",
|
||||
BeeperServiceName: "whatsapp",
|
||||
BeeperNetworkName: "whatsapp",
|
||||
|
|
13
portal.go
13
portal.go
|
@ -1216,7 +1216,7 @@ func (portal *Portal) getMessageIntent(ctx context.Context, user *User, info *ty
|
|||
return nil
|
||||
}
|
||||
intent := puppet.IntentFor(portal)
|
||||
if !intent.IsCustomPuppet && portal.IsPrivateChat() && info.Sender.User == portal.Key.Receiver.User && portal.Key.Receiver != portal.Key.JID {
|
||||
if !portal.bridge.Config.Bridge.PrivateChatSelfPuppets && !intent.IsCustomPuppet && portal.IsPrivateChat() && info.Sender.User == portal.Key.Receiver.User && portal.Key.Receiver != portal.Key.JID {
|
||||
zerolog.Ctx(ctx).Debug().Msg("Not handling message: user doesn't have double puppeting enabled")
|
||||
return nil
|
||||
}
|
||||
|
@ -2180,6 +2180,10 @@ func (portal *Portal) CreateMatrixRoom(ctx context.Context, user *User, groupInf
|
|||
invite = append(invite, portal.bridge.Bot.UserID)
|
||||
}
|
||||
}
|
||||
if portal.IsPrivateChat() && portal.bridge.Config.Bridge.PrivateChatSelfPuppets {
|
||||
rec := portal.bridge.GetPuppetByJID(portal.Key.Receiver)
|
||||
invite = append(invite, rec.MXID)
|
||||
}
|
||||
if !portal.AvatarURL.IsEmpty() && portal.shouldSetDMRoomMetadata() {
|
||||
initialState = append(initialState, &event.Event{
|
||||
Type: event.StateRoomAvatar,
|
||||
|
@ -2303,6 +2307,13 @@ func (portal *Portal) CreateMatrixRoom(ctx context.Context, user *User, groupInf
|
|||
log.Err(err).Msg("Failed to ensure bridge bot is joined to created portal")
|
||||
}
|
||||
}
|
||||
if portal.bridge.Config.Bridge.PrivateChatSelfPuppets {
|
||||
rec := portal.bridge.GetPuppetByJID(portal.Key.Receiver)
|
||||
err = rec.DefaultIntent().EnsureJoined(ctx, portal.MXID)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to join created portal with puppet")
|
||||
}
|
||||
}
|
||||
|
||||
user.UpdateDirectChats(ctx, map[id.UserID][]id.RoomID{puppet.MXID: {portal.MXID}})
|
||||
} else if portal.IsParent {
|
||||
|
|
Loading…
Reference in New Issue