Ray Lothian 2020-08-06 07:14:37 +02:00
parent 54cf92c746
commit f792087171
2 changed files with 11 additions and 12 deletions

View file

@ -60,18 +60,19 @@ function sort(arr) {
} }
function get(path) { function get(path) {
const cf = Promise.resolve({
match() {
return Promise.resolve();
},
add() {
return Promise.resolve();
}
});
return (typeof caches !== 'undefined' ? caches : { return (typeof caches !== 'undefined' ? caches : {
open() { open() {
return Promise.resolve({ return cf;
match() {
return Promise.resolve();
},
add() {
return Promise.resolve();
}
});
} }
}).open('agents').then(cache => { }).open('agents').catch(() => cf).then(cache => {
const link = 'https://cdn.jsdelivr.net/gh/ray-lothian/UserAgent-Switcher/node/' + path; const link = 'https://cdn.jsdelivr.net/gh/ray-lothian/UserAgent-Switcher/node/' + path;
// updating agents once per 7 days // updating agents once per 7 days
chrome.storage.local.get({ chrome.storage.local.get({
@ -255,7 +256,6 @@ document.addEventListener('click', ({target}) => {
} }
if (value !== navigator.userAgent) { if (value !== navigator.userAgent) {
// prevent a container ua string from overwriting the default one // prevent a container ua string from overwriting the default one
console.log(tab);
if ('cookieStoreId' in tab && tab.cookieStoreId !== DCSI) { if ('cookieStoreId' in tab && tab.cookieStoreId !== DCSI) {
chrome.runtime.getBackgroundPage(bg => bg.ua.update(value, undefined, tab.cookieStoreId)); chrome.runtime.getBackgroundPage(bg => bg.ua.update(value, undefined, tab.cookieStoreId));
chrome.storage.local.get({ chrome.storage.local.get({
@ -263,7 +263,6 @@ document.addEventListener('click', ({target}) => {
}, prefs => { }, prefs => {
prefs['container-uas'][tab.cookieStoreId] = value; prefs['container-uas'][tab.cookieStoreId] = value;
chrome.storage.local.set(prefs); chrome.storage.local.set(prefs);
console.log(prefs);
}); });
} }
else { else {

View file

@ -2,7 +2,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "User-Agent Switcher and Manager", "name": "User-Agent Switcher and Manager",
"short_name": "useragent-switcher", "short_name": "useragent-switcher",
"version": "0.4.0", "version": "0.4.0.1",
"description": "Spoof websites trying to gather information about your web navigation to deliver distinct content you may not want", "description": "Spoof websites trying to gather information about your web navigation to deliver distinct content you may not want",