cc-viewer 1.6.77 → 1.6.78

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.
Files changed (4) hide show
  1. package/cli.js +14 -2
  2. package/i18n.js +58 -18
  3. package/package.json +1 -1
  4. package/server.js +23 -1
package/cli.js CHANGED
@@ -362,7 +362,13 @@ async function runCliMode(extraClaudeArgs = [], cwd) {
362
362
  execSync(`${cmd} ${url}`, { stdio: 'ignore', timeout: 5000 });
363
363
  } catch {}
364
364
 
365
- console.log(`CC Viewer: ${url}`);
365
+ console.log(`CC Viewer:`);
366
+ console.log(` ➜ Local: ${url}`);
367
+ const _lanIps = serverMod.getAllLocalIps();
368
+ const _token = serverMod.getAccessToken();
369
+ for (const _ip of _lanIps) {
370
+ console.log(` ➜ Network: ${protocol}://${_ip}:${port}?token=${_token}`);
371
+ }
366
372
 
367
373
  // 5. 注册退出处理
368
374
  const cleanup = () => {
@@ -418,7 +424,13 @@ async function runCliModeWorkspaceSelector(extraClaudeArgs = []) {
418
424
  execSync(`${cmd} ${url}`, { stdio: 'ignore', timeout: 5000 });
419
425
  } catch {}
420
426
 
421
- console.log(`CC Viewer (Workspace): ${url}`);
427
+ console.log(`CC Viewer (Workspace):`);
428
+ console.log(` ➜ Local: ${url}`);
429
+ const _lanIps = serverMod.getAllLocalIps();
430
+ const _token = serverMod.getAccessToken();
431
+ for (const _ip of _lanIps) {
432
+ console.log(` ➜ Network: ${wsProtocol}://${_ip}:${port}?token=${_token}`);
433
+ }
422
434
 
423
435
  // 注册退出处理
424
436
  const { killPty } = await import('./pty-manager.js');
package/i18n.js CHANGED
@@ -368,24 +368,64 @@ const i18nData = {
368
368
  "uk": "\n🗑️ Інтеграцію CC Viewer видалено (Запустіть 'npm uninstall -g cc-viewer', щоб видалити команду)"
369
369
  },
370
370
  "server.started": {
371
- "zh": "\nClaude 请求监控服务已启动: {protocol}://{host}:{port}\n",
372
- "en": "\nCC Viewer started: {protocol}://{host}:{port}\n",
373
- "zh-TW": "\nClaude 請求監控服務已啟動: {protocol}://{host}:{port}\n",
374
- "ko": "\nCC Viewer 시작됨: {protocol}://{host}:{port}\n",
375
- "ja": "\nCC Viewer 起動: {protocol}://{host}:{port}\n",
376
- "de": "\nCC Viewer gestartet: {protocol}://{host}:{port}\n",
377
- "es": "\nCC Viewer iniciado: {protocol}://{host}:{port}\n",
378
- "fr": "\nCC Viewer démarré : {protocol}://{host}:{port}\n",
379
- "it": "\nCC Viewer avviato: {protocol}://{host}:{port}\n",
380
- "da": "\nCC Viewer startet: {protocol}://{host}:{port}\n",
381
- "pl": "\nCC Viewer uruchomiony: {protocol}://{host}:{port}\n",
382
- "ru": "\nCC Viewer запущен: {protocol}://{host}:{port}\n",
383
- "ar": "\nتم تشغيل CC Viewer: {protocol}://{host}:{port}\n",
384
- "no": "\nCC Viewer startet: {protocol}://{host}:{port}\n",
385
- "pt-BR": "\nCC Viewer iniciado: {protocol}://{host}:{port}\n",
386
- "th": "\nCC Viewer เริ่มทำงาน: {protocol}://{host}:{port}\n",
387
- "tr": "\nCC Viewer başlatıldı: {protocol}://{host}:{port}\n",
388
- "uk": "\nCC Viewer запущено: {protocol}://{host}:{port}\n"
371
+ "zh": "\nClaude 请求监控服务已启动:",
372
+ "en": "\nCC Viewer started:",
373
+ "zh-TW": "\nClaude 請求監控服務已啟動:",
374
+ "ko": "\nCC Viewer 시작됨:",
375
+ "ja": "\nCC Viewer 起動:",
376
+ "de": "\nCC Viewer gestartet:",
377
+ "es": "\nCC Viewer iniciado:",
378
+ "fr": "\nCC Viewer démarré :",
379
+ "it": "\nCC Viewer avviato:",
380
+ "da": "\nCC Viewer startet:",
381
+ "pl": "\nCC Viewer uruchomiony:",
382
+ "ru": "\nCC Viewer запущен:",
383
+ "ar": "\nتم تشغيل CC Viewer:",
384
+ "no": "\nCC Viewer startet:",
385
+ "pt-BR": "\nCC Viewer iniciado:",
386
+ "th": "\nCC Viewer เริ่มทำงาน:",
387
+ "tr": "\nCC Viewer başlatıldı:",
388
+ "uk": "\nCC Viewer запущено:"
389
+ },
390
+ "server.startedLocal": {
391
+ "zh": " ➜ Local: {protocol}://127.0.0.1:{port}",
392
+ "en": " ➜ Local: {protocol}://127.0.0.1:{port}",
393
+ "zh-TW": " ➜ Local: {protocol}://127.0.0.1:{port}",
394
+ "ko": " ➜ Local: {protocol}://127.0.0.1:{port}",
395
+ "ja": " ➜ Local: {protocol}://127.0.0.1:{port}",
396
+ "de": " ➜ Local: {protocol}://127.0.0.1:{port}",
397
+ "es": " ➜ Local: {protocol}://127.0.0.1:{port}",
398
+ "fr": " ➜ Local: {protocol}://127.0.0.1:{port}",
399
+ "it": " ➜ Local: {protocol}://127.0.0.1:{port}",
400
+ "da": " ➜ Local: {protocol}://127.0.0.1:{port}",
401
+ "pl": " ➜ Local: {protocol}://127.0.0.1:{port}",
402
+ "ru": " ➜ Local: {protocol}://127.0.0.1:{port}",
403
+ "ar": " ➜ Local: {protocol}://127.0.0.1:{port}",
404
+ "no": " ➜ Local: {protocol}://127.0.0.1:{port}",
405
+ "pt-BR": " ➜ Local: {protocol}://127.0.0.1:{port}",
406
+ "th": " ➜ Local: {protocol}://127.0.0.1:{port}",
407
+ "tr": " ➜ Local: {protocol}://127.0.0.1:{port}",
408
+ "uk": " ➜ Local: {protocol}://127.0.0.1:{port}"
409
+ },
410
+ "server.startedNetwork": {
411
+ "zh": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
412
+ "en": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
413
+ "zh-TW": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
414
+ "ko": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
415
+ "ja": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
416
+ "de": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
417
+ "es": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
418
+ "fr": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
419
+ "it": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
420
+ "da": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
421
+ "pl": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
422
+ "ru": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
423
+ "ar": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
424
+ "no": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
425
+ "pt-BR": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
426
+ "th": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
427
+ "tr": " ➜ Network: {protocol}://{ip}:{port}?token={token}",
428
+ "uk": " ➜ Network: {protocol}://{ip}:{port}?token={token}"
389
429
  },
390
430
  "update.updating": {
391
431
  "zh": "正在更新到 v{version}...",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-viewer",
3
- "version": "1.6.77",
3
+ "version": "1.6.78",
4
4
  "description": "Claude Code Logger visualization management tool",
5
5
  "license": "MIT",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -203,6 +203,17 @@ function getLocalIp() {
203
203
  return '127.0.0.1';
204
204
  }
205
205
 
206
+ function getAllLocalIps() {
207
+ const ips = [];
208
+ const nets = networkInterfaces();
209
+ for (const name of Object.keys(nets)) {
210
+ for (const net of nets[name]) {
211
+ if (net.family === 'IPv4' && !net.internal) ips.push(net.address);
212
+ }
213
+ }
214
+ return ips;
215
+ }
216
+
206
217
  async function handleRequest(req, res) {
207
218
  const parsedUrl = new URL(req.url, `${serverProtocol}://${req.headers.host}`);
208
219
  const url = parsedUrl.pathname;
@@ -1921,7 +1932,12 @@ export async function startViewer() {
1921
1932
  server = currentServer;
1922
1933
  actualPort = port;
1923
1934
  const url = `${serverProtocol}://127.0.0.1:${port}`;
1924
- console.error(t('server.started', { host: '127.0.0.1', port, protocol: serverProtocol }));
1935
+ console.error(t('server.started'));
1936
+ console.error(t('server.startedLocal', { protocol: serverProtocol, port }));
1937
+ const _ips = getAllLocalIps();
1938
+ for (const _ip of _ips) {
1939
+ console.error(t('server.startedNetwork', { protocol: serverProtocol, ip: _ip, port, token: ACCESS_TOKEN }));
1940
+ }
1925
1941
  // v2.0.69 之前的版本会清空控制台,自动打开浏览器确保用户能看到界面
1926
1942
  try {
1927
1943
  const ccPkgPath = join(__dirname, '..', '@anthropic-ai', 'claude-code', 'package.json');
@@ -2146,6 +2162,12 @@ export function getProtocol() {
2146
2162
  return serverProtocol;
2147
2163
  }
2148
2164
 
2165
+ export { getAllLocalIps };
2166
+
2167
+ export function getAccessToken() {
2168
+ return ACCESS_TOKEN;
2169
+ }
2170
+
2149
2171
  // 流式状态 SSE 推送定时器:检测 streamingState 变化并广播给所有客户端
2150
2172
  let _streamingStatusTimer = null;
2151
2173
  let _lastStreamingActive = false;