client: allow registering apns pusher

This commit is contained in:
Tulir Asokan 2025-03-05 19:59:08 +02:00
parent 7a48c1e843
commit 587b1c1cfd
3 changed files with 8 additions and 5 deletions

2
go.mod
View file

@ -12,7 +12,7 @@ require (
github.com/tidwall/gjson v1.18.0
go.mau.fi/util v0.8.5
go.mau.fi/webp v0.2.0
go.mau.fi/whatsmeow v0.0.0-20250225112721-b7530f3a5056
go.mau.fi/whatsmeow v0.0.0-20250305175604-af3dc0346412
golang.org/x/image v0.24.0
golang.org/x/net v0.35.0
golang.org/x/sync v0.11.0

4
go.sum
View file

@ -70,8 +70,8 @@ go.mau.fi/util v0.8.5 h1:PwCAAtcfK0XxZ4sdErJyfBMkTEWoQU33aB7QqDDzQRI=
go.mau.fi/util v0.8.5/go.mod h1:Ycug9mrbztlahHPEJ6H5r8Nu/xqZaWbE5vPHVWmfz6M=
go.mau.fi/webp v0.2.0 h1:QVMenHw7JDb4vall5sV75JNBQj9Hw4u8AKbi1QetHvg=
go.mau.fi/webp v0.2.0/go.mod h1:VSg9MyODn12Mb5pyG0NIyNFhujrmoFSsZBs8syOZD1Q=
go.mau.fi/whatsmeow v0.0.0-20250225112721-b7530f3a5056 h1:1JQUOpYXhFSEQgXMEWD/ZH38FrIe5i1yjxSBwa0aN/Q=
go.mau.fi/whatsmeow v0.0.0-20250225112721-b7530f3a5056/go.mod h1:6hRrUtDWI2wTRClOd6m17GwrFE2a8/p5R4pjJsIVn+U=
go.mau.fi/whatsmeow v0.0.0-20250305175604-af3dc0346412 h1:AM+t3vKEho3zTDOW2g6KvxB7iGNPwp0SFZpmx4slVVU=
go.mau.fi/whatsmeow v0.0.0-20250305175604-af3dc0346412/go.mod h1:6hRrUtDWI2wTRClOd6m17GwrFE2a8/p5R4pjJsIVn+U=
go.mau.fi/zeroconfig v0.1.3 h1:As9wYDKmktjmNZW5i1vn8zvJlmGKHeVxHVIBMXsm4kM=
go.mau.fi/zeroconfig v0.1.3/go.mod h1:NcSJkf180JT+1IId76PcMuLTNa1CzsFFZ0nBygIQM70=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=

View file

@ -116,8 +116,9 @@ var (
var pushCfg = &bridgev2.PushConfig{
// TODO fetch this from server instead of hardcoding?
Web: &bridgev2.WebPushConfig{VapidKey: "BIt4eFAVqVxe4yOA5_VLbZTbOlV-2y1FYJ_R4RlxWoyYazAq4glIxI7fh_xLbob1SNv7ZtTWn9mmZCsk2YNXYeY"},
FCM: &bridgev2.FCMPushConfig{SenderID: "293955441834"},
Web: &bridgev2.WebPushConfig{VapidKey: "BIt4eFAVqVxe4yOA5_VLbZTbOlV-2y1FYJ_R4RlxWoyYazAq4glIxI7fh_xLbob1SNv7ZtTWn9mmZCsk2YNXYeY"},
FCM: &bridgev2.FCMPushConfig{SenderID: "293955441834"},
APNs: &bridgev2.APNsPushConfig{BundleID: "net.whatsapp.WhatsApp"},
}
func (wa *WhatsAppClient) GetPushConfigs() *bridgev2.PushConfig {
@ -146,6 +147,8 @@ func (wa *WhatsAppClient) RegisterPushNotifications(ctx context.Context, pushTyp
Auth: meta.PushKeys.Auth,
P256DH: meta.PushKeys.P256DH,
}
case bridgev2.PushTypeAPNs:
pc = &whatsmeow.APNsPushConfig{Token: token}
default:
return fmt.Errorf("unsupported push type %s", pushType)
}