caboose-cms 0.4.74 → 0.4.75
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/caboose/version.rb +1 -1
- metadata +1 -2
- data/app/models/caboose/media_image_socket.rb +0 -73
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjUwNjcxN2I2ZDIzY2JiZDc2NGFmMGNmYjdkOTUzZmNjZGZhNTE2Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjBlY2ZiNWIzNjYxZmY0Zjc1ZTc4MTc5ZGMzOWZmMjUyODYyZjc4Nw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDQyNjQ3YWIyNDQ2NDQzNzI5NDE1Y2E4OTc5OTBkMTRlNWQ5MDQwZDQ2NTg3
|
10
|
+
ZDRkNDAzMmJiNDNjZDA3NzY0MjkxNWFjNDVlM2I1ZDA0OGE3NWExM2FiZTUz
|
11
|
+
MmU4YjRlZTAxZTA5YWUwNTU0Zjg0NjNiZjEzYTJkODAwMmE0Zjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzBlOWIzYjE5ODZjYmYzNzc2NmM4N2E3MzJlNmEwMDgyM2UwN2U2NGZkOTNm
|
14
|
+
OTBkYWI5MjFjZGVhZDMxMTE5OGNhNjI1NjY1ZTY5MWUzYTk0ODEyOTFmMjVj
|
15
|
+
MjU4ODBiNWI5ZGU1ZWU0Yzc0ZTRiZWUwYWZjYzU2Y2U5ZDNhNTk=
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.75
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
@@ -319,7 +319,6 @@ files:
|
|
319
319
|
- app/models/caboose/media_category.rb
|
320
320
|
- app/models/caboose/media_file.rb
|
321
321
|
- app/models/caboose/media_image.rb
|
322
|
-
- app/models/caboose/media_image_socket.rb
|
323
322
|
- app/models/caboose/menu_block.rb
|
324
323
|
- app/models/caboose/page.rb
|
325
324
|
- app/models/caboose/page_bar_generator.rb
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'faye/websocket'
|
2
|
-
|
3
|
-
module Caboose
|
4
|
-
class MediaImageSocket
|
5
|
-
|
6
|
-
KEEPALIVE_TIME = 15 # in seconds
|
7
|
-
|
8
|
-
def initialize(app)
|
9
|
-
@app = app
|
10
|
-
@clients = {}
|
11
|
-
@image_ids = {}
|
12
|
-
end
|
13
|
-
|
14
|
-
def call(env)
|
15
|
-
if Faye::WebSocket.websocket?(env)
|
16
|
-
|
17
|
-
uri = env['REQUEST_URI']
|
18
|
-
#Caboose.log(uri)
|
19
|
-
|
20
|
-
# GET /admin/images/:id/wait
|
21
|
-
if uri =~ /\/admin\/images\/\d*\/wait/
|
22
|
-
image_id = uri.gsub('/admin/images/', '').gsub('/wait', '').to_i
|
23
|
-
#Caboose.log("Waiting on image_id #{image_id}...")
|
24
|
-
ws = Faye::WebSocket.new(env, nil, { :ping => KEEPALIVE_TIME })
|
25
|
-
ws.on :open do |event|
|
26
|
-
Caboose.log("Opening browser web socket for image #{image_id}...")
|
27
|
-
@clients[image_id] = [] if @clients[image_id].nil?
|
28
|
-
@clients[image_id] << ws
|
29
|
-
end
|
30
|
-
ws.on :message do |event|
|
31
|
-
Caboose.log("Received browser message for image #{image_id}")
|
32
|
-
@clients[image_id].each { |client| client.send(event.data) }
|
33
|
-
end
|
34
|
-
ws.on :close do |event|
|
35
|
-
Caboose.log("Closing browser web socket for image #{image_id}...")
|
36
|
-
#p [:close, ws.object_id, event.code, event.reason]
|
37
|
-
@clients.delete(ws)
|
38
|
-
ws = nil
|
39
|
-
end
|
40
|
-
ws.rack_response
|
41
|
-
|
42
|
-
# GET /admin/images/:id/finished
|
43
|
-
elsif uri =~ /\/admin\/images\/\d*\/finished/
|
44
|
-
image_id = uri.gsub('/admin/images/', '').gsub('/finished', '').to_i
|
45
|
-
ws = Faye::WebSocket.new(env, nil, { :ping => KEEPALIVE_TIME })
|
46
|
-
ws.on :open do |event|
|
47
|
-
#p [:open, ws.object_id]
|
48
|
-
Caboose.log("Opening server web socket for image #{image_id}...")
|
49
|
-
@image_ids[ws.object_id] = image_id
|
50
|
-
end
|
51
|
-
ws.on :message do |event|
|
52
|
-
#p [:message, event.data]
|
53
|
-
Caboose.log("Receieved server message for image #{image_id}")
|
54
|
-
image_id = @image_ids[ws.object_id]
|
55
|
-
@clients[image_id].each { |client| client.send(event.data) }
|
56
|
-
end
|
57
|
-
ws.on :close do |event|
|
58
|
-
#p [:close, ws.object_id, event.code, event.reason]
|
59
|
-
Caboose.log("Closing server web socket for image #{image_id}...")
|
60
|
-
@image_ids.delete(ws.object_id)
|
61
|
-
ws = nil
|
62
|
-
end
|
63
|
-
ws.rack_response
|
64
|
-
end
|
65
|
-
|
66
|
-
else
|
67
|
-
@app.call(env)
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|