Skip to content

Commit

Permalink
Update 1.3.0 Mahsa Version Level 4
Browse files Browse the repository at this point in the history
  • Loading branch information
fwldom committed Aug 25, 2024
1 parent 3b58f9b commit 5e68aa2
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 258 deletions.
87 changes: 57 additions & 30 deletions connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { spawn, exec } = require("child_process");
const { config } = require('process');
const Winreg = require('winreg');
// #endregion
//#region Functions
// #region Functions
var childProcess = null;
function KillProcess(core = "warp") {
if (childProcess != null) {
Expand Down Expand Up @@ -45,22 +45,39 @@ function Run(nameFile, args, runa, core) {
}
childProcess.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
if (data.toString().includes("serving proxy")) {
if (process.platform == "linux" && !settingWarp["tun"]) {
exec("bash " + path.join(__dirname, "assets", "bash", "set_proxy.sh") + ` ${settingWarp["proxy"].replace(":", " ")}`);
}
else if (process.platform == "win32" && !settingWarp["tun"]) {
console.log("set proxy");
setProxy(settingWarp["proxy"]);
}
}
});

childProcess.stderr.on('data', (data) => {
if (data instanceof Buffer) {
data = data.toString(); // Convert Buffer to string
}
console.error(`stderr: ${data}`);
if (data.toString().includes("serving proxy")) {
if (process.platform == "linux" && !settingWarp["tun"]) {
exec("bash " + path.join(__dirname, "assets", "bash", "set_proxy.sh") + ` ${settingWarp["proxy"].replace(":", " ")}`);
}
else if (process.platform == "win32" && !settingWarp["tun"]) {
console.log("set proxy");
setProxy(settingWarp["proxy"]);
}
}
});

childProcess.on('close', (code) => {
console.log(`child process exited with code ${code}`);
if (StatusGuard || settingVibe["status"]) {
sect == "main" ? disconnectVibe(mode = "try") : disconnectVPN();
sect == "main" ? connectAuto(number + 1) : disconnectVPN("");
}
else {
sect == "main" ? connectAuto(number + 1) : disconnectVPN("");
sect == "main" ? disconnectVibe(mode = "try") : disconnectVPN();
}
});
};
Expand Down Expand Up @@ -146,6 +163,7 @@ async function testProxy() {
}

const setProxy = async (proxy) => {
console.log("Set proxy")
const proxyKey = new Winreg({
hive: Winreg.HKCU,
key: '\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings'
Expand Down Expand Up @@ -187,7 +205,6 @@ function disconnectVibe() {
//Kill the HiddifyCli.exe process
KillProcess(core = "warp");
KillProcess(core = "vibe");

if (process.platform == "linux") {
exec("pkill HiddifyCli");
}
Expand Down Expand Up @@ -230,7 +247,7 @@ async function connectAuto(num = 0) {
if (links["MCI"].lenght <= num) { disconnectVibe(); return true };
const configType = links["MCI"][num].split(",")[0];
if (configType == "warp") {
settingWarp[links["MCI"][num].split(",")[1]] = true;
settingWarp[links["MCI"][num].split(",")[1]] = links["MCI"][num].split(",")[2] == "true" ? true : links["MCI"][num].split(",")[2];
} else if (configType == "vibe") {
settingVibe["config"] = links["MCI"][num].split(",")[1];
}
Expand All @@ -242,7 +259,7 @@ async function connectAuto(num = 0) {
if (links["IRANCELL"].lenght <= num) { disconnectVibe(); return true };
const configType = links["IRANCELL"][num].split(",")[0];
if (configType == "warp") {
settingWarp[links["IRANCELL"][num].split(",")[1]] = true;
settingWarp[links["IRANCELL"][num].split(",")[1]] = links["IRANCELL"][num].split(",")[2] == "true" ? true : links["IRANCELL"][num].split(",")[2];
} else if (configType == "vibe") {
settingVibe["config"] = links["IRANCELL"][num].split(",")[1];
}
Expand All @@ -254,7 +271,7 @@ async function connectAuto(num = 0) {
if (links["other"].lenght <= num) { disconnectVibe(); return true };
const configType = links["other"][num].split(",")[0];
if (configType == "warp") {
settingWarp[links["other"][num].split(",")[1]] = true;
settingWarp[links["other"][num].split(",")[1]] = links["other"][num].split(",")[2] == "true" ? true : links["other"][num].split(",")[2];
} else if (configType == "vibe") {
settingVibe["config"] = links["other"][num].split(",")[1];
}
Expand Down Expand Up @@ -341,32 +358,30 @@ async function connectWarp(num) {
// Start warp plus
Run("warp-plus.exe", argsWarp, (settingWarp["tun"]) ? "admin" : "user", "warp");
// Set System Proxy
if (process.platform == "linux" & !settingWarp["tun"]) {
exec("bash " + path.join(__dirname, "assets", "bash", "set_proxy.sh") + ` ${settingWarp["proxy"].replace(":", " ")}`);
}
else if (process.platform == "win32" & !settingWarp["tun"]) {
setProxy(settingWarp["proxy"]);
}
StatusGuard = true;
await sleep(15000);
testProxy();
StatusGuard = true;
await sleep(10000);
if (await testProxy() == true) {
Showmess(5000, "Connected Warp");
trackEvent("connected-warp");
sect == "main" ? SetAnim("ChangeStatus", "Load") : ("");
sect == "main" ? SetBorderColor("ChangeStatus", "#15ff00") : ("");
return true;
}
else {
console.log("try again");
if (StatusGuard == true) {
Onloading();
if (settingWarp["core"] == "auto") {
connectAuto(num + 1);
connectAuto(number + 1);
} else {
FindBestEndpointWarp("conn");
Showmess(5000, "Finding Endpoint Warp ...")
}
}
else {
console.log("failed");
disconnectVibe()
}
}
} else {
KillProcess(core = "warp");
Expand All @@ -382,8 +397,8 @@ async function connectWarp(num) {
sect == "main" ? SetAnim("ChangeStatus", "Connect 5s") : ("");
setTimeout(() => {
sect == "main" ? SetAnim("ChangeStatus", "") : ("");
StatusGuard = false;
}, 3500);
StatusGuard = false;
disconnectVibe()
}
};
Expand Down Expand Up @@ -415,8 +430,11 @@ setInterval(() => {
}, 5000);
async function saveSetting() {
// Save setting vibe & setting warp In vibe.json & warp.json
write_file("vibe.json", JSON.stringify(settingVibe));
write_file("warp.json", JSON.stringify(settingWarp));
try {
write_file("vibe.json", JSON.stringify(settingVibe));
write_file("warp.json", JSON.stringify(settingWarp));
}
catch {};
ResetArgsVibe();
ResetArgsWarp();
};
Expand Down Expand Up @@ -538,18 +556,25 @@ var links = {
lenght: 6
},
IRANCELL: {
0: "warp,--endpoint=1.1.1.1",
1: "warp,gool",
2: "warp,scan",
lenght: 3
0: "warp,auto,true",
1: "warp,gool,true",
2: "vibe,https://raw.githubusercontent.com/yebekhe/TVC/main/subscriptions/xray/normal/mix",
3: "warp,endpoint,engage.cloudflareclient.com:2408",
4: "vibe,https://raw.githubusercontent.com/AzadNetCH/Clash/main/AzadNet_META_IRAN-Direct.yml",
5: "warp,scan,true",
6: "vibe,https://raw.githubusercontent.com/ircfspace/warpsub/main/export/warp",
7: "warp,reserved,true",
lenght: 8
},
other: {
0: "warp,auto",
1: "warp,gool",
1: "warp,endpoint,engage.cloudflareclient.com:2408",
2: "vibe,https://raw.githubusercontent.com/yebekhe/TVC/main/subscriptions/xray/normal/mix",
3: "vibe,https://raw.githubusercontent.com/AzadNetCH/Clash/main/AzadNet_META_IRAN-Direct.yml",
4: "vibe,https://raw.githubusercontent.com/ircfspace/warpsub/main/export/warp",
lenght: 5
3: "warp,gool,true",
4: "warp,reserved,true",
5: "vibe,https://raw.githubusercontent.com/AzadNetCH/Clash/main/AzadNet_META_IRAN-Direct.yml",
6: "vibe,https://raw.githubusercontent.com/ircfspace/warpsub/main/export/warp",
lenght: 7
}
}
//#endregion
Expand Down Expand Up @@ -594,5 +619,7 @@ module.exports = {
changeISP,
connect,
ConnectedVibe,
FindBestEndpointWarp
FindBestEndpointWarp,
setProxy,
offProxy
};
3 changes: 0 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Freedom Guard (Mahsa Version) 1.3.0 </title>
<link href="boxicons.min.css" rel="stylesheet" />
<link href="./assets/css/bootstrap.min.css" rel="stylesheet" />
<link href="./assets/css/vazir.css" rel="stylesheet" />
<link href="./assets/css/style.css" rel="stylesheet" />
<link rel="stylesheet" href="style.css" />
<link rel="icon" href="ico.png" type="image/png">
<!-- #endregion Head -->
Expand Down
164 changes: 0 additions & 164 deletions main/core.js

This file was deleted.

2 changes: 1 addition & 1 deletion main/cores/scanner/bestendpoint.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
162.159.192.214:2408
162.159.192.211:894
Loading

0 comments on commit 5e68aa2

Please sign in to comment.