rpush 3.3.0 → 3.3.1
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/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/lib/generators/rpush_migration_generator.rb +1 -0
- data/lib/generators/templates/rpush_3_3_1_updates.rb +11 -0
- data/lib/rpush/client/active_model/apns/device_token_format_validator.rb +1 -1
- data/lib/rpush/version.rb +1 -1
- data/spec/functional/apns2_spec.rb +1 -1
- data/spec/functional/apns_spec.rb +1 -1
- data/spec/functional/embed_spec.rb +1 -1
- data/spec/functional/new_app_spec.rb +1 -1
- data/spec/support/active_record_setup.rb +3 -1
- data/spec/unit/client/active_record/apns/notification_spec.rb +6 -6
- data/spec/unit/daemon/feeder_spec.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3abc70a76bc7de39565ab73f4eef2b2466ff4dec4fe20ef57e10a9c4e6ff41f3
|
4
|
+
data.tar.gz: 42eb70527bd235e7c30b1dab4413d9368f68c129254704bb5af7698cb8cd6c68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19b1eeb3bb0e71dd11cd26af20efdb610cdda31c720293578e57d19b82c406841fe33f8aa63d6e4dd5ecff8e18bbcc5a760159259cc78c37aa093a29a70d059a
|
7
|
+
data.tar.gz: 75a2fc1eb17241bbaa7fcf3577ef6ba27ac5701f3e4a5396b08f099097b9a686aae9b465c954272871ee33c6c65d4142b4183c5bb17f60e731a1f70e5328c97e
|
data/CHANGELOG.md
CHANGED
@@ -12,6 +12,14 @@
|
|
12
12
|
|
13
13
|
- None
|
14
14
|
|
15
|
+
## 3.3.1 (2018-11-14)
|
16
|
+
|
17
|
+
When upgrading, don't forget to run `bundle exec rpush init` to get all the latest migrations.
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
|
21
|
+
- Remove validation of 64-characters length from `device_token`. [#463](https://github.com/rpush/rpush/pull/463) (by [@chrisokamoto](https://github.com/chrisokamoto)).
|
22
|
+
|
15
23
|
## 3.3.0 (2018-11-14)
|
16
24
|
|
17
25
|
When upgrading, don't forget to run `bundle exec rpush init` to get all the latest migrations.
|
data/README.md
CHANGED
@@ -68,7 +68,7 @@ app.save!
|
|
68
68
|
```ruby
|
69
69
|
n = Rpush::Apns::Notification.new
|
70
70
|
n.app = Rpush::Apns::App.find_by_name("ios_app")
|
71
|
-
n.device_token = "..." #
|
71
|
+
n.device_token = "..." # hex string
|
72
72
|
n.alert = "hi mom!"
|
73
73
|
n.data = { foo: :bar }
|
74
74
|
n.save!
|
@@ -97,7 +97,7 @@ app.save!
|
|
97
97
|
```ruby
|
98
98
|
n = Rpush::Apns::Notification.new
|
99
99
|
n.app = Rpush::Apnsp8::App.find_by_name("ios_app")
|
100
|
-
n.device_token = "..." #
|
100
|
+
n.device_token = "..." # hex string
|
101
101
|
n.alert = "hi mom!"
|
102
102
|
n.data = { foo: :bar }
|
103
103
|
n.save!
|
@@ -49,6 +49,7 @@ class RpushMigrationGenerator < Rails::Generators::Base
|
|
49
49
|
add_rpush_migration('rpush_3_2_0_add_apns_p8')
|
50
50
|
add_rpush_migration('rpush_3_2_4_updates')
|
51
51
|
add_rpush_migration('rpush_3_3_0_updates')
|
52
|
+
add_rpush_migration('rpush_3_3_1_updates')
|
52
53
|
end
|
53
54
|
|
54
55
|
protected
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Rpush331Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
change_column :rpush_notifications, :device_token, :string, null: true
|
4
|
+
change_column :rpush_feedback, :device_token, :string, null: true
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
change_column :rpush_notifications, :device_token, :string, { null: true, limit: 64 }
|
9
|
+
change_column :rpush_feedback, :device_token, :string, { null: true, limit: 64 }
|
10
|
+
end
|
11
|
+
end
|
@@ -4,7 +4,7 @@ module Rpush
|
|
4
4
|
module Apns
|
5
5
|
class DeviceTokenFormatValidator < ::ActiveModel::Validator
|
6
6
|
def validate(record)
|
7
|
-
return if record.device_token =~ /^[a-z0-9]
|
7
|
+
return if record.device_token =~ /^[a-z0-9]\w+$/i
|
8
8
|
record.errors[:device_token] << "is invalid"
|
9
9
|
end
|
10
10
|
end
|
data/lib/rpush/version.rb
CHANGED
@@ -24,7 +24,7 @@ describe 'New app loading' do
|
|
24
24
|
notification = Rpush::Apns::Notification.new
|
25
25
|
notification.app = app
|
26
26
|
notification.alert = 'test'
|
27
|
-
notification.device_token = 'a' *
|
27
|
+
notification.device_token = 'a' * 108
|
28
28
|
notification.save!
|
29
29
|
notification
|
30
30
|
end
|
@@ -38,6 +38,7 @@ require 'generators/templates/rpush_3_1_1_updates'
|
|
38
38
|
require 'generators/templates/rpush_3_2_0_add_apns_p8'
|
39
39
|
require 'generators/templates/rpush_3_2_4_updates'
|
40
40
|
require 'generators/templates/rpush_3_3_0_updates'
|
41
|
+
require 'generators/templates/rpush_3_3_1_updates'
|
41
42
|
|
42
43
|
migrations = [
|
43
44
|
AddRpush,
|
@@ -51,7 +52,8 @@ migrations = [
|
|
51
52
|
Rpush311Updates,
|
52
53
|
Rpush320AddApnsP8,
|
53
54
|
Rpush324Updates,
|
54
|
-
Rpush330Updates
|
55
|
+
Rpush330Updates,
|
56
|
+
Rpush331Updates
|
55
57
|
]
|
56
58
|
|
57
59
|
unless ENV['TRAVIS']
|
@@ -17,7 +17,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should validate the length of the binary conversion of the notification" do
|
20
|
-
notification.device_token = "a" *
|
20
|
+
notification.device_token = "a" * 108
|
21
21
|
notification.alert = "way too long!" * 200
|
22
22
|
expect(notification.valid?).to be_falsey
|
23
23
|
expect(notification.errors[:base].include?("APN notification cannot be larger than 2048 bytes. Try condensing your alert and device attributes.")).to be_truthy
|
@@ -25,7 +25,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification do
|
|
25
25
|
|
26
26
|
it "should store long alerts" do
|
27
27
|
notification.app = app
|
28
|
-
notification.device_token = "a" *
|
28
|
+
notification.device_token = "a" * 108
|
29
29
|
notification.alert = "*" * 300
|
30
30
|
expect(notification.valid?).to be_truthy
|
31
31
|
|
@@ -110,7 +110,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'MDM' do
|
|
110
110
|
let(:notification) { Rpush::Client::ActiveRecord::Apns::Notification.new }
|
111
111
|
|
112
112
|
before do
|
113
|
-
notification.device_token = "a" *
|
113
|
+
notification.device_token = "a" * 108
|
114
114
|
notification.id = 1234
|
115
115
|
end
|
116
116
|
|
@@ -225,7 +225,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'to_binary' do
|
|
225
225
|
let(:notification) { Rpush::Client::ActiveRecord::Apns::Notification.new }
|
226
226
|
|
227
227
|
before do
|
228
|
-
notification.device_token = "a" *
|
228
|
+
notification.device_token = "a" * 108
|
229
229
|
notification.id = 1234
|
230
230
|
end
|
231
231
|
|
@@ -259,7 +259,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'to_binary' do
|
|
259
259
|
notification.app = Rpush::Client::ActiveRecord::Apns::App.new(name: 'my_app', environment: 'development', certificate: TEST_CERT)
|
260
260
|
now = Time.now
|
261
261
|
allow(Time).to receive_messages(now: now)
|
262
|
-
expect(notification.to_binary).to eq "\x02\x00\x00\x00\
|
262
|
+
expect(notification.to_binary).to eq "\x02\x00\x00\x00\xAF\x01\x00 \xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\x02\x00a{\"aps\":{\"alert\":\"Don't panic Mr Mainwaring, don't panic!\",\"badge\":3,\"sound\":\"1.aiff\"},\"hi\":\"mom\"}\x03\x00\x04\x00\x00\x04\xD2\x04\x00\x04#{[now.to_i + 86_400].pack('N')}\x05\x00\x01\n"
|
263
263
|
end
|
264
264
|
end if active_record?
|
265
265
|
|
@@ -281,7 +281,7 @@ end if active_record?
|
|
281
281
|
describe Rpush::Client::ActiveRecord::Apns::Notification, "bug #35" do
|
282
282
|
it "should limit payload size to 256 bytes but not the entire packet" do
|
283
283
|
notification = Rpush::Client::ActiveRecord::Apns::Notification.new do |n|
|
284
|
-
n.device_token = "a" *
|
284
|
+
n.device_token = "a" * 108
|
285
285
|
n.alert = "a" * 210
|
286
286
|
n.app = Rpush::Client::ActiveRecord::Apns::App.create!(name: 'my_app', environment: 'development', certificate: TEST_CERT)
|
287
287
|
end
|
@@ -2,7 +2,7 @@ require "unit_spec_helper"
|
|
2
2
|
|
3
3
|
describe Rpush::Daemon::Feeder do
|
4
4
|
let!(:app) { Rpush::Apns::App.create!(name: 'my_app', environment: 'development', certificate: TEST_CERT) }
|
5
|
-
let(:notification) { Rpush::Apns::Notification.create!(device_token: "a" *
|
5
|
+
let(:notification) { Rpush::Apns::Notification.create!(device_token: "a" * 108, app: app) }
|
6
6
|
let(:logger) { double }
|
7
7
|
let(:interruptible_sleeper) { double(sleep: nil, stop: nil) }
|
8
8
|
let(:store) { double(Rpush::Daemon::Store::ActiveRecord, deliverable_notifications: [notification], release_connection: nil) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Leitch
|
@@ -389,6 +389,7 @@ files:
|
|
389
389
|
- lib/generators/templates/rpush_3_2_0_add_apns_p8.rb
|
390
390
|
- lib/generators/templates/rpush_3_2_4_updates.rb
|
391
391
|
- lib/generators/templates/rpush_3_3_0_updates.rb
|
392
|
+
- lib/generators/templates/rpush_3_3_1_updates.rb
|
392
393
|
- lib/rpush.rb
|
393
394
|
- lib/rpush/apns_feedback.rb
|
394
395
|
- lib/rpush/cli.rb
|