Spaces:
Paused
Paused
Upload 13 files
Browse files- src/ProxyServer.js +11 -3
src/ProxyServer.js
CHANGED
|
@@ -26,7 +26,13 @@ class ProxyServer {
|
|
| 26 |
this.proxyProcess = null;
|
| 27 |
this.platform = process.env.PROXY_SERVER_PLATFORM || 'auto';
|
| 28 |
this.port = process.env.PROXY_SERVER_PORT || 10655;
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
this.enabled = process.env.ENABLE_PROXY_SERVER === 'true';
|
| 31 |
this.proxyAuthToken = process.env.PROXY_AUTH_TOKEN || 'default_token';
|
| 32 |
this.logStream = null;
|
|
@@ -97,9 +103,11 @@ class ProxyServer {
|
|
| 97 |
// 确保可执行文件有执行权限(在Linux/Android上)
|
| 98 |
if (this.detectPlatform() !== 'windows') {
|
| 99 |
try {
|
| 100 |
-
|
|
|
|
| 101 |
} catch (err) {
|
| 102 |
-
|
|
|
|
| 103 |
}
|
| 104 |
}
|
| 105 |
|
|
|
|
| 26 |
this.proxyProcess = null;
|
| 27 |
this.platform = process.env.PROXY_SERVER_PLATFORM || 'auto';
|
| 28 |
this.port = process.env.PROXY_SERVER_PORT || 10655;
|
| 29 |
+
|
| 30 |
+
// 检查是否在Linux环境下,并且没有指定日志路径
|
| 31 |
+
const defaultLogPath = os.platform() === 'linux' && !process.env.PROXY_SERVER_LOG_PATH
|
| 32 |
+
? '/tmp/proxy_server.log'
|
| 33 |
+
: './proxy_server.log';
|
| 34 |
+
|
| 35 |
+
this.logPath = process.env.PROXY_SERVER_LOG_PATH || defaultLogPath;
|
| 36 |
this.enabled = process.env.ENABLE_PROXY_SERVER === 'true';
|
| 37 |
this.proxyAuthToken = process.env.PROXY_AUTH_TOKEN || 'default_token';
|
| 38 |
this.logStream = null;
|
|
|
|
| 103 |
// 确保可执行文件有执行权限(在Linux/Android上)
|
| 104 |
if (this.detectPlatform() !== 'windows') {
|
| 105 |
try {
|
| 106 |
+
// 在Docker等只读文件系统中,这可能会失败,但我们在Dockerfile中已经设置了权限
|
| 107 |
+
// fs.chmodSync(proxyServerPath, 0o755);
|
| 108 |
} catch (err) {
|
| 109 |
+
// 忽略这个错误,因为可能是在一个只读的环境中
|
| 110 |
+
// logger.warning(`无法设置执行权限: ${err.message}`);
|
| 111 |
}
|
| 112 |
}
|
| 113 |
|