xfuture 1.9.4 → 1.9.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  let os = require("os");
2
- const { spawn } = require('child_process')
2
+ const { spawn, spawnSync } = require('child_process')
3
3
  var isMac = false;
4
4
  const parser = require('./parser');
5
5
  const fs = require('fs');
@@ -28,13 +28,8 @@ class xFuture {
28
28
 
29
29
  }
30
30
 
31
- SetTunModeEnable(enable, workingDir){
31
+ SetTunModeEnable(enable){
32
32
  this.isTunMode = enable;
33
- this.workingDir = workingDir;
34
- }
35
-
36
- SetWorkingDir(workingDir){
37
- this.workingDir = workingDir
38
33
  }
39
34
 
40
35
  StartTunnel(url){
@@ -67,8 +62,15 @@ class xFuture {
67
62
  }
68
63
 
69
64
  stopTunnelPrivate() {
70
- var driver = this.workingDir + "\\mao-dou-xray-vpn-driver.exe";
71
- spawn(driver, ["kill"]);
65
+ try {
66
+ var driver = this.workingDir + "\\mao-dou-xray-vpn-driver.exe";
67
+ spawnSync(driver, ["kill"]);
68
+ console.log("Driver killed");
69
+ }
70
+ catch (error) {
71
+ console.error('Error executing command:', error);
72
+ }
73
+
72
74
  }
73
75
 
74
76
  StopTunnel(){
@@ -109,16 +111,17 @@ class xFuture {
109
111
  }
110
112
  }
111
113
 
112
- SetGlobalMode(isGlobalMode, ipdir){
113
- console.log("isGlobalMode:", isGlobalMode, " dir:", ipdir);
114
- parser.workingDir = ipdir;
114
+ SetGlobalMode(isGlobalMode){
115
+ console.log("isGlobalMode:", isGlobalMode);
115
116
  parser.isGlobalMode = isGlobalMode;
116
117
  }
117
118
 
118
119
  // 1. Mac 请传 install_helper.sh 和 xfuture_helper 的绝对路径
119
120
  // 2. Windows 请传 "maodou" 固定字符串 和 sysproxy.exe 的绝对路径
120
- InstallDriver(shell_path, helper_path){
121
+ InstallDriver(shell_path, helper_path, workingDir){
121
122
  this.driver = helper_path;
123
+ this.workingDir = workingDir;
124
+ parser.workingDir = workingDir;
122
125
  }
123
126
 
124
127
  GetCurrentStatus(){
package/index.js CHANGED
@@ -26,14 +26,10 @@ class xFuture {
26
26
  ff.SetPassword(password);
27
27
  }
28
28
 
29
- SetTunModeEnable(enable, workingDir){
29
+ SetTunModeEnable(enable){
30
30
  this.isTunMode = enable;
31
31
  parser.isTunMode = enable;
32
- ff.SetTunModeEnable(enable, workingDir);
33
- }
34
-
35
- SetWorkingDir(workingDir){
36
- this.workingDir = workingDir
32
+ ff.SetTunModeEnable(enable, this.workingDir);
37
33
  }
38
34
 
39
35
  StartTunnel(url){
@@ -90,17 +86,18 @@ class xFuture {
90
86
  ff.StopProxy();
91
87
  }
92
88
 
93
- SetGlobalMode(isGlobalMode, ipdir){
89
+ SetGlobalMode(isGlobalMode){
94
90
  console.log("isGlobalMode:", isGlobalMode, " dir:", ipdir);
95
- parser.workingDir = ipdir;
96
91
  parser.isGlobalMode = isGlobalMode;
97
- ff.SetGlobalMode(isGlobalMode, ipdir);
92
+ ff.SetGlobalMode(isGlobalMode, this.workingDir);
98
93
  }
99
94
 
100
95
  // 1. Mac 请传 install_helper.sh 和 xfuture_helper 的绝对路径
101
96
  // 2. Windows 请传 "maodou" 固定字符串 和 sysproxy.exe 的绝对路径
102
- InstallDriver(shell_path, helper_path){
97
+ InstallDriver(shell_path, helper_path, workingDir){
103
98
  this.driver = helper_path;
99
+ this.workingDir = workingDir;
100
+ parser.workingDir = ipdir;
104
101
  return ff.InstallDriver(shell_path, helper_path);
105
102
  }
106
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xfuture",
3
- "version": "1.9.4",
3
+ "version": "1.9.6",
4
4
  "description": "electron vpn sdk",
5
5
  "main": "x.js",
6
6
  "scripts": {