chromium-proxy-settings/worker.ts
Mathieu Strypsteen 8c50b3a9aa
All checks were successful
Build / build (push) Successful in 20s
Refactor
2024-02-18 12:08:41 +01:00

21 lines
585 B
TypeScript

async function applyProxy() {
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 () { });
}
chrome.storage.onChanged.addListener(applyProxy);
applyProxy();