first commit
This commit is contained in:
commit
46aea254d0
19 changed files with 569 additions and 0 deletions
BIN
dist/figma-windows-ua-firefox-unsigned.xpi
vendored
Normal file
BIN
dist/figma-windows-ua-firefox-unsigned.xpi
vendored
Normal file
Binary file not shown.
1
dist/firefox/.amo-upload-uuid
vendored
Normal file
1
dist/firefox/.amo-upload-uuid
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"uploadUuid":"b4b16a82abdb4ce5850b5d0deb76ef3b","channel":"unlisted","xpiCrcHash":"e5567d47cfb9f6133110396308a37ed42afc5be51f6b047ae4643d3f5f063591"}
|
||||
29
dist/firefox/background.firefox.js
vendored
Normal file
29
dist/firefox/background.firefox.js
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
const WINDOWS_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.7444.163 Safari/537.36';
|
||||
|
||||
browser.webRequest.onBeforeSendHeaders.addListener(
|
||||
(details) => {
|
||||
const headers = details.requestHeaders || [];
|
||||
let found = false;
|
||||
|
||||
for (const header of headers) {
|
||||
if (header.name && header.name.toLowerCase() === 'user-agent') {
|
||||
header.value = WINDOWS_UA;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
headers.push({ name: 'User-Agent', value: WINDOWS_UA });
|
||||
}
|
||||
|
||||
return { requestHeaders: headers };
|
||||
},
|
||||
{
|
||||
urls: [
|
||||
'https://figma.com/*',
|
||||
'https://*.figma.com/*'
|
||||
]
|
||||
},
|
||||
['blocking', 'requestHeaders']
|
||||
);
|
||||
6
dist/firefox/content.js
vendored
Normal file
6
dist/firefox/content.js
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(() => {
|
||||
const script = document.createElement('script');
|
||||
script.src = chrome.runtime.getURL('injected.js');
|
||||
script.onload = () => script.remove();
|
||||
(document.head || document.documentElement).appendChild(script);
|
||||
})();
|
||||
62
dist/firefox/injected.js
vendored
Normal file
62
dist/firefox/injected.js
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
(() => {
|
||||
const windowsUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.7444.163 Safari/537.36';
|
||||
const appVersion = '5.0 (Windows)';
|
||||
|
||||
const override = (obj, key, value) => {
|
||||
try {
|
||||
Object.defineProperty(obj, key, {
|
||||
get: () => value,
|
||||
configurable: true
|
||||
});
|
||||
} catch (error) {
|
||||
// no-op
|
||||
}
|
||||
};
|
||||
|
||||
override(Navigator.prototype, 'userAgent', windowsUA);
|
||||
override(Navigator.prototype, 'appVersion', appVersion);
|
||||
override(Navigator.prototype, 'platform', 'Win32');
|
||||
override(Navigator.prototype, 'oscpu', 'Windows NT 10.0; Win64; x64');
|
||||
|
||||
if (navigator.userAgentData) {
|
||||
const uaData = {
|
||||
brands: [
|
||||
{ brand: 'Chromium', version: '142' },
|
||||
{ brand: 'Google Chrome', version: '142' }
|
||||
],
|
||||
mobile: false,
|
||||
platform: 'Windows',
|
||||
getHighEntropyValues: async (hints) => {
|
||||
const result = {
|
||||
architecture: 'x86',
|
||||
bitness: '64',
|
||||
mobile: false,
|
||||
model: '',
|
||||
platform: 'Windows',
|
||||
platformVersion: '10.0.0',
|
||||
uaFullVersion: '142.0.7444.163',
|
||||
wow64: false
|
||||
};
|
||||
|
||||
if (Array.isArray(hints)) {
|
||||
return hints.reduce((acc, hint) => {
|
||||
if (hint in result) acc[hint] = result[hint];
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
toJSON: () => ({
|
||||
brands: [
|
||||
{ brand: 'Chromium', version: '142' },
|
||||
{ brand: 'Google Chrome', version: '142' }
|
||||
],
|
||||
mobile: false,
|
||||
platform: 'Windows'
|
||||
})
|
||||
};
|
||||
|
||||
override(Navigator.prototype, 'userAgentData', uaData);
|
||||
}
|
||||
})();
|
||||
38
dist/firefox/manifest.json
vendored
Normal file
38
dist/firefox/manifest.json
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Figma Windows UA Spoofer",
|
||||
"description": "Spoof Windows User-Agent and platform on figma.com",
|
||||
"version": "1.0.0",
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "figma-windows-ua-spoofer@imnyang.local",
|
||||
"strict_min_version": "109.0"
|
||||
}
|
||||
},
|
||||
"permissions": [
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"https://figma.com/*",
|
||||
"https://*.figma.com/*"
|
||||
],
|
||||
"background": {
|
||||
"scripts": [
|
||||
"background.firefox.js"
|
||||
]
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"https://figma.com/*",
|
||||
"https://*.figma.com/*"
|
||||
],
|
||||
"js": [
|
||||
"content.js"
|
||||
],
|
||||
"run_at": "document_start"
|
||||
}
|
||||
],
|
||||
"web_accessible_resources": [
|
||||
"injected.js"
|
||||
]
|
||||
}
|
||||
BIN
dist/signed/d168a70cb6a24fe4a478-1.0.0.xpi
vendored
Normal file
BIN
dist/signed/d168a70cb6a24fe4a478-1.0.0.xpi
vendored
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue