Permalink
Browse files

Rename remote_key to cameraId

  • Loading branch information...
1 parent 5c2e167 commit aeb5f47c87ad800a72ca8454d39bfcf1971c93e4 @jpkorhonen jpkorhonen committed Jul 27, 2012
Showing with 28 additions and 27 deletions.
  1. +20 −20 client/frontpage.coffee
  2. +2 −2 views/index.jade
  3. +6 −5 whiteboard.coffee
View
@@ -5,7 +5,7 @@ socket = io.connect().of("/remote-start")
socket.on "open-browser", (opts) ->
window.open server + opts.url
-currentRemoteKey = ""
+currentCameraId = ""
$ ->
blank_camera_id = "Camera id can't be blank"
@@ -27,45 +27,45 @@ $ ->
$(this).click()
$(".startProjector input[type=submit]").click ->
- newRemoteKey = $('.startProjector [name=remoteKey]').val()
- if newRemoteKey is ""
+ newCameraId = $('.startProjector [name=cameraId]').val()
+ if newCameraId is ""
$('.error').text(blank_camera_id)
return false
e = $('.projectorInfo')
e.css 'top', $(this).position().top + $(this).height() - e.height()
- $('.projectorInfo input[name=remoteKey]').val(newRemoteKey)
- $('.cameraId').text(newRemoteKey)
+ $('.projectorInfo input[name=cameraId]').val(newCameraId)
+ $('.cameraId').text(newCameraId)
e.show()
$('.pageOverlay').show()
- startListening newRemoteKey
+ startListening newCameraId
false
$(".projectorInfo input[type=submit]").click ->
- newRemoteKey = $('.projectorInfo input[name=remoteKey]').val()
- if newRemoteKey is ""
+ newCameraId = $('.projectorInfo input[name=cameraId]').val()
+ if newCameraId is ""
$('.error').text(blank_camera_id)
return false
- $('.cameraId').text(newRemoteKey)
- startListening newRemoteKey
+ $('.cameraId').text(newCameraId)
+ startListening newCameraId
false
$(".projectorInfo a.close").click ->
- if currentRemoteKey isnt ""
- socket.emit "leave-desktop", { remote_key: currentRemoteKey }
- currentRemoteKey = ""
- $('.startProjector [name=remoteKey]').val("")
+ if currentCameraId isnt ""
+ socket.emit "leave-desktop", { cameraId: currentCameraId }
+ currentCameraId = ""
+ $('.startProjector [name=cameraId]').val("")
$('.projectorInfo').hide(500)
$('.pageOverlay').hide()
false
-
-startListening = (newRemoteKey) ->
+
+startListening = (newCameraId) ->
$('.error').text("")
- if currentRemoteKey isnt ""
- socket.emit "leave-desktop", { remote_key: currentRemoteKey }
- socket.emit "join-desktop", { remote_key: newRemoteKey }
+ if currentCameraId isnt ""
+ socket.emit "leave-desktop", { cameraId: currentCameraId }
+ socket.emit "join-desktop", { cameraId: newCameraId }
# Set client resolution
socket.emit "set resolution",
width: $(window).width(),
height: $(window).height()
- currentRemoteKey = newRemoteKey
+ currentCameraId = newCameraId
View
@@ -28,7 +28,7 @@ html(lang="en")
h2 Walma Projector
span Camera id
div(class="error")
- input.remoteKey(type="text", name="remoteKey")
+ input.cameraId(type="text", name="cameraId")
input(type="submit", value="Start projector")
.projectorInfo
@@ -49,7 +49,7 @@ html(lang="en")
form
span Camera id
- input.remoteKey(type="text", name="remoteKey")
+ input.cameraId(type="text", name="cameraId")
input(type="submit", value="Change camera id")
span(class="error")
View
@@ -137,6 +137,7 @@ app.get "/multipart", (req, res) ->
"""
app.post "/api/create_multipart", (req, res) ->
+ cameraId = req.body.cameraId or req.body.remote_key
generateUniqueName "screenshot"
, (prefix, num) ->
"#{ prefix }-#{ num }"
@@ -148,7 +149,7 @@ app.post "/api/create_multipart", (req, res) ->
heights = []
# Find clients minium resolutions
- for client in desktopSockets.clients(req.body.remote_key)
+ for client in desktopSockets.clients(cameraId)
client.get "resolution", (err, resolution) ->
widths.push resolution.width
heights.push resolution.height
@@ -167,8 +168,8 @@ app.post "/api/create_multipart", (req, res) ->
console.info "Failed to remove", req.files.image, err
return res.send err.message if err
- console.log "Send open-browser message: ", req.body.remote_key
- desktopSockets.in(req.body.remote_key).emit("open-browser", { url: "/#{ roomName }" })
+ console.log "Send open-browser message: ", cameraId
+ desktopSockets.in(cameraId).emit("open-browser", { url: "/#{ roomName }" })
res.json url: "/#{ roomName }"
app.post "/api/create", (req, res) ->
@@ -254,10 +255,10 @@ desktopSockets = io.of "/remote-start"
desktopSockets.on "connection", (socket) ->
socket.on "join-desktop", (opts) ->
console.log "Joining: ", opts
- socket.join opts.remote_key
+ socket.join opts.cameraId
socket.on "leave-desktop", (opts) ->
console.log "Leaving: ", opts
- socket.leave opts.remote_key
+ socket.leave opts.cameraId
socket.on 'set resolution', (resolution) ->
socket.set 'resolution', resolution, ->

0 comments on commit aeb5f47

Please sign in to comment.