claude-opencode-viewer 2.6.3 → 2.6.5
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/bin/cov.js +30 -9
- package/index-pc.html +2141 -0
- package/index.html +9 -0
- package/package.json +1 -1
- package/server.js +5 -3
package/index.html
CHANGED
|
@@ -1010,6 +1010,15 @@
|
|
|
1010
1010
|
|
|
1011
1011
|
term.open(document.getElementById('terminal'));
|
|
1012
1012
|
|
|
1013
|
+
// PC端复制:用 xterm.js selection API 获取纯文本,避免复制出乱码
|
|
1014
|
+
document.getElementById('terminal').addEventListener('copy', function(e) {
|
|
1015
|
+
var sel = term.getSelection();
|
|
1016
|
+
if (sel) {
|
|
1017
|
+
e.preventDefault();
|
|
1018
|
+
e.clipboardData.setData('text/plain', sel);
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
1021
|
+
|
|
1013
1022
|
// OSC 52 剪贴板支持:拦截应用发送的剪贴板设置请求
|
|
1014
1023
|
term.parser.registerOscHandler(52, function(data) {
|
|
1015
1024
|
var idx = data.indexOf(';');
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -14,7 +14,8 @@ import Database from 'better-sqlite3';
|
|
|
14
14
|
process.title = 'claude-opencode-viewer';
|
|
15
15
|
|
|
16
16
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
|
-
const PORT = 7008;
|
|
17
|
+
const PORT = parseInt(process.argv[2]) || 7008;
|
|
18
|
+
const IS_PC = process.argv.includes('--pc');
|
|
18
19
|
|
|
19
20
|
// OpenCode 数据库路径(支持环境变量覆盖,自动检测 /halo 环境)
|
|
20
21
|
const OPENCODE_DB_PATH = process.env.OPENCODE_DB_PATH || join(
|
|
@@ -22,7 +23,7 @@ const OPENCODE_DB_PATH = process.env.OPENCODE_DB_PATH || join(
|
|
|
22
23
|
'opencode/opencode.db'
|
|
23
24
|
);
|
|
24
25
|
|
|
25
|
-
const MAX_BUFFER =
|
|
26
|
+
const MAX_BUFFER = 1024 * 1024; // 1MB
|
|
26
27
|
const execFileAsync = promisify(execFile);
|
|
27
28
|
|
|
28
29
|
let ptyModule = null;
|
|
@@ -411,8 +412,9 @@ const server = createServer(async (req, res) => {
|
|
|
411
412
|
res.writeHead(200, {
|
|
412
413
|
'Content-Type': 'text/html; charset=utf-8',
|
|
413
414
|
'Access-Control-Allow-Origin': '*',
|
|
415
|
+
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
414
416
|
});
|
|
415
|
-
createReadStream(join(__dirname, 'index.html')).pipe(res);
|
|
417
|
+
createReadStream(join(__dirname, IS_PC ? 'index-pc.html' : 'index.html')).pipe(res);
|
|
416
418
|
return;
|
|
417
419
|
}
|
|
418
420
|
|