Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Commit

Permalink
Update 1.3.0 (Winreg instead exec SetProxy)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwldom committed Aug 11, 2024
1 parent 631b8ca commit 3b58f9b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
35 changes: 29 additions & 6 deletions connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const ipc = require('electron').ipcRenderer;
const { trackEvent } = require('@aptabase/electron/renderer');
const { spawn, exec } = require("child_process");
const { config } = require('process');
const Winreg = require('winreg');
// #endregion
//#region Functions
var childProcess = null;
Expand Down Expand Up @@ -143,6 +144,29 @@ async function testProxy() {
return false;
}
}

const setProxy = async (proxy) => {
const proxyKey = new Winreg({
hive: Winreg.HKCU,
key: '\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings'
});
proxyKey.set('ProxyEnable', Winreg.REG_DWORD, '1', (err) => {
if (err) console.log('Error setting ProxyEnable:', err);
});
proxyKey.set('ProxyServer', Winreg.REG_SZ, proxy, (err) => {
if (err) console.log('Error setting ProxyServer:', err);
});
};

const offProxy = async (proxy) => {
const proxyKey = new Winreg({
hive: Winreg.HKCU,
key: '\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings'
});
proxyKey.set('ProxyEnable', Winreg.REG_DWORD, '0', (err) => {
if (err) console.log('Error setting ProxyEnable:', err);
});
};
//#endregion
// #region Connection
function ConnectedVibe(stat = "normal") {
Expand Down Expand Up @@ -171,7 +195,7 @@ function disconnectVibe() {
exec("taskkill /IM " + "HiddifyCli.exe" + " /F");
}
//Disable the proxy settings
exec('reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /F');
offProxy(settingWarp["proxy"]);
//Remove the box shadow and animation from the vibe status element
sect == "main" ? SetAttr("changeStatus-vibe", "style", "box-shadow:;") : ("")
sect == "main" ? SetAttr("changeStatus-vibe", "style", "animation:;") : ("")
Expand All @@ -184,7 +208,7 @@ function disconnectVibe() {
exec("bash " + path.join(__dirname, "assets", "bash", "reset_proxy.sh"));
}
else {
exec('reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /F');
offProxy(settingWarp["proxy"]);
};
sect == "main" ? SetAnim("ChangeStatus", "Connect 5s") : ("");
setTimeout(() => {
Expand Down Expand Up @@ -247,7 +271,7 @@ async function connectVibe(num = number) {
exec("bash " + path.join(__dirname, "assets", "bash", "reset_proxy.sh"));
}
else {
exec('reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /F');
offProxy(settingWarp["proxy"]);
};
sect == "main" ? SetAnim("ChangeStatus", "Connect 7s infinite") : ("");
sect == "main" ? SetAnim("changeStatus-vibe", "changeStatus-vibe-animation 5s infinite") : ("");
Expand Down Expand Up @@ -321,8 +345,7 @@ async function connectWarp(num) {
exec("bash " + path.join(__dirname, "assets", "bash", "set_proxy.sh") + ` ${settingWarp["proxy"].replace(":", " ")}`);
}
else if (process.platform == "win32" & !settingWarp["tun"]) {
exec('reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /F');
exec(`reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyServer /t REG_SZ /d ${settingWarp["proxy"]} /F`);
setProxy(settingWarp["proxy"]);
}
StatusGuard = true;
await sleep(15000);
Expand Down Expand Up @@ -354,7 +377,7 @@ async function connectWarp(num) {
}
else {
exec("pkill warp-plus");
exec('reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /F');
offProxy(settingWarp["proxy"]);
};
sect == "main" ? SetAnim("ChangeStatus", "Connect 5s") : ("");
setTimeout(() => {
Expand Down
5 changes: 2 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,8 @@ <h2 id="Status" title="false"></h2>
<p> Developed By Fwldom 👩‍💻</p>
<p>👇 Acknowledgements 👇</p>
<p> <a href="https://github.com/hiddify/hiddify-core/">hiddify-core 2.1.5</a> from Hiddify</p>
<p> <a href="https://github.com/bepass-org/warp-plus">warp-plus 1.2.3</a> from bepass-org</p>
<p> <a href="https://www.sordum.org/7952/dns-jumper-v2-3/">Dns Jumper 2.3</a> from sordum</p>
<p> <a href="https://github.com/fwldom/Freedom-Guard">Freedom Browser 1.2</a> from fwldom</p>
<p> <a href="https://github.com/bepass-org/warp-plus">warp-plus 1.2.4</a> from bepass-org</p>
<p> <a href="https://github.com/fwldom/Freedom-Guard">Freedom Browser 1.3</a> from fwldom</p>
<p> <a href="https://github.com/Ptechgithub/warp">Scanner Endpoint 1.2</a> from Ptechgithub</p>
<p> email : <a href="mailto:fwldom@duck.com">fwldom@duck.com</a></p>
</div>
Expand Down
13 changes: 10 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
"bootstrap-icons": "^1.11.3",
"electron-google-analytics": "^1.0.2",
"geoip-lite": "^1.4.10",
"node-gyp": "^10.1.0"
"node-gyp": "^10.1.0",
"winreg": "^1.2.5"
},
"devDependencies": {
"electron": "^31.1.0",
Expand Down
4 changes: 2 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ h2 {
color: white;
display: none;
width: 75%;
height: 50%;
height: 75%;
left: 12.5%;
top: 25%;
top: 12.5%;
position: absolute;
justify-content: center;
align-items: center;
Expand Down

0 comments on commit 3b58f9b

Please sign in to comment.