mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-02-01 20:07:20 +01:00
Fixed encoding problem with some websites (#75)
This commit is contained in:
parent
c49ec86169
commit
636444cd76
@ -92,4 +92,17 @@ const Whitelist = {
|
||||
const BrowserType = {
|
||||
'CHROMIUM': chrome.runtime.getURL("/").startsWith("chrome-extension"),
|
||||
'FIREFOX': chrome.runtime.getURL("/").startsWith("moz-extension")
|
||||
}
|
||||
};
|
||||
|
||||
const CharsetDomains = {
|
||||
'dejure.org': 'iso-8859-1',
|
||||
'privacy-handbuch.de': 'iso-8859-1',
|
||||
'winfuture.de': 'iso-8859-1',
|
||||
'drwindows.de': 'iso-8859-1',
|
||||
'sphinx-soft.com': 'iso-8859-1',
|
||||
'ekaterinaguseva.ru': 'windows-1251',
|
||||
'hobbybrauerversand.de': 'iso-8859-1',
|
||||
'pro-linux.de': 'iso-8859-15',
|
||||
'gwdg.de': 'windows-1252',
|
||||
'tyurem.net': 'windows-1251'
|
||||
};
|
||||
|
@ -26,6 +26,18 @@ var manipulateDOM = {};
|
||||
* Private Methods
|
||||
*/
|
||||
|
||||
manipulateDOM._getEncoding = function (domain) {
|
||||
|
||||
let encodingByDomain = CharsetDomains[domain];
|
||||
|
||||
if(typeof encodingByDomain === 'undefined') {
|
||||
return 'UTF-8';
|
||||
}
|
||||
|
||||
return encodingByDomain;
|
||||
|
||||
};
|
||||
|
||||
manipulateDOM._removeCrossOriginAndIntegrityAttr = function (details) {
|
||||
|
||||
// by Jaap (https://gitlab.com/Jaaap)
|
||||
@ -44,7 +56,7 @@ manipulateDOM._removeCrossOriginAndIntegrityAttr = function (details) {
|
||||
if (!isWhitelisted && mimeType === 'text/html') {
|
||||
|
||||
header.value = 'text/html; charset=UTF-8';
|
||||
let decoder = new TextDecoder(charset);
|
||||
let decoder = new TextDecoder(manipulateDOM._getEncoding(initiatorDomain));
|
||||
let encoder = new TextEncoder();
|
||||
let filter = browser.webRequest.filterResponseData(details.requestId);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "LocalCDN (fork from Decentraleyes)",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "{b86e4813-687a-43e6-ab65-0bde4ab75758}",
|
||||
|
@ -21,6 +21,9 @@
|
||||
<div class="subtle-hint">
|
||||
<div class="topic-label">
|
||||
New in LocalCDN:
|
||||
<ul>
|
||||
<li>Fixed: Encoding problem with some websites (maybe only temporary, because at the moment only 9 websites are affected)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul>
|
||||
<li>Fixed typo in urlize</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user