mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-11 16:27:30 -06:00
Store Web Push subscriptions in DB
This commit is contained in:
parent
db2ba34630
commit
0cffb8784e
25 changed files with 546 additions and 69 deletions
18
internal/cache/size.go
vendored
18
internal/cache/size.go
vendored
|
|
@ -66,6 +66,14 @@ you'll make society more equitable for all if you're not careful! :hammer_sickle
|
|||
// be a serialized string of almost any type, so we pick a
|
||||
// nice serialized key size on the upper end of normal.
|
||||
sizeofResultKey = 2 * sizeofIDStr
|
||||
|
||||
// exampleWebPushAuth is a Base64-encoded 16-byte random auth secret.
|
||||
// This secret is consumed as Base64 by webpush-go.
|
||||
exampleWebPushAuth = "ZVxqlt5fzVgmSz2aqiA2XQ=="
|
||||
|
||||
// exampleWebPushP256dh is a Base64-encoded DH P-256 public key.
|
||||
// This secret is consumed as Base64 by webpush-go.
|
||||
exampleWebPushP256dh = "OrpejO16gV97uBXew/T0I7YoUv/CX8fz0z4g8RrQ+edXJqQPjX3XVSo2P0HhcCpCOR1+Dzj5LFcK9jYNqX7SBg=="
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -576,7 +584,7 @@ func sizeofMove() uintptr {
|
|||
func sizeofNotification() uintptr {
|
||||
return uintptr(size.Of(>smodel.Notification{
|
||||
ID: exampleID,
|
||||
NotificationType: gtsmodel.NotificationFave,
|
||||
NotificationType: gtsmodel.NotificationFavourite,
|
||||
CreatedAt: exampleTime,
|
||||
TargetAccountID: exampleID,
|
||||
OriginAccountID: exampleID,
|
||||
|
|
@ -821,3 +829,11 @@ func sizeofUserMute() uintptr {
|
|||
Notifications: util.Ptr(false),
|
||||
}))
|
||||
}
|
||||
|
||||
func sizeofWebPushSubscription() uintptr {
|
||||
return uintptr(size.Of(>smodel.WebPushSubscription{
|
||||
TokenID: exampleID,
|
||||
Auth: exampleWebPushAuth,
|
||||
P256dh: exampleWebPushP256dh,
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue