proxy-kaze 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/pro.js +29 -21
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "proxy-kaze",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "pro.js",
5
5
  "bin": {
6
6
  "sockproxy": "./pro.js"
7
7
  }
8
- }
8
+ }
package/pro.js CHANGED
@@ -39,37 +39,50 @@ const FULL_PROXY = `socks5://${USER}:${PASS}@bore.pub:${B_PORT}`;
39
39
 
40
40
  // ---------- installers ----------
41
41
  function installTermux() {
42
- console.log("Detected Termux environment...");
42
+ console.log("Detected Termux...");
43
43
 
44
- if (!hasCmd('tmux') || !hasCmd('bore') || !hasCmd('gost')) {
44
+ if (!hasCmd('bore') || !hasCmd('gost')) {
45
45
  execSync(
46
- "pkg update -y && pkg install nodejs-lts bore tmux termux-api gost -y",
46
+ "pkg update -y && pkg install nodejs-lts bore gost -y",
47
47
  { stdio: 'inherit' }
48
48
  );
49
49
  }
50
50
  }
51
51
 
52
- function installLinux(pkg) {
53
- console.log(`Using ${pkg} to install dependencies...`);
52
+ function installLinux() {
53
+ console.log("Installing dependencies (Linux)...");
54
54
 
55
+ // ensure curl exists
55
56
  if (!hasCmd('curl')) {
56
- if (pkg === 'apt') execSync('sudo apt install -y curl', { stdio: 'inherit' });
57
+ const pkg = detectPkgManager();
58
+ if (!pkg) {
59
+ console.log("No supported package manager found for curl.");
60
+ process.exit(1);
61
+ }
62
+
63
+ if (pkg === 'apt') execSync('sudo apt update && sudo apt install -y curl', { stdio: 'inherit' });
57
64
  if (pkg === 'pacman') execSync('sudo pacman -Sy curl', { stdio: 'inherit' });
58
65
  if (pkg === 'dnf') execSync('sudo dnf install -y curl', { stdio: 'inherit' });
59
66
  }
60
67
 
68
+ // install bore
61
69
  if (!hasCmd('bore')) {
62
- execSync(
63
- 'curl -L https://github.com/ekzhang/bore/releases/latest/download/bore-linux-amd64 -o bore && chmod +x bore && sudo mv bore /usr/local/bin/',
64
- { stdio: 'inherit' }
65
- );
70
+ console.log("Installing bore...");
71
+ execSync(`
72
+ curl -L https://github.com/ekzhang/bore/releases/latest/download/bore-linux-amd64 -o bore &&
73
+ chmod +x bore &&
74
+ sudo mv bore /usr/local/bin/
75
+ `, { stdio: 'inherit' });
66
76
  }
67
77
 
78
+ // install gost
68
79
  if (!hasCmd('gost')) {
69
- execSync(
70
- 'curl -L https://github.com/go-gost/gost/releases/latest/download/gost-linux-amd64 -o gost && chmod +x gost && sudo mv gost /usr/local/bin/',
71
- { stdio: 'inherit' }
72
- );
80
+ console.log("Installing gost...");
81
+ execSync(`
82
+ curl -L https://github.com/go-gost/gost/releases/latest/download/gost-linux-amd64 -o gost &&
83
+ chmod +x gost &&
84
+ sudo mv gost /usr/local/bin/
85
+ `, { stdio: 'inherit' });
73
86
  }
74
87
  }
75
88
 
@@ -77,7 +90,7 @@ function installWindows() {
77
90
  console.log("Detected Windows...");
78
91
 
79
92
  if (!hasCmd('winget')) {
80
- console.log("Winget not found. Install 'App Installer' from Microsoft Store.");
93
+ console.log("Winget not found. Install App Installer from Microsoft Store.");
81
94
  process.exit(1);
82
95
  }
83
96
 
@@ -96,12 +109,7 @@ function installDeps() {
96
109
  installTermux();
97
110
 
98
111
  } else if (PLATFORM === 'linux') {
99
- const pkg = detectPkgManager();
100
- if (!pkg) {
101
- console.log("No supported package manager found.");
102
- process.exit(1);
103
- }
104
- installLinux(pkg);
112
+ installLinux();
105
113
 
106
114
  } else if (PLATFORM === 'win32') {
107
115
  installWindows();