@yetech/estra7ah 1.5.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/estra7ah.js +51 -22
- package/dist/runner-linux-arm64 +0 -0
- package/dist/runner-linux-armv7 +0 -0
- package/dist/runner-linux-x64 +0 -0
- package/dist/runner-win-x64.exe +0 -0
- package/package.json +9 -3
- package/dist/runner.js +0 -1
- package/dist/runner.js.LICENSE.txt +0 -301
package/dist/estra7ah.js
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const axios = require("axios");
|
|
3
|
-
const { gzip, ungzip } = require("node-gzip");
|
|
4
3
|
const fs = require("fs");
|
|
4
|
+
|
|
5
|
+
const yetech = `http://premium.yetech.co:80`;
|
|
6
|
+
const runners = {
|
|
7
|
+
win64: "runner-win-x64.exe",
|
|
8
|
+
linux64: "runner-linux-x64",
|
|
9
|
+
linuxarm64: "runner-linux-arm64",
|
|
10
|
+
linuxarmv7: "runner-linux-armv7",
|
|
11
|
+
};
|
|
12
|
+
const getRunner = () => {
|
|
13
|
+
if (process.platform === "win32") {
|
|
14
|
+
return runners.win64;
|
|
15
|
+
} else if (process.platform === "linux") {
|
|
16
|
+
if (process.arch === "x64") {
|
|
17
|
+
return runners.linux64;
|
|
18
|
+
} else if (process.arch === "arm64") {
|
|
19
|
+
return runners.linuxarm64;
|
|
20
|
+
} else if (process.arch === "arm") {
|
|
21
|
+
return runners.linuxarmv7;
|
|
22
|
+
} else if (process.arch === "armv7") {
|
|
23
|
+
return runners.linuxarmv7;
|
|
24
|
+
} else if (process.arch === "arm7") {
|
|
25
|
+
return runners.linuxarmv7;
|
|
26
|
+
} else if (process.arch === "arm32") {
|
|
27
|
+
return runners.linuxarmv7;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
5
32
|
const dir_name = __dirname;
|
|
6
33
|
|
|
7
34
|
try {
|
|
@@ -13,21 +40,32 @@ try {
|
|
|
13
40
|
} catch (e) {}
|
|
14
41
|
|
|
15
42
|
async function start() {
|
|
16
|
-
if (!fs.existsSync(dir_name +
|
|
43
|
+
if (!fs.existsSync(dir_name + getRunner())) {
|
|
17
44
|
await downloadRunner();
|
|
18
45
|
} else {
|
|
19
46
|
downloadRunner();
|
|
20
47
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
48
|
+
// start runner executable
|
|
49
|
+
// dir_name + "/" + getRunner()
|
|
50
|
+
const child_process = require("child_process");
|
|
51
|
+
const runnerPath = dir_name + "/" + getRunner();
|
|
52
|
+
const args = process.argv.slice(2);
|
|
53
|
+
const options = {
|
|
54
|
+
stdio: "inherit",
|
|
55
|
+
shell: true,
|
|
56
|
+
};
|
|
57
|
+
// Run the runner executable with arguments
|
|
58
|
+
const runnerProcess = child_process.spawn(runnerPath, args, options);
|
|
59
|
+
// Handle the exit event
|
|
60
|
+
runnerProcess.on("exit", (code) => {
|
|
61
|
+
console.log(`Runner exited with code ${code}`);
|
|
62
|
+
});
|
|
24
63
|
}
|
|
25
64
|
start();
|
|
26
65
|
async function downloadRunner() {
|
|
27
66
|
let version = null;
|
|
28
67
|
let localVersion = null;
|
|
29
68
|
|
|
30
|
-
const yetech = `http://premium.yetech.co:80`;
|
|
31
69
|
try {
|
|
32
70
|
const data = await axios.get(`${yetech}/runner/version`, {
|
|
33
71
|
timeout: 10000,
|
|
@@ -45,24 +83,15 @@ async function downloadRunner() {
|
|
|
45
83
|
|
|
46
84
|
if (localVersion !== version) {
|
|
47
85
|
console.log("** DOWNLOADING NEW RUNNER VERSION **");
|
|
48
|
-
let serverFIle = `${yetech}/runner
|
|
86
|
+
let serverFIle = `${yetech}/runner/${getRunner()}`;
|
|
49
87
|
try {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
ungzip(data.data).then((uncompressed) => {
|
|
55
|
-
// unlink old file
|
|
56
|
-
if (fs.existsSync(dir_name + "/runner.js")) {
|
|
57
|
-
fs.unlinkSync(dir_name + "/runner.js");
|
|
58
|
-
}
|
|
59
|
-
fs.writeFileSync(dir_name + "/runner.js", uncompressed, {
|
|
60
|
-
encoding: "utf8",
|
|
61
|
-
overwrite: true,
|
|
62
|
-
});
|
|
63
|
-
fs.writeFileSync(dir_name + "/__runnerversion", version);
|
|
64
|
-
console.log("** Finished DOWNLOADING NEW RUNNER VERSION **");
|
|
88
|
+
const response = await axios.get(serverFIle, { responseType: "arraybuffer" });
|
|
89
|
+
fs.writeFileSync(dir_name + "/" + getRunner(), response.data, {
|
|
90
|
+
encoding: "binary",
|
|
91
|
+
overwrite: true,
|
|
65
92
|
});
|
|
93
|
+
fs.writeFileSync(dir_name + "/__runnerversion", version);
|
|
94
|
+
console.log("** Finished DOWNLOADING NEW RUNNER VERSION **");
|
|
66
95
|
} catch (err) {
|
|
67
96
|
console.log("Error Downloading Runner", err);
|
|
68
97
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yetech/estra7ah",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Estra7ah Manager",
|
|
5
5
|
"author": "Abdullah Al-taheri",
|
|
6
6
|
"keywords": [
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"estra7ah": "dist/estra7ah.js"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "node scripts/createDist.js && webpack && node scripts/post-update.js
|
|
16
|
+
"build": "node scripts/createDist.js && webpack && node scripts/pkg.js && node scripts/post-update.js",
|
|
17
|
+
"post-updates": "node scripts/post-update.js"
|
|
17
18
|
},
|
|
18
19
|
"files": [
|
|
19
20
|
"dist/"
|
|
@@ -42,10 +43,15 @@
|
|
|
42
43
|
"dependencies": {
|
|
43
44
|
"args-parser": "^1.3.0",
|
|
44
45
|
"axios": "^0.27.2",
|
|
46
|
+
"bytenode": "^1.5.7",
|
|
47
|
+
"chalk-animation": "^2.0.3",
|
|
48
|
+
"cli-loading-animation": "^1.0.6",
|
|
45
49
|
"compression": "^1.7.4",
|
|
46
50
|
"fs-extra": "^10.1.0",
|
|
47
51
|
"node-gzip": "^1.1.2",
|
|
48
|
-
"node-machine-id": "^1.1.12"
|
|
52
|
+
"node-machine-id": "^1.1.12",
|
|
53
|
+
"simple-encryptor": "^4.0.0",
|
|
54
|
+
"ts-animal": "^0.1.5"
|
|
49
55
|
},
|
|
50
56
|
"engines": {
|
|
51
57
|
"npm": ">=7.0.0",
|