rpush 6.0.0 → 7.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -1
- data/README.md +1 -1
- data/lib/generators/templates/rpush.rb +1 -4
- data/lib/generators/templates/rpush_2_0_0_updates.rb +5 -1
- data/lib/rpush/client/active_model/webpush/notification.rb +1 -1
- data/lib/rpush/daemon/store/active_record.rb +11 -7
- data/lib/rpush/daemon/store/redis.rb +6 -6
- data/lib/rpush/logger.rb +1 -1
- data/lib/rpush/version.rb +2 -2
- data/spec/functional/webpush_spec.rb +1 -0
- data/spec/unit/daemon/store/active_record_spec.rb +7 -0
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 409c28bf9f63343232e1c7db56f8d7131acc70b4828032059f37eab3a4606e6c
|
4
|
+
data.tar.gz: 3f07d7e79828fa43ab5ed73a9b19183a9f4ac9e5a3d8891f1ecfec42c7375c03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 400a7241c337ff9874767be4ee051d1494676665bd17e9b3acb2e3ce8efae236971a138888da6c0172e0c649276e97f4d639430733bad345e7980d408e8c3436
|
7
|
+
data.tar.gz: e81b66da807a2bc8a386a12825aed37c452672be899b69ff633d65b80548903669e7d63b3b1eec899633557a489157e8083ed562b2665c017566df9ad220c151
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,42 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v7.0.1](https://github.com/rpush/rpush/tree/v7.0.1) (2022-03-02)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v7.0.0...v7.0.1)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- Fix deprecation warnings from the redis gem [\#636](https://github.com/rpush/rpush/pull/636) ([sharang-d](https://github.com/sharang-d))
|
10
|
+
|
3
11
|
## [Unreleased](https://github.com/rpush/rpush/tree/HEAD)
|
4
12
|
|
5
|
-
[Full Changelog](https://github.com/rpush/rpush/compare/
|
13
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v7.0.0...HEAD)
|
14
|
+
|
15
|
+
## [v7.0.0](https://github.com/rpush/rpush/tree/HEAD)
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v6.0.1...v7.0.0)
|
18
|
+
|
19
|
+
**Merged pull requests:**
|
20
|
+
|
21
|
+
- Test with Ruby 3.1 [\#632](https://github.com/rpush/rpush/pull/632) ([aried3r](https://github.com/aried3r))
|
22
|
+
- Resolves Rails 7 Time.now.to\_s deprecation warning [\#630](https://github.com/rpush/rpush/pull/630) ([gregblake](https://github.com/gregblake))
|
23
|
+
- Adds Rails 7 Support [\#629](https://github.com/rpush/rpush/pull/629) ([gregblake](https://github.com/gregblake))
|
24
|
+
- Test with Rails 7.0.0.alpha2 [\#626](https://github.com/rpush/rpush/pull/626) ([aried3r](https://github.com/aried3r))
|
25
|
+
|
26
|
+
**Breaking:**
|
27
|
+
|
28
|
+
- Drop support for Ruby 2.3 [\#631](https://github.com/rpush/rpush/pull/631) ([aried3r](https://github.com/aried3r))
|
29
|
+
|
30
|
+
## [v6.0.1](https://github.com/rpush/rpush/tree/v6.0.1) (2021-10-08)
|
31
|
+
|
32
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v6.0.0...v6.0.1)
|
33
|
+
|
34
|
+
**Merged pull requests:**
|
35
|
+
|
36
|
+
- Don't limit webpush registration keys [\#624](https://github.com/rpush/rpush/pull/624) ([treyrich](https://github.com/treyrich))
|
37
|
+
- Add Prometheus Exporter plugin link to README [\#617](https://github.com/rpush/rpush/pull/617) ([maxsz](https://github.com/maxsz))
|
38
|
+
- Reference current interface in config template [\#569](https://github.com/rpush/rpush/pull/569) ([benlangfeld](https://github.com/benlangfeld))
|
39
|
+
- Default the Rails environment to RAILS\_ENV if set [\#562](https://github.com/rpush/rpush/pull/562) ([benlangfeld](https://github.com/benlangfeld))
|
6
40
|
|
7
41
|
## [v6.0.0](https://github.com/rpush/rpush/tree/v6.0.0) (2021-05-21)
|
8
42
|
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Rpush aims to be the *de facto* gem for sending push notifications in Ruby. Its
|
|
24
24
|
|
25
25
|
* Use [**ActiveRecord**](https://github.com/rpush/rpush/wiki/Using-ActiveRecord) or [**Redis**](https://github.com/rpush/rpush/wiki/Using-Redis) for storage.
|
26
26
|
* Plugins for [**Bugsnag**](https://github.com/rpush/rpush-plugin-bugsnag),
|
27
|
-
[**Sentry**](https://github.com/rpush/rpush-plugin-sentry), [**StatsD**](https://github.com/rpush/rpush-plugin-statsd)
|
27
|
+
[**Sentry**](https://github.com/rpush/rpush-plugin-sentry), [**StatsD**](https://github.com/rpush/rpush-plugin-statsd). Third party plugins: [**Prometheus Exporter**](https://github.com/equinux/rpush-plugin-prometheus-exporter). Or [write your own](https://github.com/rpush/rpush/wiki/Writing-a-Plugin).
|
28
28
|
* Seamless integration with your projects, including **Rails**.
|
29
29
|
* Run as a [daemon](https://github.com/rpush/rpush#as-a-daemon), inside a [job queue](https://github.com/rpush/rpush/wiki/Push-API), on the [command-line](https://github.com/rpush/rpush#on-the-command-line) or [embedded](https://github.com/rpush/rpush/wiki/Embedding-API) in another process.
|
30
30
|
* Scales vertically (threading) and horizontally (multiple processes).
|
@@ -46,10 +46,7 @@ Rpush.reflect do |on|
|
|
46
46
|
# Called when a notification is queued internally for delivery.
|
47
47
|
# The internal queue for each app runner can be inspected:
|
48
48
|
#
|
49
|
-
# Rpush::Daemon::AppRunner.
|
50
|
-
# runner.app
|
51
|
-
# runner.queue_size
|
52
|
-
# end
|
49
|
+
# Rpush::Daemon::AppRunner.status
|
53
50
|
#
|
54
51
|
# on.notification_enqueued do |notification|
|
55
52
|
# end
|
@@ -58,7 +58,11 @@ class Rpush200Updates < ActiveRecord::Migration[5.0]
|
|
58
58
|
|
59
59
|
def self.adapter_name
|
60
60
|
env = (defined?(Rails) && Rails.env) ? Rails.env : 'development'
|
61
|
-
|
61
|
+
if ActiveRecord::VERSION::MAJOR > 6
|
62
|
+
ActiveRecord::Base.configurations.configs_for(env_name: env).first.configuration_hash[:adapter]
|
63
|
+
else
|
64
|
+
Hash[ActiveRecord::Base.configurations[env].map { |k,v| [k.to_sym,v] }][:adapter]
|
65
|
+
end
|
62
66
|
end
|
63
67
|
|
64
68
|
def self.postgresql?
|
@@ -11,7 +11,7 @@ module Rpush
|
|
11
11
|
return if record.registration_ids.size > 1
|
12
12
|
reg = record.registration_ids.first
|
13
13
|
unless reg.is_a?(Hash) &&
|
14
|
-
reg.keys.
|
14
|
+
(KEYS-reg.keys).empty? &&
|
15
15
|
reg[:endpoint].is_a?(String) &&
|
16
16
|
reg[:keys].is_a?(Hash)
|
17
17
|
record.errors.add(:base, 'Registration must have :endpoint (String) and :keys (Hash) keys')
|
@@ -181,6 +181,17 @@ module Rpush
|
|
181
181
|
id
|
182
182
|
end
|
183
183
|
|
184
|
+
def adapter_name
|
185
|
+
env = (defined?(Rails) && Rails.env) ? Rails.env : 'development'
|
186
|
+
if ::ActiveRecord::VERSION::MAJOR > 6
|
187
|
+
::ActiveRecord::Base.configurations.configs_for(env_name: env).first.configuration_hash[:adapter]
|
188
|
+
else
|
189
|
+
config = ::ActiveRecord::Base.configurations[env]
|
190
|
+
return '' unless config
|
191
|
+
Hash[config.map { |k, v| [k.to_sym, v] }][:adapter]
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
184
195
|
private
|
185
196
|
|
186
197
|
def create_gcm_like_notification(notification, attrs, data, registration_ids, deliver_after, app) # rubocop:disable Metrics/ParameterLists
|
@@ -199,13 +210,6 @@ module Rpush
|
|
199
210
|
relation = Rpush::Client::ActiveRecord::Notification.where('processing = ? AND delivered = ? AND failed = ? AND (deliver_after IS NULL OR deliver_after < ?)', false, false, false, Time.now)
|
200
211
|
relation.order('deliver_after ASC, created_at ASC')
|
201
212
|
end
|
202
|
-
|
203
|
-
def adapter_name
|
204
|
-
env = (defined?(Rails) && Rails.env) ? Rails.env : 'development'
|
205
|
-
config = ::ActiveRecord::Base.configurations[env]
|
206
|
-
return '' unless config
|
207
|
-
Hash[config.map { |k, v| [k.to_sym, v] }][:adapter]
|
208
|
-
end
|
209
213
|
end
|
210
214
|
end
|
211
215
|
end
|
@@ -152,10 +152,10 @@ module Rpush
|
|
152
152
|
retryable_ns = Rpush::Client::Redis::Notification.absolute_retryable_namespace
|
153
153
|
|
154
154
|
Modis.with_connection do |redis|
|
155
|
-
retryable_results = redis.multi do
|
155
|
+
retryable_results = redis.multi do |transaction|
|
156
156
|
now = Time.now.to_i
|
157
|
-
|
158
|
-
|
157
|
+
transaction.zrangebyscore(retryable_ns, 0, now)
|
158
|
+
transaction.zremrangebyscore(retryable_ns, 0, now)
|
159
159
|
end
|
160
160
|
|
161
161
|
retryable_results.first
|
@@ -167,9 +167,9 @@ module Rpush
|
|
167
167
|
pending_ns = Rpush::Client::Redis::Notification.absolute_pending_namespace
|
168
168
|
|
169
169
|
Modis.with_connection do |redis|
|
170
|
-
pending_results = redis.multi do
|
171
|
-
|
172
|
-
|
170
|
+
pending_results = redis.multi do |transaction|
|
171
|
+
transaction.zrange(pending_ns, 0, limit)
|
172
|
+
transaction.zremrangebyrank(pending_ns, 0, limit)
|
173
173
|
end
|
174
174
|
|
175
175
|
pending_results.first
|
data/lib/rpush/logger.rb
CHANGED
@@ -69,7 +69,7 @@ module Rpush
|
|
69
69
|
msg = "#{msg.class.name}, #{msg.message}\n#{formatted_backtrace}"
|
70
70
|
end
|
71
71
|
|
72
|
-
formatted_msg = "[#{Time.now.
|
72
|
+
formatted_msg = "[#{Time.now.to_formatted_s(:db)}]"
|
73
73
|
formatted_msg << '[rpush] ' if Rpush.config.embedded
|
74
74
|
formatted_msg << "[#{prefix}] " if prefix
|
75
75
|
formatted_msg << msg
|
data/lib/rpush/version.rb
CHANGED
@@ -8,6 +8,7 @@ describe 'Webpush' do
|
|
8
8
|
|
9
9
|
let(:device_reg) {
|
10
10
|
{ endpoint: 'https://webpush-provider.example.org/push/some-id',
|
11
|
+
expirationTime: nil,
|
11
12
|
keys: {'auth' => 'DgN9EBia1o057BdhCOGURA', 'p256dh' => 'BAtxJ--7vHq9IVm8utUB3peJ4lpxRqk1rukCIkVJOomS83QkCnrQ4EyYQsSaCRgy_c8XPytgXxuyAvRJdnTPK4A'} }
|
12
13
|
}
|
13
14
|
let(:notification) { Rpush::Webpush::Notification.create!(app: app, registration_ids: [device_reg], data: { message: 'test' }) }
|
@@ -66,4 +66,11 @@ describe Rpush::Daemon::Store::ActiveRecord do
|
|
66
66
|
expect(store.deliverable_notifications(Rpush.config.batch_size)).to be_empty
|
67
67
|
end
|
68
68
|
end
|
69
|
+
|
70
|
+
describe "#adapter_name" do
|
71
|
+
it "should return the adapter name" do
|
72
|
+
adapter = ENV["ADAPTER"] || "postgresql"
|
73
|
+
expect(store.adapter_name).to eq(adapter)
|
74
|
+
end
|
75
|
+
end
|
69
76
|
end if active_record?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Leitch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -292,16 +292,16 @@ dependencies:
|
|
292
292
|
name: rubocop
|
293
293
|
requirement: !ruby/object:Gem::Requirement
|
294
294
|
requirements:
|
295
|
-
- - "
|
295
|
+
- - "~>"
|
296
296
|
- !ruby/object:Gem::Version
|
297
|
-
version:
|
297
|
+
version: 1.12.0
|
298
298
|
type: :development
|
299
299
|
prerelease: false
|
300
300
|
version_requirements: !ruby/object:Gem::Requirement
|
301
301
|
requirements:
|
302
|
-
- - "
|
302
|
+
- - "~>"
|
303
303
|
- !ruby/object:Gem::Version
|
304
|
-
version:
|
304
|
+
version: 1.12.0
|
305
305
|
- !ruby/object:Gem::Dependency
|
306
306
|
name: rubocop-performance
|
307
307
|
requirement: !ruby/object:Gem::Requirement
|
@@ -693,6 +693,7 @@ metadata:
|
|
693
693
|
bug_tracker_uri: https://github.com/rpush/rpush/issues
|
694
694
|
changelog_uri: https://github.com/rpush/rpush/blob/master/CHANGELOG.md
|
695
695
|
source_code_uri: https://github.com/rpush/rpush
|
696
|
+
rubygems_mfa_required: 'true'
|
696
697
|
post_install_message: |
|
697
698
|
When upgrading Rpush, don't forget to run `bundle exec rpush init` to get all the latest migrations.
|
698
699
|
|
@@ -705,14 +706,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
705
706
|
requirements:
|
706
707
|
- - ">="
|
707
708
|
- !ruby/object:Gem::Version
|
708
|
-
version: 2.
|
709
|
+
version: 2.4.0
|
709
710
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
710
711
|
requirements:
|
711
712
|
- - ">="
|
712
713
|
- !ruby/object:Gem::Version
|
713
714
|
version: '0'
|
714
715
|
requirements: []
|
715
|
-
rubygems_version: 3.
|
716
|
+
rubygems_version: 3.3.5
|
716
717
|
signing_key:
|
717
718
|
specification_version: 4
|
718
719
|
summary: The push notification service for Ruby.
|