chromium-proxy-settings/worker.ts
Mathieu Strypsteen 4de38e6f80
All checks were successful
Build / build (push) Successful in 21s
Add proxy bypass
2024-02-18 10:27:44 +01:00

21 lines
588 B
TypeScript

async function apply_proxy() {
const { active, host, port, bypass } = await chrome.storage.local.get(["active", "host", "port", "bypass"]);
if (!active) {
chrome.proxy.settings.clear({ scope: "regular" }, function () { });
return;
}
const config = {
mode: "fixed_servers",
rules: {
singleProxy: {
scheme: "socks5",
host: host,
port: port
},
bypassList: bypass
}
};
chrome.proxy.settings.set({ value: config, scope: "regular" }, function () { });
}
apply_proxy();
chrome.storage.onChanged.addListener(apply_proxy);