web-push 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +3 -3
- data/LICENSE +1 -1
- data/README.md +9 -3
- data/lib/web_push/version.rb +1 -1
- data/lib/web_push.rb +0 -4
- data/spec/spec_helper.rb +5 -2
- data/spec/web_push_spec.rb +12 -0
- data/web-push.gemspec +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a90ad96aa12a10002ba31de9ac2b082abcce714bcb3e7b54e97d702cfd12af0
|
4
|
+
data.tar.gz: c04841ffa17ba33182087413b2b6a266ca08f0370510392df635dc040be6f34c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6d24148fb7b252602028ba38200a3b8d156ece2f5b4fafefdaeae61e8c78718fb8e9d70f58dac356d96e7a455007f0a6d5d422062321fe600ee7783b08d6dde
|
7
|
+
data.tar.gz: 451223df83c431f13ed1da1abb3c074c03e57674180f37bd81abc5156309a8e5582380839bbcb5ba3ec23301ae0b7165083ffa15078b788714f09e6eeea92e6f
|
data/.github/workflows/ci.yml
CHANGED
@@ -9,11 +9,11 @@ jobs:
|
|
9
9
|
strategy:
|
10
10
|
fail-fast: false
|
11
11
|
matrix:
|
12
|
-
os: [ubuntu-
|
13
|
-
ruby-version: ['3.0', '3.1', '3.2']
|
12
|
+
os: [ubuntu-22.04, ubuntu-24.04]
|
13
|
+
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4']
|
14
14
|
runs-on: ${{ matrix.os }}
|
15
15
|
steps:
|
16
|
-
- uses: actions/checkout@
|
16
|
+
- uses: actions/checkout@v4
|
17
17
|
- name: Set up Ruby
|
18
18
|
uses: ruby/setup-ruby@v1
|
19
19
|
with:
|
data/LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Copyright (c) 2016 Hiroyuki Sakuraba
|
2
|
-
Copyright (c) 2022 Marco Colli, Pushpad (https://pushpad.xyz)
|
2
|
+
Copyright (c) 2022-2025 Marco Colli, Pushpad (https://pushpad.xyz)
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -55,10 +55,16 @@ navigator.serviceWorker.register('/service-worker.js')
|
|
55
55
|
|
56
56
|
### Subscribing to push notifications
|
57
57
|
|
58
|
-
The VAPID public key you generated earlier
|
58
|
+
The VAPID public key that you generated earlier needs to be made available to JavaScript, which can be done in many ways, for example with a fetch request or when rendering the HTML template in Ruby:
|
59
59
|
|
60
|
-
```
|
61
|
-
|
60
|
+
```erb
|
61
|
+
<script>
|
62
|
+
// Make the VAPID public key available to the client as a Uint8Array
|
63
|
+
window.vapidPublicKey = new Uint8Array(<%= Base64.urlsafe_decode64(ENV['VAPID_PUBLIC_KEY']).bytes %>)
|
64
|
+
|
65
|
+
// Or you can pass it as a string if you prefer
|
66
|
+
window.vapidPublicKey = "<%= ENV['VAPID_PUBLIC_KEY'].delete('=') %>"
|
67
|
+
</script>
|
62
68
|
```
|
63
69
|
|
64
70
|
Your JavaScript code uses the `pushManager` interface to subscribe to push notifications, passing the VAPID public key to the subscription settings.
|
data/lib/web_push/version.rb
CHANGED
data/lib/web_push.rb
CHANGED
@@ -56,10 +56,6 @@ module WebPush
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def decode64(str)
|
59
|
-
# For Ruby < 2.3, Base64.urlsafe_decode64 strict decodes and will raise errors if encoded value is not properly padded
|
60
|
-
# Implementation: http://ruby-doc.org/stdlib-2.3.0/libdoc/base64/rdoc/Base64.html#method-i-urlsafe_decode64
|
61
|
-
str = str.ljust((str.length + 3) & ~3, '=') if !str.end_with?('=') && str.length % 4 != 0
|
62
|
-
|
63
59
|
Base64.urlsafe_decode64(str)
|
64
60
|
end
|
65
61
|
|
data/spec/spec_helper.rb
CHANGED
data/spec/web_push_spec.rb
CHANGED
@@ -5,6 +5,18 @@ describe WebPush do
|
|
5
5
|
expect(WebPush::VERSION).not_to be nil
|
6
6
|
end
|
7
7
|
|
8
|
+
describe '.decode64' do
|
9
|
+
let(:a_padded_key) { "YWJjZGU=" }
|
10
|
+
|
11
|
+
it 'urlsafe decodes padded base64 string' do
|
12
|
+
expect(WebPush.decode64(a_padded_key)).to eq("abcde")
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'urlsafe decodes unpadded base64 string' do
|
16
|
+
expect(WebPush.decode64(a_padded_key.delete("="))).to eq("abcde")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
8
20
|
shared_examples 'web push protocol standard error handling' do
|
9
21
|
it 'raises InvalidSubscription if the API returns a 404 Error' do
|
10
22
|
stub_request(:post, expected_endpoint)
|
data/web-push.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web-push
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zaru
|
8
8
|
- collimarco
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-06-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jwt
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '3.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '3.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: openssl
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '3.0'
|
84
|
-
description:
|
84
|
+
description:
|
85
85
|
email:
|
86
86
|
- support@pushpad.xyz
|
87
87
|
executables: []
|
@@ -110,7 +110,7 @@ homepage: https://github.com/pushpad/web-push
|
|
110
110
|
licenses:
|
111
111
|
- MIT
|
112
112
|
metadata: {}
|
113
|
-
post_install_message:
|
113
|
+
post_install_message:
|
114
114
|
rdoc_options: []
|
115
115
|
require_paths:
|
116
116
|
- lib
|
@@ -125,8 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
129
|
-
signing_key:
|
128
|
+
rubygems_version: 3.5.22
|
129
|
+
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Web Push library for Ruby (RFC8030)
|
132
132
|
test_files: []
|