mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-04 14:52:19 +02:00
server: fix push subscription
This commit is contained in:
parent
56215382a3
commit
46f3fd9682
|
@ -812,12 +812,13 @@ class Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: type session to this.attachedClients
|
// TODO: type session to this.attachedClients
|
||||||
registerPushSubscription(session: any, subscription: ClientPushSubscription, noSave = false) {
|
registerPushSubscription(session: any, subscription: PushSubscriptionJSON, noSave = false) {
|
||||||
if (
|
if (
|
||||||
!_.isPlainObject(subscription) ||
|
!_.isPlainObject(subscription) ||
|
||||||
!_.isPlainObject(subscription.keys) ||
|
|
||||||
typeof subscription.endpoint !== "string" ||
|
typeof subscription.endpoint !== "string" ||
|
||||||
!/^https?:\/\//.test(subscription.endpoint) ||
|
!/^https?:\/\//.test(subscription.endpoint) ||
|
||||||
|
!_.isPlainObject(subscription.keys) ||
|
||||||
|
!subscription.keys || // TS compiler doesn't understand isPlainObject
|
||||||
typeof subscription.keys.p256dh !== "string" ||
|
typeof subscription.keys.p256dh !== "string" ||
|
||||||
typeof subscription.keys.auth !== "string"
|
typeof subscription.keys.auth !== "string"
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in a new issue