Release v2.0.9.1 (Firefox Android)

Fix options/cookie storeId (Firefox Android)
This commit is contained in:
magnolia1234 2021-02-22 19:49:41 +01:00
parent e22c5aebf3
commit fa0dfd3de9
6 changed files with 50 additions and 32 deletions

View file

@ -804,11 +804,13 @@ function disableJavascriptOnListedSites() {
["blocking"]);
}
if (typeof browser !== 'object') {
var focus_changed = false;
ext_api.windows.onFocusChanged.addListener((windowId) => {
if (windowId > 0)
focus_changed = true;
});
}
var extraInfoSpec = ['blocking', 'requestHeaders'];
if (ext_api.webRequest.OnBeforeSendHeadersOptions.hasOwnProperty('EXTRA_HEADERS'))
@ -1142,13 +1144,17 @@ ext_api.webRequest.onCompleted.addListener(function (details) {
if (store.tabIds.includes(tabId))
storeId = store.id;
}
storeId = storeId.toString();
var domainVar = matchUrlDomain(remove_cookies, details.url);
if ((!['main_frame', 'xmlhttprequest', 'other'].includes(details.type)) || !domainVar || !enabledSites.includes(domainVar))
return;
ext_api.cookies.getAll({
domain: domainVar,
storeId: storeId
}, function (cookies) {
var cookie_get_options = {
domain: domainVar
};
if (storeId !== 'null')
cookie_get_options.storeId = storeId;
var cookie_remove_options = {};
ext_api.cookies.getAll(cookie_get_options, function (cookies) {
for (let cookie of cookies) {
var rc_domain = cookie.domain.replace(/^(\.?www\.|\.)/, '');
// hold specific cookie(s) from remove_cookies domains
@ -1163,12 +1169,13 @@ ext_api.webRequest.onCompleted.addListener(function (details) {
if (cookie.name.match(/(consent|^optanon)/i)) {
continue;
}
cookie.domain = cookie.domain.replace(/^\./, '');
ext_api.cookies.remove({
cookie_remove_options = {
url: (cookie.secure ? "https://" : "http://") + cookie.domain + cookie.path,
name: cookie.name,
storeId: storeId
});
name: cookie.name
};
if (storeId !== 'null')
cookie_remove_options.storeId = storeId;
ext_api.cookies.remove(cookie_remove_options);
}
});
}
@ -1228,18 +1235,24 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
if (store.tabIds.includes(tabId))
storeId = store.id;
}
storeId = storeId.toString();
var domainVar = message.domain.replace('www.', '');
ext_api.cookies.getAll({
domain: domainVar,
storeId: storeId
}, function (cookies) {
var cookie_get_options = {
domain: domainVar
};
if (storeId !== 'null')
cookie_get_options.storeId = storeId;
var cookie_remove_options = {};
ext_api.cookies.getAll(cookie_get_options, function (cookies) {
for (let cookie of cookies) {
cookie.domain = cookie.domain.replace(/^\./, '');
ext_api.cookies.remove({
cookie_remove_options = {
url: (cookie.secure ? "https://" : "http://") + cookie.domain + cookie.path,
name: cookie.name,
storeId: storeId
});
name: cookie.name
};
if (storeId !== 'null')
cookie_remove_options.storeId = storeId;
ext_api.cookies.remove(cookie_remove_options);
}
});
}

View file

@ -3,6 +3,9 @@ Changelog Bypass Paywalls Clean - Firefox
Post-release
* v2.0.9.1 (2021-02-21)
Fix options/cookie storeId (Firefox Android)
* v2.0.9.0 (2021-02-21)
Add Daily Nation (Kenya)
Add Houston Chronicle (USA)

View file

@ -476,5 +476,5 @@
"*://*.userzoom.com/*",
"*://*.wsj.net/*"
],
"version": "2.0.9.0"
"version": "2.0.9.1"
}

View file

@ -29,9 +29,9 @@ function save_options() {
// Restores checkbox input states using the preferences stored in ext_api.storage.
function renderOptions() {
ext_api.runtime.sendMessage({request: 'defaultSites_domains'});
ext_api.runtime.onMessage.addListener(function (message, sender) {
if (message.defaultSites_domains) {
//ext_api.runtime.sendMessage({request: 'defaultSites_domains'});
//ext_api.runtime.onMessage.addListener(function (message, sender) {
//if (message.defaultSites_domains) {
var labelEl;
ext_api.storage.local.get({
sites: {}, sites_custom: {}, sites_excluded: []
@ -68,7 +68,8 @@ if (message.defaultSites_domains) {
labelEl.appendChild(document.createTextNode('* Custom Sites'));
sitesEl.appendChild(labelEl);
var sites_custom = items.sites_custom;
var defaultSites_domains = message.defaultSites_domains;
//var defaultSites_domains = message.defaultSites_domains;
var defaultSites_domains = Object.values(defaultSites);
for (var key in sites_custom) {
var domain = sites_custom[key]['domain'];
if (defaultSites.hasOwnProperty(key) || defaultSites_domains.includes(domain)) {
@ -98,8 +99,8 @@ if (message.defaultSites_domains) {
sitesEl.appendChild(labelEl);
save_options();
});
}
});
//}
//});
}
function selectAll() {

View file

@ -186,9 +186,9 @@ function edit_options() {
// Restores checkbox input states using the preferences stored in ext_api.storage.
function renderOptions() {
ext_api.runtime.sendMessage({request: 'defaultSites_domains'});
ext_api.runtime.onMessage.addListener(function (message, sender) {
if (message.defaultSites_domains) {
//ext_api.runtime.sendMessage({request: 'defaultSites_domains'});
//ext_api.runtime.onMessage.addListener(function (message, sender) {
//if (message.defaultSites_domains) {
ext_api.storage.local.get({
sites_custom: {}
}, function (items) {
@ -256,7 +256,8 @@ if (message.defaultSites_domains) {
for (var key in sites_custom) {
optionEl = document.createElement('option');
let domain = sites_custom[key]['domain'];
let defaultSites_domains = message.defaultSites_domains;
// let defaultSites_domains = message.defaultSites_domains;
let defaultSites_domains = Object.values(defaultSites);
let isDefaultSite = defaultSites_domains.includes(domain);
optionEl.text = isDefaultSite ? '*' : '';
optionEl.text += key + ': ' + domain +
@ -282,8 +283,8 @@ if (message.defaultSites_domains) {
custom_enabled.innerText = 'NO';
}
});
}
});
//}
//});
}
document.addEventListener('DOMContentLoaded', renderOptions);

View file

@ -2,8 +2,8 @@
"addons": {
"magnolia@12.34": {
"updates": [
{ "version": "2.0.9.0",
"update_link": "https://gitlab.com/magnolia1234/bpc-uploads/-/raw/master/bypass_paywalls_clean-2.0.9.0.xpi" }
{ "version": "2.0.9.1",
"update_link": "https://gitlab.com/magnolia1234/bpc-uploads/-/raw/master/bypass_paywalls_clean-2.0.9.1.xpi" }
]
}
}