This commit is contained in:
parent
ba5c9b25db
commit
8c50b3a9aa
2 changed files with 5 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
function setProxy() {
|
function saveProxy() {
|
||||||
let active = (document.getElementById("proxyActive") as HTMLInputElement).checked;
|
let active = (document.getElementById("proxyActive") as HTMLInputElement).checked;
|
||||||
const host = (document.getElementById("proxyHost") as HTMLInputElement).value;
|
const host = (document.getElementById("proxyHost") as HTMLInputElement).value;
|
||||||
const port = (document.getElementById("proxyPort") as HTMLInputElement).value;
|
const port = (document.getElementById("proxyPort") as HTMLInputElement).value;
|
||||||
|
@ -10,7 +10,7 @@ function setProxy() {
|
||||||
chrome.storage.local.set({ active: active, host: host, port: Number(port), bypass: bypass.split("\n") });
|
chrome.storage.local.set({ active: active, host: host, port: Number(port), bypass: bypass.split("\n") });
|
||||||
}
|
}
|
||||||
window.addEventListener("DOMContentLoaded", async () => {
|
window.addEventListener("DOMContentLoaded", async () => {
|
||||||
(document.getElementById("proxySettings") as HTMLInputElement).addEventListener("submit", setProxy);
|
(document.getElementById("proxySettings") as HTMLInputElement).addEventListener("submit", saveProxy);
|
||||||
const { active, host, port, bypass } = await chrome.storage.local.get(["active", "host", "port", "bypass"]);
|
const { active, host, port, bypass } = await chrome.storage.local.get(["active", "host", "port", "bypass"]);
|
||||||
if (active) {
|
if (active) {
|
||||||
(document.getElementById("proxyActive") as HTMLInputElement).checked = active;
|
(document.getElementById("proxyActive") as HTMLInputElement).checked = active;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
async function apply_proxy() {
|
async function applyProxy() {
|
||||||
const { active, host, port, bypass } = await chrome.storage.local.get(["active", "host", "port", "bypass"]);
|
const { active, host, port, bypass } = await chrome.storage.local.get(["active", "host", "port", "bypass"]);
|
||||||
if (!active) {
|
if (!active) {
|
||||||
chrome.proxy.settings.clear({ scope: "regular" }, function () { });
|
chrome.proxy.settings.clear({ scope: "regular" }, function () { });
|
||||||
|
@ -17,5 +17,5 @@ async function apply_proxy() {
|
||||||
};
|
};
|
||||||
chrome.proxy.settings.set({ value: config, scope: "regular" }, function () { });
|
chrome.proxy.settings.set({ value: config, scope: "regular" }, function () { });
|
||||||
}
|
}
|
||||||
apply_proxy();
|
chrome.storage.onChanged.addListener(applyProxy);
|
||||||
chrome.storage.onChanged.addListener(apply_proxy);
|
applyProxy();
|
||||||
|
|
Loading…
Add table
Reference in a new issue