diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b3dbff0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/options.html b/options.html index 883211a..d07ecb2 100644 --- a/options.html +++ b/options.html @@ -15,6 +15,8 @@ + +
diff --git a/options.ts b/options.ts index 7226eee..cefc981 100644 --- a/options.ts +++ b/options.ts @@ -1,16 +1,17 @@ function setProxy() { - let active = (document.getElementById('proxyActive') as HTMLInputElement).checked; - const host = (document.getElementById('proxyHost') as HTMLInputElement).value; - const port = (document.getElementById('proxyPort') as HTMLInputElement).value; + let active = (document.getElementById("proxyActive") as HTMLInputElement).checked; + const host = (document.getElementById("proxyHost") as HTMLInputElement).value; + const port = (document.getElementById("proxyPort") as HTMLInputElement).value; + const bypass = (document.getElementById("proxyBypass") as HTMLInputElement).value; if (!host || !port) { active = false; - (document.getElementById('proxyActive') as HTMLInputElement).checked = false; + (document.getElementById("proxyActive") as HTMLInputElement).checked = false; } - chrome.storage.local.set({ active: active, host: host, port: Number(port) }); + chrome.storage.local.set({ active: active, host: host, port: Number(port), bypass: bypass.split("\n") }); } -window.addEventListener('DOMContentLoaded', async () => { - (document.getElementById("proxySettings") as HTMLInputElement).addEventListener('submit', setProxy); - const { active, host, port } = await chrome.storage.local.get(["active", "host", "port"]); +window.addEventListener("DOMContentLoaded", async () => { + (document.getElementById("proxySettings") as HTMLInputElement).addEventListener("submit", setProxy); + const { active, host, port, bypass } = await chrome.storage.local.get(["active", "host", "port", "bypass"]); if (active) { (document.getElementById("proxyActive") as HTMLInputElement).checked = active; } @@ -20,4 +21,7 @@ window.addEventListener('DOMContentLoaded', async () => { if (port) { (document.getElementById("proxyPort") as HTMLInputElement).value = port; } + if (bypass) { + (document.getElementById("proxyBypass") as HTMLInputElement).value = bypass.join("\n"); + } }); diff --git a/worker.ts b/worker.ts index b8c5bc1..bc111af 100644 --- a/worker.ts +++ b/worker.ts @@ -1,7 +1,7 @@ async function apply_proxy() { - const { active, host, port } = await chrome.storage.local.get(["active", "host", "port"]); + const { active, host, port, bypass } = await chrome.storage.local.get(["active", "host", "port", "bypass"]); if (!active) { - chrome.proxy.settings.clear({ scope: 'regular' }, function () { }); + chrome.proxy.settings.clear({ scope: "regular" }, function () { }); return; } const config = { @@ -11,10 +11,11 @@ async function apply_proxy() { scheme: "socks5", host: host, port: port - } + }, + bypassList: bypass } }; - chrome.proxy.settings.set({ value: config, scope: 'regular' }, function () { }); + chrome.proxy.settings.set({ value: config, scope: "regular" }, function () { }); } apply_proxy(); chrome.storage.onChanged.addListener(apply_proxy);