claude-opencode-viewer 2.6.21 → 2.6.23
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/package.json +1 -1
- package/server.js +4 -17
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -16,7 +16,7 @@ process.title = 'claude-opencode-viewer';
|
|
|
16
16
|
|
|
17
17
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
18
|
const IS_PC = process.argv.includes('--pc');
|
|
19
|
-
|
|
19
|
+
const PORT = parseInt(process.argv[2]) || 7008;
|
|
20
20
|
const USE_HTTPS = process.argv.includes('--https');
|
|
21
21
|
const JSON_OUTPUT = process.argv.includes('--json');
|
|
22
22
|
|
|
@@ -948,12 +948,7 @@ function cleanupAndExit() {
|
|
|
948
948
|
process.on('SIGINT', cleanupAndExit);
|
|
949
949
|
process.on('SIGTERM', cleanupAndExit);
|
|
950
950
|
|
|
951
|
-
|
|
952
|
-
const PORT_MIN = IS_PC ? 19200 : 7008;
|
|
953
|
-
const PORT_MAX = IS_PC ? 19220 : 7028;
|
|
954
|
-
const MAX_PORT_RETRIES = 20;
|
|
955
|
-
|
|
956
|
-
function startServer(retries = 0) {
|
|
951
|
+
function startServer() {
|
|
957
952
|
server.listen(PORT, '0.0.0.0', async () => {
|
|
958
953
|
const ip = getLocalIp();
|
|
959
954
|
const proto = USE_HTTPS ? 'https' : 'http';
|
|
@@ -991,16 +986,8 @@ function startServer(retries = 0) {
|
|
|
991
986
|
});
|
|
992
987
|
|
|
993
988
|
server.on('error', (err) => {
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
PORT = PORT >= PORT_MAX ? PORT_MIN : PORT + 1;
|
|
997
|
-
console.error(`[port] ${oldPort} 已占用,尝试 ${PORT} (${retries + 1}/${MAX_PORT_RETRIES})`);
|
|
998
|
-
createServerAndWss();
|
|
999
|
-
startServer(retries + 1);
|
|
1000
|
-
} else {
|
|
1001
|
-
console.error(`启动失败: ${err.message}`);
|
|
1002
|
-
process.exit(1);
|
|
1003
|
-
}
|
|
989
|
+
console.error(`启动失败: ${err.message}`);
|
|
990
|
+
process.exit(1);
|
|
1004
991
|
});
|
|
1005
992
|
}
|
|
1006
993
|
|