From d6148e8cd80d411879375716f0ce46997a65009c Mon Sep 17 00:00:00 2001 From: Anton Z Date: Fri, 31 Jan 2025 15:38:55 +0300 Subject: [PATCH] rewrite --- proxy.pac | 71 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/proxy.pac b/proxy.pac index 2a70a07..cee4677 100644 --- a/proxy.pac +++ b/proxy.pac @@ -1,34 +1,35 @@ function FindProxyForURL(url, host) { var proxy = "PROXY proxy.vm:8118"; - var proxyDomains = { - "linkedin.com": 1, - "rutracker.org": 1, "*.rutracker.*": 1, - "2ip.ru": 1, - "kinozal.tv": 1, "*.kinozal.tv": 1, - "ntc.party": 1, - "instagram.com": 1, "*.instagram.com": 1, "*.cdninstagram.com": 1, - "chatgpt.com": 1, "openai.com": 1, "*.openai.com": 1, "*.chatgpt.com": 1, - "digitalocean.com": 1, "*.digitalocean.com": 1, - "cisco.com": 1, "*.cisco.com": 1, - "medium.com": 1, "*.medium.com": 1, - "homarr.dev": 1, "*.homarr.dev": 1, - "netgate.com": 1, "*.netgate.com": 1, - "boostymark.com": 1, "*.boostymark.com": 1, - "discord.com": 1, "*.discord.com": 1, "discord.gg": 1, "*.discord.gg": 1, - "notepad-plus-plus.org": 1, "*.notepad-plus-plus.org": 1, - "clickhouse.com": 1, "*.clickhouse.com": 1, - "hashicorp.com": 1, "*.hashicorp.com": 1, - "vagrantup.com": 1, "*.vagrantup.com": 1, - "vagrantcloud.com": 1, "*.vagrantcloud.com": 1, - "turnkeylinux.org": 1, "*.turnkeylinux.org": 1, - "habr.com": 1, "*.habr.com": 1, - "giters.com": 1, "*.giters.com": 1, - "imdb.com": 1, "*.imdb.com": 1, - "themoviedb.org": 1, "*.themoviedb.org": 1, - "intel.com": 1, "*.intel.com": 1, - "terraform.io": 1, "*.terraform.io": 1 - }; + // Domains that should go through the proxy + var proxyDomains = [ + "linkedin.com", "www.linkedin.com", + "rutracker.org", "*.rutracker.*", + "2ip.ru", + "kinozal.tv", "*.kinozal.tv", + "ntc.party", + "instagram.com", "*.instagram.com", "*.cdninstagram.com", + "chatgpt.com", "*.chatgpt.com", "openai.com", "*.openai.com", + "digitalocean.com", "*.digitalocean.com", + "cisco.com", "*.cisco.com", + "medium.com", "*.medium.com", + "homarr.dev", "*.homarr.dev", + "netgate.com", "*.netgate.com", + "boostymark.com", "*.boostymark.com", + "discord.com", "*.discord.com", "discord.gg", "*.discord.gg", + "notepad-plus-plus.org", "*.notepad-plus-plus.org", + "clickhouse.com", "*.clickhouse.com", + "hashicorp.com", "*.hashicorp.com", + "vagrantup.com", "*.vagrantup.com", + "vagrantcloud.com", "*.vagrantcloud.com", + "turnkeylinux.org", "*.turnkeylinux.org", + "habr.com", "*.habr.com", + "giters.com", "*.giters.com", + "imdb.com", "*.imdb.com", + "themoviedb.org", "*.themoviedb.org", + "intel.com", "*.intel.com", + "terraform.io", "*.terraform.io" + ]; var googleDomains = [ "youtube.com", "*.youtube.com", "*.youtu.be", "youtu.be", @@ -38,8 +39,18 @@ function FindProxyForURL(url, host) { "jnn-pa.googleapis.com", "l.google.com" ]; - // Check if the host matches any proxy domain - if (proxyDomains[host] || googleDomains.some(pattern => shExpMatch(host, pattern))) { + // Function to check if host matches any pattern + function matchesAny(host, patterns) { + for (var i = 0; i < patterns.length; i++) { + if (shExpMatch(host, patterns[i])) { + return true; + } + } + return false; + } + + // Check if the host matches any domain in the list + if (matchesAny(host, proxyDomains) || matchesAny(host, googleDomains)) { return proxy; }