Loading proxy/snowflake.coffee +9 −1 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ DEFAULT_RELAY = host: '192.81.135.242' port: 9902 COPY_PASTE_ENABLED = false COOKIE_NAME = "snowflake-allow"; silenceNotifications = false query = Query.parse(location) Loading Loading @@ -51,6 +52,7 @@ class Snowflake state: MODE.INIT retries: 0 # Prepare the Snowflake with a Broker (to find clients) and optional UI. constructor: (@broker, @ui) -> rateLimitBytes = undefined if 'off' != query['ratelimit'] Loading Loading @@ -204,6 +206,13 @@ log = (msg) -> dbg = (msg) -> log msg if DEBUG or snowflake.ui?.debug init = (isNode) -> cookies = Parse.cookie document.cookie # Do nothing if snowflake has not been opted in. if cookies[COOKIE_NAME] != "1" console.log 'Snowflake is not activate. Please click the badge to change options.'; return # Hook up to the debug UI if available. ui = if isNode then null else new UI() silenceNotifications = Params.getBool(query, 'silent', false) brokerUrl = Params.getString(query, 'broker', DEFAULT_BROKER) Loading @@ -219,7 +228,6 @@ init = (isNode) -> snowflake.beginWebRTC() # Notification of closing tab with active proxy. # TODO: Opt-in/out parameter or cookie window.onbeforeunload = -> if !silenceNotifications && MODE.WEBRTC_READY == snowflake.state return CONFIRMATION_MESSAGE Loading proxy/static/options.html +18 −3 Original line number Diff line number Diff line Loading @@ -77,6 +77,14 @@ <div id="snowflake-status"></div> </div> <div id='cookies-disabled' style='display:none'> <hr/> <p> Your browser has cookies disabled. You will need to enable them in order to set Snowflake preferences. </p> </div> <script> // Defaults to opt-in. Loading Loading @@ -120,9 +128,16 @@ function refreshStatus() { } } $buttons = document.getElementById('buttons'); $buttons.style = ''; window.onload = function() { if (navigator.cookieEnabled) { // Both JS and cookies enabled -- display normal buttons. document.getElementById('buttons').style = ''; } else { // Display the cookies disabled message if necessary. document.getElementById('cookies-disabled').style = ''; } refreshStatus(); } </script> </body> </html> Loading
proxy/snowflake.coffee +9 −1 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ DEFAULT_RELAY = host: '192.81.135.242' port: 9902 COPY_PASTE_ENABLED = false COOKIE_NAME = "snowflake-allow"; silenceNotifications = false query = Query.parse(location) Loading Loading @@ -51,6 +52,7 @@ class Snowflake state: MODE.INIT retries: 0 # Prepare the Snowflake with a Broker (to find clients) and optional UI. constructor: (@broker, @ui) -> rateLimitBytes = undefined if 'off' != query['ratelimit'] Loading Loading @@ -204,6 +206,13 @@ log = (msg) -> dbg = (msg) -> log msg if DEBUG or snowflake.ui?.debug init = (isNode) -> cookies = Parse.cookie document.cookie # Do nothing if snowflake has not been opted in. if cookies[COOKIE_NAME] != "1" console.log 'Snowflake is not activate. Please click the badge to change options.'; return # Hook up to the debug UI if available. ui = if isNode then null else new UI() silenceNotifications = Params.getBool(query, 'silent', false) brokerUrl = Params.getString(query, 'broker', DEFAULT_BROKER) Loading @@ -219,7 +228,6 @@ init = (isNode) -> snowflake.beginWebRTC() # Notification of closing tab with active proxy. # TODO: Opt-in/out parameter or cookie window.onbeforeunload = -> if !silenceNotifications && MODE.WEBRTC_READY == snowflake.state return CONFIRMATION_MESSAGE Loading
proxy/static/options.html +18 −3 Original line number Diff line number Diff line Loading @@ -77,6 +77,14 @@ <div id="snowflake-status"></div> </div> <div id='cookies-disabled' style='display:none'> <hr/> <p> Your browser has cookies disabled. You will need to enable them in order to set Snowflake preferences. </p> </div> <script> // Defaults to opt-in. Loading Loading @@ -120,9 +128,16 @@ function refreshStatus() { } } $buttons = document.getElementById('buttons'); $buttons.style = ''; window.onload = function() { if (navigator.cookieEnabled) { // Both JS and cookies enabled -- display normal buttons. document.getElementById('buttons').style = ''; } else { // Display the cookies disabled message if necessary. document.getElementById('cookies-disabled').style = ''; } refreshStatus(); } </script> </body> </html>