Skip to content

Commit

Permalink
Release 0.4.2 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
aceberg committed Sep 15, 2024
1 parent cf709b3 commit 813277e
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 17 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/background/proxy-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""});
}
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
39 changes: 25 additions & 14 deletions src/options/options-servers.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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) {
Expand All @@ -46,7 +47,7 @@ selectMain.addEventListener("change", () => {

mainServer = proxyServers[i];
saveMainServer(mainServer);
displaySelect();
displaySelect(proxyServers);
});

// Listen to Delete button click
Expand All @@ -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);
Expand All @@ -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;
};
Expand All @@ -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;
Expand All @@ -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}`;
Expand Down
6 changes: 5 additions & 1 deletion src/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<details>
<summary>About</summary>
<ul>
<li>Version: 0.4.1</li>
<li>Version: 0.4.2</li>
<li>License: MIT</li>
<li><a target="_blank" href="https://github.com/aceberg/WormholeProxy">https://github.com/aceberg/WormholeProxy</a></li>
</ul>
Expand Down Expand Up @@ -175,6 +175,10 @@
<option value="true">true</option>
<option value="false">false</option>
</select>
<label for="username">Username</label>
<input name="username" placeholder="Username (Only for socks type)">
<label for="password">Password</label>
<input name="password" placeholder="Password (Only for socks type)">
<div class="input-group">
<button type="submit" class="btn">Save</button>
<span style="width: 100%"></span>
Expand Down

0 comments on commit 813277e

Please sign in to comment.