Skip to content

Commit

Permalink
Merge pull request #5087 from rocodes/5052-purple-tor-bar
Browse files Browse the repository at this point in the history
Update UA regex to match TB9 user agent strings
  • Loading branch information
zenmonkeykstop authored Jan 7, 2020
2 parents 3ab5609 + cb2e346 commit 57a5d68
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions securedrop/static/js/source.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const TBB_UA_REGEX = /Mozilla\/5\.0 \((Windows NT 6\.1|X11; Linux x86_64|Macintosh; Intel Mac OS X 10\.13|Windows NT 6\.1; Win64; x64); rv:[0-9]{2}\.0\) Gecko\/20100101 Firefox\/([0-9]{2})\.0/;
const TBB_UA_REGEX = /Mozilla\/5\.0 \((Windows NT 10\.0|X11; Linux x86_64|Macintosh; Intel Mac OS X 10\.14|Windows NT 10\.0; Win64; x64); rv:[0-9]{2}\.0\) Gecko\/20100101 Firefox\/([0-9]{2})\.0/;
const ORFOX_UA_REGEX = /Mozilla\/5\.0 \(Android; Mobile; rv:[0-9]{2}\.0\) Gecko\/20100101 Firefox\/([0-9]{2})\.0/;

function fadeIn(el, duration = 200, displayStyle = "block") {
Expand Down Expand Up @@ -64,8 +64,9 @@ function addFadingClose(id, elementToClose, fadeDuration = 200) {

/**
Tor Browser always reports a UTC timezone and window dimensions
that match the device dimensions, which is very unlikely in desktop
browsers.
that match the device dimensions. This is unlikely in desktop
browsers unless they implement anti-fingerprinting techniques
(such as Firefox privacy.resistFingerprinting).
*/
function looksLikeTorBrowser() {
return window.navigator.userAgent.match(TBB_UA_REGEX) &&
Expand All @@ -87,7 +88,7 @@ function looksLikeOrfox() {
*/
function showTorSuggestions() {
show("#js-warning");

let infoBubble = document.getElementById("security-setting-info");

// show the instruction popup when the link is clicked
Expand Down

0 comments on commit 57a5d68

Please sign in to comment.