Skip to content

Commit

Permalink
Create a restricted ZeroFrame wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed Feb 21, 2018
1 parent 91e83b3 commit c438b9f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/Ui/media/WrapperZeroFrame.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class WrapperZeroFrame
constructor: (wrapper) ->
@wrapperCmd = wrapper.cmd
@wrapperResponse = wrapper.ws.response
console.log "WrapperZeroFrame", wrapper

cmd: (cmd, params={}, cb=null) =>
@wrapperCmd(cmd, params, cb)

response: (to, result) =>
@wrapperResponse(to, result)

isProxyRequest: ->
return window.location.pathname == "/"

certSelectGotoSite: (elem) =>
href = $(elem).attr("href")
if @isProxyRequest() # Fix for proxy request
$(elem).attr("href", "http://zero#{href}")


window.zeroframe = new WrapperZeroFrame(window.wrapper)
2 changes: 1 addition & 1 deletion src/Ui/media/lib/ZeroWebsocket.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ZeroWebsocket
@log "Unknown command", message


response: (to, result) ->
response: (to, result) =>
@send {"cmd": "response", "to": to, "result": result}


Expand Down

0 comments on commit c438b9f

Please sign in to comment.