rhoconnect 5.5.2 → 5.5.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +21 -21
- data/generators/templates/application/settings/settings.yml +22 -0
- data/lib/rhoconnect/client.rb +4 -2
- data/lib/rhoconnect/handler/changes/runner.rb +6 -2
- data/lib/rhoconnect/handler/query/runner.rb +9 -0
- data/lib/rhoconnect/jobs/ping_job.rb +20 -9
- data/lib/rhoconnect/ping/apple.rb +25 -3
- data/lib/rhoconnect/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d484d1d18fc5144f01d9937aab6ac89c86be634
|
4
|
+
data.tar.gz: 1ed1e8dd2989c38dc0d5d375f867852881f0bbf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba4e48ade45d65a1369b922f4479d457ea334a886bb8b103f0d85f7e03287bff47abec9064d8127b95f74c01dbbc2513c3a3bac1ebea575184f65320ed153fa9
|
7
|
+
data.tar.gz: 89a00cc6df102e2ab6cb88a24f000b2ee2428bb8f5fe915605e20676c2a17143f4d2423393186036e2130397f59d1397a19dbcdc53c444cf730e01b526cb0839
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rhoconnect (5.5.
|
4
|
+
rhoconnect (5.5.15)
|
5
5
|
bundler (~> 1.0)
|
6
6
|
connection_pool (~> 1.2.0)
|
7
7
|
json (~> 1.8)
|
@@ -29,22 +29,22 @@ GEM
|
|
29
29
|
mime-types
|
30
30
|
xml-simple
|
31
31
|
backports (3.6.8)
|
32
|
-
builder (3.2.
|
32
|
+
builder (3.2.3)
|
33
33
|
cabin (0.9.0)
|
34
|
-
childprocess (0.
|
34
|
+
childprocess (0.6.2)
|
35
35
|
ffi (~> 1.0, >= 1.0.11)
|
36
36
|
clamp (1.0.1)
|
37
37
|
connection_pool (1.2.0)
|
38
38
|
crack (0.4.3)
|
39
39
|
safe_yaml (~> 1.0.0)
|
40
40
|
daemons (1.2.4)
|
41
|
-
diff-lcs (1.
|
41
|
+
diff-lcs (1.3)
|
42
42
|
docile (1.1.5)
|
43
|
-
dotenv (2.
|
43
|
+
dotenv (2.2.0)
|
44
44
|
eventmachine (1.0.9.1)
|
45
45
|
excon (0.22.1)
|
46
46
|
ffaker (1.14.0)
|
47
|
-
ffi (1.9.
|
47
|
+
ffi (1.9.18)
|
48
48
|
fog (1.11.1)
|
49
49
|
builder
|
50
50
|
excon (~> 0.20)
|
@@ -56,8 +56,8 @@ GEM
|
|
56
56
|
nokogiri (~> 1.5.0)
|
57
57
|
ruby-hmac
|
58
58
|
formatador (0.2.5)
|
59
|
-
fpm (1.
|
60
|
-
archive-tar-minitar
|
59
|
+
fpm (1.8.1)
|
60
|
+
archive-tar-minitar (= 0.5.2)
|
61
61
|
arr-pm (~> 0.0.10)
|
62
62
|
backports (>= 2.6.2)
|
63
63
|
cabin (>= 0.6.0)
|
@@ -69,23 +69,23 @@ GEM
|
|
69
69
|
ruby-xz
|
70
70
|
insist (1.0.0)
|
71
71
|
io-like (0.3.0)
|
72
|
-
json (1.8.
|
72
|
+
json (1.8.6)
|
73
73
|
mime-types (1.25.1)
|
74
74
|
mono_logger (1.1.0)
|
75
75
|
multi_json (1.12.1)
|
76
76
|
mustache (0.99.8)
|
77
77
|
net-scp (1.2.1)
|
78
78
|
net-ssh (>= 2.6.5)
|
79
|
-
net-ssh (
|
79
|
+
net-ssh (4.1.0)
|
80
80
|
nokogiri (1.5.11)
|
81
|
-
pleaserun (0.0.
|
81
|
+
pleaserun (0.0.28)
|
82
82
|
cabin (> 0)
|
83
83
|
clamp
|
84
84
|
dotenv
|
85
85
|
insist
|
86
86
|
mustache (= 0.99.8)
|
87
87
|
stud
|
88
|
-
public_suffix (2.0.
|
88
|
+
public_suffix (2.0.5)
|
89
89
|
rack (1.5.5)
|
90
90
|
rack-fiber_pool (0.9.3)
|
91
91
|
rack-protection (1.5.3)
|
@@ -93,10 +93,10 @@ GEM
|
|
93
93
|
rack-test (0.6.3)
|
94
94
|
rack (>= 1.0)
|
95
95
|
rake (10.4.2)
|
96
|
-
redis (3.3.
|
97
|
-
redis-namespace (1.5.
|
96
|
+
redis (3.3.3)
|
97
|
+
redis-namespace (1.5.3)
|
98
98
|
redis (~> 3.0, >= 3.0.4)
|
99
|
-
resque (1.
|
99
|
+
resque (1.27.2)
|
100
100
|
mono_logger (~> 1.0)
|
101
101
|
multi_json (~> 1.0)
|
102
102
|
redis-namespace (~> 1.3)
|
@@ -116,27 +116,27 @@ GEM
|
|
116
116
|
ruby-xz (0.2.3)
|
117
117
|
ffi (~> 1.9)
|
118
118
|
io-like (~> 0.3)
|
119
|
-
rubyzip (1.2.
|
119
|
+
rubyzip (1.2.1)
|
120
120
|
safe_yaml (1.0.4)
|
121
|
-
simplecov (0.
|
121
|
+
simplecov (0.13.0)
|
122
122
|
docile (~> 1.1.0)
|
123
123
|
json (>= 1.8, < 3)
|
124
124
|
simplecov-html (~> 0.10.0)
|
125
125
|
simplecov-html (0.10.0)
|
126
126
|
simplecov-rcov (0.2.3)
|
127
127
|
simplecov (>= 0.4.1)
|
128
|
-
sinatra (1.4.
|
128
|
+
sinatra (1.4.8)
|
129
129
|
rack (~> 1.5)
|
130
130
|
rack-protection (~> 1.4)
|
131
131
|
tilt (>= 1.3, < 3)
|
132
|
-
sqlite3 (1.3.
|
132
|
+
sqlite3 (1.3.13)
|
133
133
|
stud (0.0.22)
|
134
134
|
thin (1.7.0)
|
135
135
|
daemons (~> 1.0, >= 1.0.9)
|
136
136
|
eventmachine (~> 1.0, >= 1.0.4)
|
137
137
|
rack (>= 1, < 3)
|
138
138
|
thor (0.18.1)
|
139
|
-
tilt (2.0.
|
139
|
+
tilt (2.0.6)
|
140
140
|
vegas (0.1.11)
|
141
141
|
rack (>= 1.0.0)
|
142
142
|
webmock (1.9.3)
|
@@ -173,4 +173,4 @@ DEPENDENCIES
|
|
173
173
|
win32-process
|
174
174
|
|
175
175
|
BUNDLED WITH
|
176
|
-
1.
|
176
|
+
1.14.6
|
@@ -1,6 +1,28 @@
|
|
1
1
|
:sources:
|
2
2
|
|
3
3
|
:development:
|
4
|
+
:iphoneserver: gateway.sandbox.push.apple.com
|
5
|
+
:iphoneport: 2195
|
6
|
+
## Note: example how define Apple push certificate
|
7
|
+
#:iphonecertfile: settings/aps_development_myapp.pem
|
8
|
+
#:iphonepassphrase: store01
|
9
|
+
## Note: example how define set of Apple certificates when differnet applications use the same RhoConnect server
|
10
|
+
## In this case each application should be define "rho_app_id" in build.yml
|
11
|
+
## This is example how define two Apple's certificates for two applications with
|
12
|
+
## first application rho_app_id = com.tautechnologies.store01
|
13
|
+
## second application rho_app_id = com.tautechnologies.store02
|
14
|
+
## you should define rho_app_id without ":" -> "com.tautechnologies.store01" not ":com.tautechnologies.store01"
|
15
|
+
## if application do not has rho_app_id or you do not defined :iphonecertificates then
|
16
|
+
## :iphonecertfile and :iphonepassphrase from root of settings will be used
|
17
|
+
## for prepare *.pem firstly prepare *.p12 in "Keychain Access" application then use this command for convert to *.pem :
|
18
|
+
## openssl pkcs12 -in mycert.p12 -out mycert.pem -nodes -clcerts
|
19
|
+
#:iphonecertificates:
|
20
|
+
# com.tautechnologies.store01:
|
21
|
+
# :iphonecertfile: settings/aps_development_store01.pem
|
22
|
+
# :iphonepassphrase: store01
|
23
|
+
# com.tautechnologies.store02:
|
24
|
+
# :iphonecertfile: settings/aps_development_store02.pem
|
25
|
+
# :iphonepassphrase: store02
|
4
26
|
:redis: localhost:6379
|
5
27
|
:syncserver: http://localhost:9292
|
6
28
|
:push_server: http://someappname@localhost:8675/
|
data/lib/rhoconnect/client.rb
CHANGED
@@ -6,6 +6,8 @@ module Rhoconnect
|
|
6
6
|
field :device_push_type, :string
|
7
7
|
field :device_pin, :string
|
8
8
|
field :device_port, :string
|
9
|
+
field :device_app_id, :string
|
10
|
+
field :device_app_version, :string
|
9
11
|
field :phone_id, :string
|
10
12
|
field :user_id, :string
|
11
13
|
field :last_sync, :datetime
|
@@ -130,7 +132,7 @@ module Rhoconnect
|
|
130
132
|
end
|
131
133
|
|
132
134
|
def update_fields(params)
|
133
|
-
[:device_type, :device_push_type,:device_pin,:device_port,:phone_id].each do |setting|
|
135
|
+
[:device_type, :device_push_type,:device_pin,:device_port,:phone_id, :device_app_id, :device_app_version].each do |setting|
|
134
136
|
self.send "#{setting}=".to_sym, params[setting].to_s if params[setting]
|
135
137
|
end
|
136
138
|
end
|
@@ -141,4 +143,4 @@ module Rhoconnect
|
|
141
143
|
raise ArgumentError.new('Missing required attribute source_name') unless params[:source_name]
|
142
144
|
end
|
143
145
|
end
|
144
|
-
end
|
146
|
+
end
|
@@ -45,13 +45,17 @@ module Rhoconnect
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def _process_blobs(params)
|
48
|
+
#puts "$$$ runner:_process_blobs params = [#{params}]"
|
48
49
|
unless params[:blob_fields].nil?
|
49
50
|
[:create,:update].each do |utype|
|
50
51
|
objects = params[utype] || {}
|
51
52
|
objects.each do |id,obj|
|
52
53
|
params[:blob_fields].each do |field|
|
53
54
|
blob = params["#{field}-#{id}"]
|
54
|
-
|
55
|
+
if blob != nil
|
56
|
+
# skip unchanged fields (some items can not have changed blob property - only non-blob or another blob etc.)
|
57
|
+
obj[field] = @model.store_blob(obj,field,blob)
|
58
|
+
end
|
55
59
|
end
|
56
60
|
end
|
57
61
|
end
|
@@ -60,4 +64,4 @@ module Rhoconnect
|
|
60
64
|
end
|
61
65
|
end
|
62
66
|
end
|
63
|
-
end
|
67
|
+
end
|
@@ -60,6 +60,15 @@ module Rhoconnect
|
|
60
60
|
@client.flush_data(:delete_page)
|
61
61
|
_delete_errors_page
|
62
62
|
return true
|
63
|
+
else
|
64
|
+
if token == nil
|
65
|
+
# client lost state - may be previous connection was failed etc.
|
66
|
+
# we ned reinit connection
|
67
|
+
puts "$$$ ERROR: receive NIL token => reset saved session connection. client["+@client.to_s+"] stored token["+stored_token.to_s+"]"
|
68
|
+
@client.put_value(:page_token,nil)
|
69
|
+
_delete_errors_page
|
70
|
+
return true
|
71
|
+
end
|
63
72
|
end
|
64
73
|
else
|
65
74
|
return true
|
@@ -32,18 +32,29 @@ module Rhoconnect
|
|
32
32
|
user = User.load(user_id)
|
33
33
|
clients = user.clients if user
|
34
34
|
if clients
|
35
|
+
client_objects = []
|
35
36
|
clients.members.each do |client_id|
|
36
|
-
|
37
|
+
client_obj = Client.load(client_id,{:source_name => '*'})
|
38
|
+
client_objects << client_obj
|
39
|
+
end
|
40
|
+
sorted_clients = client_objects.sort! { |a,b| a.last_sync <=> b.last_sync }
|
41
|
+
sorted_clients.reverse_each do |client|
|
37
42
|
params.merge!(
|
38
|
-
'device_port' => client.device_port,
|
39
|
-
'device_pin' => client.device_pin,
|
40
|
-
'phone_id' => client.phone_id
|
43
|
+
'device_port' => client.device_port,
|
44
|
+
'device_pin' => client.device_pin,
|
45
|
+
'phone_id' => client.phone_id,
|
46
|
+
'device_app_id' => client.device_app_id,
|
47
|
+
'device_app_version' => client.device_app_version
|
41
48
|
)
|
42
49
|
send_push = false
|
43
50
|
if client.device_type and client.device_type.size > 0
|
44
51
|
if client.phone_id and client.phone_id.size > 0
|
45
|
-
|
46
|
-
|
52
|
+
combined_phone_id = client.phone_id
|
53
|
+
if client.device_app_id and client.device_app_id.size > 0
|
54
|
+
combined_phone_id = combined_phone_id + client.device_app_id
|
55
|
+
end
|
56
|
+
unless phone_ids.include? combined_phone_id
|
57
|
+
phone_ids << combined_phone_id
|
47
58
|
send_push = true
|
48
59
|
end
|
49
60
|
elsif client.device_pin and client.device_pin.size > 0
|
@@ -52,7 +63,7 @@ module Rhoconnect
|
|
52
63
|
send_push = true
|
53
64
|
end
|
54
65
|
else
|
55
|
-
log "Skipping ping for non-registered client_id '#{
|
66
|
+
log "Skipping ping for non-registered client_id '#{client.rho__id.to_s}'..."
|
56
67
|
next
|
57
68
|
end
|
58
69
|
if send_push
|
@@ -72,10 +83,10 @@ module Rhoconnect
|
|
72
83
|
end
|
73
84
|
end
|
74
85
|
else
|
75
|
-
log "Dropping ping request for client_id '#{
|
86
|
+
log "Dropping ping request for client_id '#{client.rho__id.to_s}' because it's already in user's device pin or phone_id list."
|
76
87
|
end
|
77
88
|
else
|
78
|
-
log "Skipping ping for non-registered client_id '#{
|
89
|
+
log "Skipping ping for non-registered client_id '#{client.rho__id.to_s}'..."
|
79
90
|
end
|
80
91
|
end
|
81
92
|
else
|
@@ -3,10 +3,32 @@ require 'openssl'
|
|
3
3
|
module Rhoconnect
|
4
4
|
class Apple
|
5
5
|
def self.ping(params)
|
6
|
+
#log '$$$ ping params = '+params.to_s
|
6
7
|
settings = get_config(Rhoconnect.base_directory)[Rhoconnect.environment]
|
7
|
-
|
8
|
+
#puts '$$$ settings = '+settings.to_s
|
9
|
+
cert_file = nil # File.join(Rhoconnect.base_directory,settings[:iphonecertfile])
|
10
|
+
passphrase = nil
|
11
|
+
device_app_id = params[:device_app_id]
|
12
|
+
if device_app_id != nil
|
13
|
+
if settings[:iphonecertificates] != nil
|
14
|
+
if settings[:iphonecertificates][device_app_id] != nil
|
15
|
+
cert_file = settings[:iphonecertificates][device_app_id][:iphonecertfile]
|
16
|
+
passphrase = settings[:iphonecertificates][device_app_id][:iphonepassphrase]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
if cert_file == nil
|
21
|
+
cert_file = settings[:iphonecertfile]
|
22
|
+
end
|
23
|
+
if passphrase == nil
|
24
|
+
passphrase = settings[:iphonepassphrase]
|
25
|
+
end
|
26
|
+
|
27
|
+
#puts '$$$ cert_file = '+cert_file.to_s
|
28
|
+
cert_file = File.join(Rhoconnect.base_directory,cert_file)
|
29
|
+
|
8
30
|
cert = File.read(cert_file) if File.exists?(cert_file)
|
9
|
-
|
31
|
+
|
10
32
|
host = settings[:iphoneserver]
|
11
33
|
port = settings[:iphoneport]
|
12
34
|
if(cert and host and port)
|
@@ -54,4 +76,4 @@ module Rhoconnect
|
|
54
76
|
super(params)
|
55
77
|
end
|
56
78
|
end
|
57
|
-
end
|
79
|
+
end
|
data/lib/rhoconnect/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhoconnect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.5.
|
4
|
+
version: 5.5.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rhomobile
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|