-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the UA quirks, that are not needed anymore
- Loading branch information
Showing
2 changed files
with
10 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2015, 2016 Tomas Popela <[email protected]> | ||
* Copyright (C) 2015-2017 Tomas Popela <[email protected]> | ||
* | ||
* Licensed under the GNU General Public License Version 2 | ||
* | ||
|
@@ -23,28 +23,17 @@ | |
// inspired with https://developer.chrome.com/extensions/webRequest | ||
chrome.webRequest.onBeforeSendHeaders.addListener( | ||
details => { | ||
let anchor = document.createElement('a'); | ||
const headers = details.requestHeaders; | ||
const headersLength = headers.length; | ||
|
||
anchor.href = details.url; | ||
/* It's not great that various sites are still so heavily dependant on | ||
* the User-Agent.. | ||
* netflix.com - https://bugzilla.redhat.com/show_bug.cgi?id=1313244 | ||
* onenote.com - https://bugzilla.redhat.com/show_bug.cgi?id=1368571 | ||
*/ | ||
if (anchor.hostname !== 'www.netflix.com' && | ||
anchor.hostname !== 'www.onenote.com') { | ||
const headers = details.requestHeaders; | ||
const headersLength = headers.length; | ||
|
||
for (let i = 0; i < headersLength; i++) { | ||
if (headers[i].name === 'User-Agent') { | ||
headers[i].value = headers[i].value.replace('; Linux', '; Fedora; Linux'); | ||
break; | ||
} | ||
for (let i = 0; i < headersLength; i++) { | ||
if (headers[i].name === 'User-Agent') { | ||
headers[i].value = headers[i].value.replace('; Linux', '; Fedora; Linux'); | ||
break; | ||
} | ||
|
||
return { requestHeaders: headers }; | ||
} | ||
|
||
return { requestHeaders: headers }; | ||
}, | ||
{urls: ['<all_urls>']}, | ||
['blocking', 'requestHeaders'] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters