fixes #112
This commit is contained in:
parent
7a10d60cd5
commit
3447fce0a0
1 changed files with 13 additions and 3 deletions
|
@ -232,6 +232,9 @@ const ua = {
|
||||||
}
|
}
|
||||||
const p = (new UAParser(s)).getResult();
|
const p = (new UAParser(s)).getResult();
|
||||||
o.platform = p.os.name || '';
|
o.platform = p.os.name || '';
|
||||||
|
if (o.platform === 'Mac OS') {
|
||||||
|
o.platform = 'MacIntel';
|
||||||
|
}
|
||||||
o.vendor = p.device.vendor || '';
|
o.vendor = p.device.vendor || '';
|
||||||
if (isSF) {
|
if (isSF) {
|
||||||
o.vendor = 'Apple Computer, Inc.';
|
o.vendor = 'Apple Computer, Inc.';
|
||||||
|
@ -524,7 +527,8 @@ const onCommitted = d => {
|
||||||
frameId,
|
frameId,
|
||||||
code: `{
|
code: `{
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.src = 'data:text/javascript;charset=utf-8;base64,' + btoa(\`{
|
script.textContent = \`{
|
||||||
|
document.currentScript.dataset.injected = true;
|
||||||
const o = JSON.parse('${JSON.stringify(o)}');
|
const o = JSON.parse('${JSON.stringify(o)}');
|
||||||
for (const key of Object.keys(o)) {
|
for (const key of Object.keys(o)) {
|
||||||
navigator.__defineGetter__(key, () => {
|
navigator.__defineGetter__(key, () => {
|
||||||
|
@ -537,8 +541,14 @@ const onCommitted = d => {
|
||||||
return o[key];
|
return o[key];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}\`);
|
}\`;
|
||||||
document.documentElement.appendChild(script);
|
document.documentElement.appendChild(script);
|
||||||
|
if (script.dataset.injected !== 'true') {
|
||||||
|
const s = document.createElement('script');
|
||||||
|
s.src = 'data:text/javascript;charset=utf-8;base64,' + btoa(script.textContent);
|
||||||
|
document.documentElement.appendChild(s);
|
||||||
|
s.remove();
|
||||||
|
}
|
||||||
script.remove();
|
script.remove();
|
||||||
}`
|
}`
|
||||||
}, () => {
|
}, () => {
|
||||||
|
@ -611,7 +621,7 @@ chrome.runtime.onMessage.addListener((request, sender, response) => {
|
||||||
tabs.query({active: true, currentWindow: true}, tbs => tabs.create({
|
tabs.query({active: true, currentWindow: true}, tbs => tabs.create({
|
||||||
url: page + '?version=' + version + (previousVersion ? '&p=' + previousVersion : '') + '&type=' + reason,
|
url: page + '?version=' + version + (previousVersion ? '&p=' + previousVersion : '') + '&type=' + reason,
|
||||||
active: reason === 'install',
|
active: reason === 'install',
|
||||||
index: tbs ? tbs[0].index + 1 : undefined
|
...(tbs && tbs.length && {index: tbs[0].index + 1})
|
||||||
}));
|
}));
|
||||||
storage.local.set({'last-update': Date.now()});
|
storage.local.set({'last-update': Date.now()});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue