Commit 9f2e9a6e authored by Serene H's avatar Serene H
Browse files

disable for TBB user agents. closes #37

parent 6d2b0ac4
......@@ -48,7 +48,7 @@ MODE =
WEBRTC_CONNECTING: 1
WEBRTC_READY: 2
CONFIRMATION_MESSAGE = "You're currently serving a Tor user via Snowflake."
CONFIRMATION_MESSAGE = 'You\'re currently serving a Tor user via Snowflake.'
# Minimum viable snowflake for now - just 1 client.
class Snowflake
......@@ -222,8 +222,13 @@ snowflakeIsDisabled = ->
if cookies[COOKIE_NAME] != '1'
log 'Not opted-in. Please click the badge to change options.'
return true
# Also do nothing if running in Tor Browser.
if mightBeTBB()
log 'Will not run within Tor Browser.'
return true
return false
###
Entry point.
###
......
......@@ -5,6 +5,20 @@ Contains helpers for parsing query strings and other utilities.
###
# It would not be effective for Tor Browser users to run the proxy.
# Do we seem to be running in Tor Browser? Check the user-agent string and for
# no listing of supported MIME types.
TBB_UAS = [
'Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0'
'Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0'
'Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0'
'Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0'
]
mightBeTBB = ->
return TBB_UAS.indexOf(window.navigator.userAgent) > -1 and
(window.navigator.mimeTypes and
window.navigator.mimeTypes.length == 0)
genSnowflakeID = ->
Math.random().toString(36).substring(2)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment