cc-viewer 1.5.26 → 1.5.28
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/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<title>Claude Code Viewer</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico?v=1">
|
|
8
8
|
<link rel="shortcut icon" href="/favicon.ico?v=1">
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-DPzshNpv.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BKHAUnpN.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
package/interceptor.js
CHANGED
|
@@ -98,22 +98,14 @@ const _initPromise = (async () => {
|
|
|
98
98
|
try {
|
|
99
99
|
const recentLog = findRecentLog(_logDir, _projectName);
|
|
100
100
|
if (recentLog) {
|
|
101
|
-
//
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const tempFile = _newLogFile.replace('.jsonl', '_temp.jsonl');
|
|
110
|
-
LOG_FILE = tempFile;
|
|
111
|
-
_resumeState = {
|
|
112
|
-
recentFile: recentLog,
|
|
113
|
-
recentFileName: basename(recentLog),
|
|
114
|
-
tempFile,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
101
|
+
// 始终复用最新日志文件
|
|
102
|
+
const tempFile = _newLogFile.replace('.jsonl', '_temp.jsonl');
|
|
103
|
+
LOG_FILE = tempFile;
|
|
104
|
+
_resumeState = {
|
|
105
|
+
recentFile: recentLog,
|
|
106
|
+
recentFileName: basename(recentLog),
|
|
107
|
+
tempFile,
|
|
108
|
+
};
|
|
117
109
|
}
|
|
118
110
|
} catch { }
|
|
119
111
|
})();
|
|
@@ -129,20 +121,13 @@ export function initForWorkspace(projectPath) {
|
|
|
129
121
|
|
|
130
122
|
cleanupTempFiles(dir, projectName);
|
|
131
123
|
|
|
132
|
-
//
|
|
124
|
+
// 检查是否有最近的日志文件可以复用(始终复用最新日志)
|
|
133
125
|
const recentLog = findRecentLog(dir, projectName);
|
|
134
126
|
if (recentLog) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (diff < oneHour) {
|
|
140
|
-
_projectName = projectName;
|
|
141
|
-
_logDir = dir;
|
|
142
|
-
LOG_FILE = recentLog;
|
|
143
|
-
return { filePath: recentLog, dir, projectName, resumed: true };
|
|
144
|
-
}
|
|
145
|
-
} catch {}
|
|
127
|
+
_projectName = projectName;
|
|
128
|
+
_logDir = dir;
|
|
129
|
+
LOG_FILE = recentLog;
|
|
130
|
+
return { filePath: recentLog, dir, projectName, resumed: true };
|
|
146
131
|
}
|
|
147
132
|
|
|
148
133
|
// 没有最近日志,创建新文件
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -366,7 +366,7 @@ function getLocalIp() {
|
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
async function handleRequest(req, res) {
|
|
369
|
-
const parsedUrl = new URL(req.url,
|
|
369
|
+
const parsedUrl = new URL(req.url, `${serverProtocol}://${req.headers.host}`);
|
|
370
370
|
const url = parsedUrl.pathname;
|
|
371
371
|
const method = req.method;
|
|
372
372
|
|
|
@@ -2015,7 +2015,7 @@ async function setupTerminalWebSocket(httpServer) {
|
|
|
2015
2015
|
|
|
2016
2016
|
|
|
2017
2017
|
httpServer.on('upgrade', (req, socket, head) => {
|
|
2018
|
-
const pathname = new URL(req.url,
|
|
2018
|
+
const pathname = new URL(req.url, `${serverProtocol}://${req.headers.host}`).pathname;
|
|
2019
2019
|
if (pathname === '/ws/terminal') {
|
|
2020
2020
|
wss.handleUpgrade(req, socket, head, (ws) => {
|
|
2021
2021
|
wss.emit('connection', ws, req);
|