Compare commits
No commits in common. "main" and "v2026.07.27" have entirely different histories.
main
...
v2026.07.2
3 changed files with 13 additions and 72 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
/dist/
|
|
||||||
.amo-upload-uuid
|
|
||||||
|
|
@ -1,73 +1,18 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const CHROME_VERSION = "140.0.0.0";
|
const WINDOWS_CHROME_UA =
|
||||||
const TARGET_HOSTS = [
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
|
||||||
"netflix.com",
|
"AppleWebKit/537.36 (KHTML, like Gecko) " +
|
||||||
"assets.nflxext.com"
|
"Chrome/140.0.0.0 Safari/537.36";
|
||||||
];
|
|
||||||
|
|
||||||
function getOperatingSystem() {
|
browser.webRequest.onBeforeSendHeaders.addListener(
|
||||||
const ua = globalThis.navigator?.userAgent || "";
|
|
||||||
const platform = globalThis.navigator?.platform || "";
|
|
||||||
const userAgentDataPlatform = globalThis.navigator?.userAgentData?.platform || "";
|
|
||||||
|
|
||||||
if (/Windows/i.test(ua) || /Win/i.test(platform) || /win/i.test(userAgentDataPlatform)) {
|
|
||||||
return "win";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (/Mac/i.test(ua) || /Mac/i.test(platform) || /mac/i.test(userAgentDataPlatform)) {
|
|
||||||
return "mac";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (/Linux/i.test(ua) || /Linux/i.test(platform) || /linux/i.test(userAgentDataPlatform)) {
|
|
||||||
return "linux";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "linux";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getChromeLikeUserAgent() {
|
|
||||||
const os = getOperatingSystem();
|
|
||||||
|
|
||||||
switch (os) {
|
|
||||||
case "mac":
|
|
||||||
return `Mozilla/5.0 (Macintosh; Intel Mac OS X 14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROME_VERSION} Safari/537.36`;
|
|
||||||
case "win":
|
|
||||||
return `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROME_VERSION} Safari/537.36`;
|
|
||||||
case "linux":
|
|
||||||
default:
|
|
||||||
return `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROME_VERSION} Safari/537.36`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isTargetHost(url) {
|
|
||||||
try {
|
|
||||||
const hostname = new URL(url).hostname.toLowerCase();
|
|
||||||
|
|
||||||
return hostname === "netflix.com" ||
|
|
||||||
hostname.endsWith(".netflix.com") ||
|
|
||||||
hostname === "assets.nflxext.com" ||
|
|
||||||
hostname.endsWith(".nflxext.com");
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const browserApi = globalThis.browser || globalThis.chrome;
|
|
||||||
|
|
||||||
browserApi.webRequest.onBeforeSendHeaders.addListener(
|
|
||||||
(details) => {
|
(details) => {
|
||||||
if (!isTargetHost(details.url)) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const requestHeaders = details.requestHeaders ?? [];
|
const requestHeaders = details.requestHeaders ?? [];
|
||||||
const userAgentValue = getChromeLikeUserAgent();
|
|
||||||
let foundUserAgent = false;
|
let foundUserAgent = false;
|
||||||
|
|
||||||
for (const header of requestHeaders) {
|
for (const header of requestHeaders) {
|
||||||
if (header.name.toLowerCase() === "user-agent") {
|
if (header.name.toLowerCase() === "user-agent") {
|
||||||
header.value = userAgentValue;
|
header.value = WINDOWS_CHROME_UA;
|
||||||
foundUserAgent = true;
|
foundUserAgent = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +21,7 @@ browserApi.webRequest.onBeforeSendHeaders.addListener(
|
||||||
if (!foundUserAgent) {
|
if (!foundUserAgent) {
|
||||||
requestHeaders.push({
|
requestHeaders.push({
|
||||||
name: "User-Agent",
|
name: "User-Agent",
|
||||||
value: userAgentValue
|
value: WINDOWS_CHROME_UA
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,9 +30,7 @@ browserApi.webRequest.onBeforeSendHeaders.addListener(
|
||||||
{
|
{
|
||||||
urls: [
|
urls: [
|
||||||
"*://netflix.com/*",
|
"*://netflix.com/*",
|
||||||
"*://*.netflix.com/*",
|
"*://*.netflix.com/*"
|
||||||
"*://assets.nflxext.com/*",
|
|
||||||
"*://*.nflxext.com/*"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "thisischromiumnetflix",
|
"name": "thisiswindowschromiumnetflix",
|
||||||
"version": "2026.7.27.1",
|
"version": "1.0.0",
|
||||||
"description": "Netflix 관련 요청의 User-Agent를 운영체제에 맞춰 조정합니다.",
|
"description": "Netflix에서 User-Agent를 Windows Chrome으로 고정합니다.",
|
||||||
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"webRequest",
|
"webRequest",
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
"id": "thisiswindowschromiumnetflix@imnya.ng",
|
"id": "thisiswindowschromiumnetflix@imnya.ng",
|
||||||
"strict_min_version": "142.0",
|
"strict_min_version": "109.0",
|
||||||
"data_collection_permissions": {
|
"data_collection_permissions": {
|
||||||
"required": [
|
"required": [
|
||||||
"none"
|
"none"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue