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

View file

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "User-Agent Switcher and Manager",
"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",