chromium-proxy-settings/worker.ts
Mathieu Strypsteen 7f52254c6b
All checks were successful
Build / build (push) Successful in 33s
Add eslint
2024-02-18 14:22:59 +01:00

23 lines
656 B
TypeScript

import { Storage } from './common';
async function applyProxy() {
const { active, host, port, bypass } = await chrome.storage.local.get(["active", "host", "port", "bypass"]) as Storage;
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(() => { void applyProxy(); });
void applyProxy();