diff --git a/proxy/Cakefile b/proxy/Cakefile index 499de94..fa37ce1 100644 --- a/proxy/Cakefile +++ b/proxy/Cakefile @@ -33,6 +33,12 @@ task 'test', 'snowflake unit tests', -> throw err if err console.log stdout + stderr +# task 'build:embed', 'build the snowflake badge', -> + # exec 'mkdir -p build' + # concatCoffeeFiles() + # copyStaticFiles() + # compileCoffee() + task 'build', 'build the snowflake proxy', -> exec 'mkdir -p build' concatCoffeeFiles() diff --git a/proxy/proxypair.coffee b/proxy/proxypair.coffee index ca9dcca..ac65ac5 100644 --- a/proxy/proxypair.coffee +++ b/proxy/proxypair.coffee @@ -59,7 +59,7 @@ class ProxyPair channel.onopen = => log 'Data channel opened!' snowflake.state = MODE.WEBRTC_READY - $msglog.className = 'active'; + $msglog.className = 'active' if $msglog # This is the point when the WebRTC datachannel is done, so the next step # is to establish websocket to the server. @connectRelay() @@ -67,7 +67,7 @@ class ProxyPair log 'Data channel closed.' Status.set 'disconnected.' snowflake.state = MODE.INIT - $msglog.className = '' + $msglog.className = '' if $msglog # Change this for multiplexing. snowflake.reset() channel.onerror = -> log 'Data channel error!' diff --git a/proxy/snowflake.coffee b/proxy/snowflake.coffee index 99a9698..b59c35a 100644 --- a/proxy/snowflake.coffee +++ b/proxy/snowflake.coffee @@ -232,19 +232,22 @@ log = (msg) -> # Log to the message window. # Status bar Status = - set: (msg) -> $status.innerHTML = 'Status: ' + msg + set: (msg) -> + $status.innerHTML = 'Status: ' + msg if $status init = -> - $status = document.getElementById('status') - $msglog = document.getElementById('msglog') - $msglog.value = '' + $badge = document.getElementById('badge') + if !badge + $status = document.getElementById('status') + $msglog = document.getElementById('msglog') + $msglog.value = '' - $send = document.getElementById('send') - $send.onclick = Interface.acceptInput + $send = document.getElementById('send') + $send.onclick = Interface.acceptInput - $input = document.getElementById('input') - $input.focus() - $input.onkeydown = (e) -> $send.onclick() if 13 == e.keyCode # enter + $input = document.getElementById('input') + $input.focus() + $input.onkeydown = (e) -> $send.onclick() if 13 == e.keyCode # enter log '== snowflake browser proxy ==' log 'Copy-Paste mode detected.' if COPY_PASTE_ENABLED diff --git a/proxy/static/embed.html b/proxy/static/embed.html new file mode 100644 index 0000000..ae361c6 --- /dev/null +++ b/proxy/static/embed.html @@ -0,0 +1,35 @@ + + + + + + + + +
+ Snowflake +
+ +