This commit is contained in:
parent
54cf92c746
commit
f792087171
2 changed files with 11 additions and 12 deletions
|
@ -60,9 +60,7 @@ function sort(arr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get(path) {
|
function get(path) {
|
||||||
return (typeof caches !== 'undefined' ? caches : {
|
const cf = Promise.resolve({
|
||||||
open() {
|
|
||||||
return Promise.resolve({
|
|
||||||
match() {
|
match() {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
},
|
},
|
||||||
|
@ -70,8 +68,11 @@ function get(path) {
|
||||||
return Promise.resolve();
|
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;
|
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 {
|
||||||
|
|
|
@ -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",
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue