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);