From 813277e1c4f0a514c410bdc488aac853c1b7c390 Mon Sep 17 00:00:00 2001 From: aceberg <1502200+aceberg@users.noreply.github.com> Date: Mon, 16 Sep 2024 04:01:21 +0700 Subject: [PATCH] Release 0.4.2 (#1) --- CHANGELOG.md | 7 ++++++ src/background/proxy-handler.js | 2 +- src/manifest.json | 2 +- src/options/options-servers.js | 39 +++++++++++++++++++++------------ src/options/options.html | 6 ++++- 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5b5887..ee20f0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ # Change Log All notable changes to this project will be documented in this file. +## [0.4.2] - 2024-09-16 +### Added +- Username and Password for Socks proxy + +### Fixed +- Display Select bug + ## [0.4.1] - 2024-09-09 ### Added - Proxy DNS option diff --git a/src/background/proxy-handler.js b/src/background/proxy-handler.js index 6220a94..00a1abc 100644 --- a/src/background/proxy-handler.js +++ b/src/background/proxy-handler.js @@ -57,7 +57,7 @@ function handleProxyRequest(requestInfo) { browser.browserAction.setBadgeText({text: mainServer.name}); console.log(`Proxying: ${url.hostname} through ${mainServer.name}`); - return {type: mainServer.type, host: mainServer.host, port: mainServer.port, proxyDNS: mainServer.proxyDNS}; // proxy.ProxyInfo + return {type: mainServer.type, host: mainServer.host, port: mainServer.port, proxyDNS: mainServer.proxyDNS, username: mainServer.username, password: mainServer.password}; // proxy.ProxyInfo } else { browser.browserAction.setBadgeText({text: ""}); } diff --git a/src/manifest.json b/src/manifest.json index 3349bf8..8825979 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -3,7 +3,7 @@ "name": "Wormhole Proxy", "description": "Single-list proxy manager", "homepage_url": "https://github.com/aceberg/WormholeProxy", - "version": "0.4.1", + "version": "0.4.2", "icons": { "512": "icons/wormhole0.png" diff --git a/src/options/options-servers.js b/src/options/options-servers.js index cd9c85f..74ea1ce 100644 --- a/src/options/options-servers.js +++ b/src/options/options-servers.js @@ -1,12 +1,21 @@ let proxyServers = []; let mainServer = {}; -// Get local proxyServers +// Get proxyServers from Sync browser.storage.sync.get(data => { if (data.proxyServers) { proxyServers = data.proxyServers; } + // Get mainServer from Local storage + browser.storage.local.get(data => { + if (data.mainServer) { + mainServer = data.mainServer; + } + + displaySelect(proxyServers); + }); + displayProxyServers(); // Listen to click on edit button @@ -21,14 +30,6 @@ browser.storage.sync.get(data => { } }); -browser.storage.local.get(data => { - if (data.mainServer) { - mainServer = data.mainServer; - } - - displaySelect(); -}); - // Listen for changes in local storage browser.storage.sync.onChanged.addListener(changeData => { if (changeData.proxyServers) { @@ -46,7 +47,7 @@ selectMain.addEventListener("change", () => { mainServer = proxyServers[i]; saveMainServer(mainServer); - displaySelect(); + displaySelect(proxyServers); }); // Listen to Delete button click @@ -73,6 +74,13 @@ form1.addEventListener("submit", (event) => { oneServer.host = formData1.get('host'); oneServer.port = formData1.get('port'); oneServer.proxyDNS = JSON.parse(formData1.get('dns')); + oneServer.username = formData1.get('username'); + oneServer.password = formData1.get('password'); + + if (oneServer.username == "undefined") { + oneServer.username = ""; + oneServer.password = ""; + } if (i > -1) { proxyServers.splice(i, 1); @@ -95,6 +103,8 @@ function fillForm(index) { form2.elements['host'].value = pr.host; form2.elements['port'].value = pr.port; form2.elements['dns'].value = pr.proxyDNS; + form2.elements['username'].value = pr.username; + form2.elements['password'].value = pr.password; document.getElementById("delForm").hidden = false; }; @@ -111,12 +121,13 @@ function saveProxyServers(proxyServers) { proxyServers: proxyServers }); - // Update page - location.reload(); + displaySelect(proxyServers); }; -function displaySelect() { +function displaySelect(pServers) { const select = document.getElementById('select-main'); + + // console.log("displaySelect:", pServers); let opt; let i = 0; @@ -136,7 +147,7 @@ function displaySelect() { } select.appendChild(opt); - for (let serv of proxyServers){ + for (let serv of pServers){ opt = document.createElement("option"); opt.textContent = `${serv.name}, ${serv.host}:${serv.port}`; diff --git a/src/options/options.html b/src/options/options.html index 442c9eb..05735c8 100644 --- a/src/options/options.html +++ b/src/options/options.html @@ -11,7 +11,7 @@
About @@ -175,6 +175,10 @@ + + + +