mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
disable for TBB user agents. closes #37
This commit is contained in:
parent
6d2b0ac420
commit
9f2e9a6ecb
2 changed files with 20 additions and 1 deletions
|
@ -48,7 +48,7 @@ MODE =
|
||||||
WEBRTC_CONNECTING: 1
|
WEBRTC_CONNECTING: 1
|
||||||
WEBRTC_READY: 2
|
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.
|
# Minimum viable snowflake for now - just 1 client.
|
||||||
class Snowflake
|
class Snowflake
|
||||||
|
@ -222,8 +222,13 @@ snowflakeIsDisabled = ->
|
||||||
if cookies[COOKIE_NAME] != '1'
|
if cookies[COOKIE_NAME] != '1'
|
||||||
log 'Not opted-in. Please click the badge to change options.'
|
log 'Not opted-in. Please click the badge to change options.'
|
||||||
return true
|
return true
|
||||||
|
# Also do nothing if running in Tor Browser.
|
||||||
|
if mightBeTBB()
|
||||||
|
log 'Will not run within Tor Browser.'
|
||||||
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
Entry point.
|
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 = ->
|
genSnowflakeID = ->
|
||||||
Math.random().toString(36).substring(2)
|
Math.random().toString(36).substring(2)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue