-
Notifications
You must be signed in to change notification settings - Fork 63
Back/webpush #2662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Back/webpush #2662
Changes from 1 commit
2efd214
8b87232
a5b09aa
d9ffa95
ee564f7
80c7390
094eccb
edb1d58
fb3c960
942c3d4
9481d4a
1423ea8
20a9090
0621e1b
1b5cf32
429b50f
4a69214
676fb5c
0c0f2b2
0aa109c
e0c6bb0
aec0a1b
424adbc
6363888
1182172
0027d1b
dc2fb55
4ef6030
c3df6e4
5fa1b47
294025e
e2c0181
180cf92
de4a2bf
1c94e08
c6b6bc8
c57b446
1b14795
05fca1b
e73a982
3c1e695
36a6877
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Signed-off-by: sim <[email protected]>
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -19,7 +19,7 @@ | |||||
|
|
||||||
| class WebPushClient { | ||||||
| private WebPush $client; | ||||||
| /** @psalm-var array{publicKey: string, privateKey: string} */ | ||||||
| /** @psalm-var array{publicKey: string, privateKey: string, subject: string} */ | ||||||
| private array $vapid; | ||||||
|
|
||||||
| public function __construct( | ||||||
|
|
@@ -62,10 +62,10 @@ private function getClient(): WebPush { | |||||
|
|
||||||
| /** | ||||||
| * @return array | ||||||
| * @psalm-return array{publicKey: string, privateKey: string} | ||||||
| * @psalm-return array{publicKey: string, privateKey: string, subject: string} | ||||||
| */ | ||||||
| private function getVapid(): array { | ||||||
| if (!empty($this->vapid) && array_key_exists('publicKey', $this->vapid) && array_key_exists('privateKey', $this->vapid)) { | ||||||
| if (array_key_exists('publicKey', $this->vapid) && array_key_exists('privateKey', $this->vapid) && array_key_exists('subject', $this->vapid) ) { | ||||||
| return $this->vapid; | ||||||
| } | ||||||
| $publicKey = $this->appConfig->getValueString( | ||||||
|
|
@@ -79,7 +79,8 @@ private function getVapid(): array { | |||||
| lazy: true | ||||||
| ); | ||||||
| if ($publicKey === '' || $privateKey === '') { | ||||||
| $this->vapid = VAPID::createVapidKeys(); | ||||||
| /** @var array{publicKey: string, privateKey: string} $vapid */ | ||||||
| $vapid = VAPID::createVapidKeys(); | ||||||
| $this->appConfig->setValueString( | ||||||
| Application::APP_ID, | ||||||
| 'webpush_vapid_pubkey', | ||||||
|
|
@@ -95,13 +96,13 @@ private function getVapid(): array { | |||||
| sensitive: true | ||||||
| ); | ||||||
| } else { | ||||||
| $this->vapid = [ | ||||||
| $vapid = [ | ||||||
| 'publicKey' => $publicKey, | ||||||
| 'privateKey' => $privateKey, | ||||||
| ]; | ||||||
| } | ||||||
| $this->vapid['subject'] = 'https://github.com/nextcloud/notifications'; | ||||||
| return $this->vapid; | ||||||
| $vapid['subject'] = 'https://github.com/nextcloud/notifications'; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we have freedom of choice and it doesn't need to be a valid link, I'd prefer something not referring to a Microsoft product:
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be a valid address so a push server may contact if there is an issue.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that's better then, but at the same time there is nothing we as Nextcloud can do, if a Nextcloud instance goes rogue and each Nextcloud server itself doesn't have a public contact page. |
||||||
| return $this->vapid = $vapid; | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This permanently removes all the device entries, even if the subscription is continued in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It removes a single push subscription, endpoints are unique