claude-opencode-viewer 2.6.11 → 2.6.12
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/index-pc.html +10 -83
- package/index.html +9 -5
- package/package.json +1 -1
package/index-pc.html
CHANGED
|
@@ -395,58 +395,6 @@
|
|
|
395
395
|
display: block;
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
#copy-popup {
|
|
399
|
-
display: none;
|
|
400
|
-
position: fixed;
|
|
401
|
-
top: 50%;
|
|
402
|
-
left: 50%;
|
|
403
|
-
transform: translate(-50%, -50%);
|
|
404
|
-
background: #1a1a1a;
|
|
405
|
-
border: 1px solid #444;
|
|
406
|
-
border-radius: 8px;
|
|
407
|
-
padding: 16px;
|
|
408
|
-
z-index: 10000;
|
|
409
|
-
max-width: 80vw;
|
|
410
|
-
max-height: 60vh;
|
|
411
|
-
}
|
|
412
|
-
#copy-popup.show {
|
|
413
|
-
display: flex;
|
|
414
|
-
flex-direction: column;
|
|
415
|
-
gap: 10px;
|
|
416
|
-
}
|
|
417
|
-
#copy-popup textarea {
|
|
418
|
-
width: 500px;
|
|
419
|
-
max-width: 70vw;
|
|
420
|
-
height: 120px;
|
|
421
|
-
background: #0a0a0a;
|
|
422
|
-
color: #ccc;
|
|
423
|
-
border: 1px solid #333;
|
|
424
|
-
border-radius: 4px;
|
|
425
|
-
padding: 8px;
|
|
426
|
-
font-family: Menlo, Monaco, monospace;
|
|
427
|
-
font-size: 12px;
|
|
428
|
-
resize: vertical;
|
|
429
|
-
}
|
|
430
|
-
#copy-popup .popup-actions {
|
|
431
|
-
display: flex;
|
|
432
|
-
justify-content: flex-end;
|
|
433
|
-
gap: 8px;
|
|
434
|
-
}
|
|
435
|
-
#copy-popup button {
|
|
436
|
-
padding: 6px 16px;
|
|
437
|
-
border: none;
|
|
438
|
-
border-radius: 4px;
|
|
439
|
-
cursor: pointer;
|
|
440
|
-
font-size: 13px;
|
|
441
|
-
}
|
|
442
|
-
#copy-popup .btn-copy {
|
|
443
|
-
background: #2563eb;
|
|
444
|
-
color: #fff;
|
|
445
|
-
}
|
|
446
|
-
#copy-popup .btn-close {
|
|
447
|
-
background: #333;
|
|
448
|
-
color: #ccc;
|
|
449
|
-
}
|
|
450
398
|
|
|
451
399
|
/* Git Diff 面板 */
|
|
452
400
|
#git-diff-bar {
|
|
@@ -786,14 +734,6 @@
|
|
|
786
734
|
</div>
|
|
787
735
|
|
|
788
736
|
<div id="copy-toast">已复制</div>
|
|
789
|
-
<div id="copy-popup">
|
|
790
|
-
<div style="color:#ccc;font-size:13px;">剪贴板写入需要 HTTPS,请手动复制:</div>
|
|
791
|
-
<textarea id="copy-popup-text" readonly></textarea>
|
|
792
|
-
<div class="popup-actions">
|
|
793
|
-
<button class="btn-copy" onclick="document.getElementById('copy-popup-text').select();document.execCommand('copy');document.getElementById('copy-popup').classList.remove('show');">选中并复制</button>
|
|
794
|
-
<button class="btn-close" onclick="document.getElementById('copy-popup').classList.remove('show');">关闭</button>
|
|
795
|
-
</div>
|
|
796
|
-
</div>
|
|
797
737
|
<script src="https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/lib/xterm.min.js"></script>
|
|
798
738
|
<script>
|
|
799
739
|
(function() {
|
|
@@ -842,19 +782,15 @@
|
|
|
842
782
|
try {
|
|
843
783
|
var bytes = Uint8Array.from(atob(b64), function(c) { return c.charCodeAt(0); });
|
|
844
784
|
var text = new TextDecoder().decode(bytes);
|
|
845
|
-
|
|
846
|
-
navigator.clipboard.writeText(text).then(function() {
|
|
847
|
-
showCopyToast();
|
|
848
|
-
}).catch(function() {
|
|
849
|
-
showCopyPopup(text);
|
|
850
|
-
});
|
|
851
|
-
} else {
|
|
852
|
-
showCopyPopup(text);
|
|
853
|
-
}
|
|
785
|
+
copyToClipboard(text);
|
|
854
786
|
} catch (e) {}
|
|
855
787
|
return true;
|
|
856
788
|
});
|
|
857
789
|
|
|
790
|
+
// 自动检测反向代理子路径,确保 API/WS 请求带正确前缀
|
|
791
|
+
var basePath = location.pathname.replace(/\/[^/]*$/, '');
|
|
792
|
+
if (basePath === '' || basePath === '/') basePath = '';
|
|
793
|
+
|
|
858
794
|
var modeSelect = document.getElementById('mode-select');
|
|
859
795
|
var terminalEl = document.getElementById('terminal');
|
|
860
796
|
var ws = null;
|
|
@@ -1270,7 +1206,7 @@
|
|
|
1270
1206
|
|
|
1271
1207
|
function connect() {
|
|
1272
1208
|
var proto = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
1273
|
-
ws = new WebSocket(proto + '//' + location.host + '/ws');
|
|
1209
|
+
ws = new WebSocket(proto + '//' + location.host + basePath + '/ws');
|
|
1274
1210
|
|
|
1275
1211
|
ws.onopen = function() {
|
|
1276
1212
|
isBufferReplay = true;
|
|
@@ -1416,7 +1352,7 @@
|
|
|
1416
1352
|
var sessionList = document.getElementById('session-list');
|
|
1417
1353
|
sessionList.innerHTML = '<div class="session-loading">加载历史会话...</div>';
|
|
1418
1354
|
|
|
1419
|
-
fetch('/api/sessions')
|
|
1355
|
+
fetch(basePath + '/api/sessions')
|
|
1420
1356
|
.then(function(response) { return response.json(); })
|
|
1421
1357
|
.then(function(data) {
|
|
1422
1358
|
sessions = data;
|
|
@@ -1499,7 +1435,7 @@
|
|
|
1499
1435
|
itemEl.style.opacity = '0.4';
|
|
1500
1436
|
itemEl.style.pointerEvents = 'none';
|
|
1501
1437
|
|
|
1502
|
-
fetch('/api/session/' + sessionId, { method: 'DELETE' })
|
|
1438
|
+
fetch(basePath + '/api/session/' + sessionId, { method: 'DELETE' })
|
|
1503
1439
|
.then(function(r) { return r.json(); })
|
|
1504
1440
|
.then(function(data) {
|
|
1505
1441
|
if (data.ok) {
|
|
@@ -1645,15 +1581,6 @@
|
|
|
1645
1581
|
showCopyToast();
|
|
1646
1582
|
}
|
|
1647
1583
|
|
|
1648
|
-
function showCopyPopup(text) {
|
|
1649
|
-
var popup = document.getElementById('copy-popup');
|
|
1650
|
-
var ta = document.getElementById('copy-popup-text');
|
|
1651
|
-
ta.value = text;
|
|
1652
|
-
popup.classList.add('show');
|
|
1653
|
-
ta.focus();
|
|
1654
|
-
ta.select();
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
1584
|
function showCopyToast() {
|
|
1658
1585
|
var toast = document.getElementById('copy-toast');
|
|
1659
1586
|
toast.classList.add('show');
|
|
@@ -1732,7 +1659,7 @@
|
|
|
1732
1659
|
fileList.innerHTML = '<div class="git-diff-loading">加载中...</div>';
|
|
1733
1660
|
document.getElementById('git-diff-count').textContent = '0';
|
|
1734
1661
|
|
|
1735
|
-
fetch('/api/git-status')
|
|
1662
|
+
fetch(basePath + '/api/git-status')
|
|
1736
1663
|
.then(function(r) { return r.json(); })
|
|
1737
1664
|
.then(function(data) {
|
|
1738
1665
|
diffChanges = data.changes || [];
|
|
@@ -1780,7 +1707,7 @@
|
|
|
1780
1707
|
var area = document.getElementById('git-diff-content-area');
|
|
1781
1708
|
area.innerHTML = '<div class="git-diff-loading">加载 diff...</div>';
|
|
1782
1709
|
|
|
1783
|
-
fetch('/api/git-diff?files=' + encodeURIComponent(file))
|
|
1710
|
+
fetch(basePath + '/api/git-diff?files=' + encodeURIComponent(file))
|
|
1784
1711
|
.then(function(r) { return r.json(); })
|
|
1785
1712
|
.then(function(data) {
|
|
1786
1713
|
if (!data.diffs || !data.diffs[0]) {
|
package/index.html
CHANGED
|
@@ -850,6 +850,10 @@
|
|
|
850
850
|
return true;
|
|
851
851
|
});
|
|
852
852
|
|
|
853
|
+
// 自动检测反向代理子路径,确保 API/WS 请求带正确前缀
|
|
854
|
+
var basePath = location.pathname.replace(/\/[^/]*$/, '');
|
|
855
|
+
if (basePath === '' || basePath === '/') basePath = '';
|
|
856
|
+
|
|
853
857
|
var modeSelect = document.getElementById('mode-select');
|
|
854
858
|
var terminalEl = document.getElementById('terminal');
|
|
855
859
|
var ws = null;
|
|
@@ -1327,7 +1331,7 @@
|
|
|
1327
1331
|
|
|
1328
1332
|
function connect() {
|
|
1329
1333
|
var proto = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
1330
|
-
ws = new WebSocket(proto + '//' + location.host + '/ws');
|
|
1334
|
+
ws = new WebSocket(proto + '//' + location.host + basePath + '/ws');
|
|
1331
1335
|
|
|
1332
1336
|
ws.onopen = function() {
|
|
1333
1337
|
resize();
|
|
@@ -1578,7 +1582,7 @@
|
|
|
1578
1582
|
var sessionList = document.getElementById('session-list');
|
|
1579
1583
|
sessionList.innerHTML = '<div class="session-loading">加载历史会话...</div>';
|
|
1580
1584
|
|
|
1581
|
-
fetch('/api/sessions')
|
|
1585
|
+
fetch(basePath + '/api/sessions')
|
|
1582
1586
|
.then(function(response) { return response.json(); })
|
|
1583
1587
|
.then(function(data) {
|
|
1584
1588
|
sessions = data;
|
|
@@ -1661,7 +1665,7 @@
|
|
|
1661
1665
|
itemEl.style.opacity = '0.4';
|
|
1662
1666
|
itemEl.style.pointerEvents = 'none';
|
|
1663
1667
|
|
|
1664
|
-
fetch('/api/session/' + sessionId, { method: 'DELETE' })
|
|
1668
|
+
fetch(basePath + '/api/session/' + sessionId, { method: 'DELETE' })
|
|
1665
1669
|
.then(function(r) { return r.json(); })
|
|
1666
1670
|
.then(function(data) {
|
|
1667
1671
|
if (data.ok) {
|
|
@@ -1885,7 +1889,7 @@
|
|
|
1885
1889
|
fileList.innerHTML = '<div class="git-diff-loading">加载中...</div>';
|
|
1886
1890
|
document.getElementById('git-diff-count').textContent = '0';
|
|
1887
1891
|
|
|
1888
|
-
fetch('/api/git-status')
|
|
1892
|
+
fetch(basePath + '/api/git-status')
|
|
1889
1893
|
.then(function(r) { return r.json(); })
|
|
1890
1894
|
.then(function(data) {
|
|
1891
1895
|
diffChanges = data.changes || [];
|
|
@@ -1933,7 +1937,7 @@
|
|
|
1933
1937
|
var area = document.getElementById('git-diff-content-area');
|
|
1934
1938
|
area.innerHTML = '<div class="git-diff-loading">加载 diff...</div>';
|
|
1935
1939
|
|
|
1936
|
-
fetch('/api/git-diff?files=' + encodeURIComponent(file))
|
|
1940
|
+
fetch(basePath + '/api/git-diff?files=' + encodeURIComponent(file))
|
|
1937
1941
|
.then(function(r) { return r.json(); })
|
|
1938
1942
|
.then(function(data) {
|
|
1939
1943
|
if (!data.diffs || !data.diffs[0]) {
|