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-DY9Fn5xt.js"></script>
10
- <link rel="stylesheet" crossorigin href="/assets/index-B2A_rYZt.css">
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
- // Check if file is modified within 1 hour
102
- const stats = statSync(recentLog);
103
- const now = new Date();
104
- const diff = now - stats.mtime;
105
- const oneHour = 60 * 60 * 1000;
106
-
107
- if (diff < oneHour) {
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
- try {
136
- const stats = statSync(recentLog);
137
- const diff = Date.now() - stats.mtime.getTime();
138
- const oneHour = 60 * 60 * 1000;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-viewer",
3
- "version": "1.5.26",
3
+ "version": "1.5.28",
4
4
  "description": "Claude Code Logger visualization management tool",
5
5
  "license": "MIT",
6
6
  "main": "server.js",
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, `http://${req.headers.host}`);
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, `http://${req.headers.host}`).pathname;
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);