diff --git a/docs/远程控制.md b/docs/远程控制.md
index 8c81db4..65eac46 100644
--- a/docs/远程控制.md
+++ b/docs/远程控制.md
@@ -301,6 +301,8 @@ https://control.example.com
- 按实例筛选。
- 按运行筛选。
- 按实例名、账号或正文过滤。
+- 日志区域独立滚动,不带动整页或机器列表。
+- “自动滚动”开关控制新日志到达时是否跟随到底部,选择保存在浏览器本地。
- 恢复全部日志。
- 清空当前浏览器显示,不删除服务端数据。
diff --git a/internal/remote/web/index.html b/internal/remote/web/index.html
index 909ff1a..c27b66a 100644
--- a/internal/remote/web/index.html
+++ b/internal/remote/web/index.html
@@ -12,9 +12,13 @@
color: #e9eef4;
}
* { box-sizing: border-box; }
- body { margin: 0; background: #111418; }
+ html, body { height: 100%; }
+ body { margin: 0; overflow: hidden; background: #111418; }
button, input { font: inherit; }
- .shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
+ .shell {
+ height: 100vh; min-height: 0; overflow: hidden;
+ display: grid; grid-template-rows: auto minmax(0, 1fr);
+ }
header {
display: flex; align-items: center; gap: 16px; padding: 14px 20px;
border-bottom: 1px solid #2a3038; background: #171b20;
@@ -40,7 +44,7 @@
.danger { border-color: #74434a; background: #3a2428; }
main {
display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(440px, .8fr);
- gap: 14px; padding: 14px; min-height: 0;
+ gap: 14px; padding: 14px; min-height: 0; overflow: hidden;
}
.panel {
min-height: 0; border: 1px solid #2a3038; background: #171b20;
@@ -51,12 +55,12 @@
border-bottom: 1px solid #2a3038;
}
.panel-head strong { font-size: 14px; }
- .machines { overflow: auto; padding: 10px; }
+ .machines { flex: 1; min-height: 0; overflow: auto; padding: 10px; }
.subhead {
padding: 9px 14px; border-top: 1px solid #2a3038; border-bottom: 1px solid #2a3038;
background: #1c2229; font-size: 13px; font-weight: 600;
}
- .runs { overflow: auto; max-height: 230px; padding: 4px 12px 10px; }
+ .runs { flex: 0 1 230px; min-height: 90px; overflow: auto; padding: 4px 12px 10px; }
.run {
display: grid; grid-template-columns: 72px 1fr 160px 72px;
gap: 10px; padding: 7px 0; border-bottom: 1px solid #232a32; font-size: 12px;
@@ -104,12 +108,17 @@
.logs-panel { min-width: 0; }
.log-filter { display: flex; gap: 8px; align-items: center; }
.log-filter input { width: 180px; }
+ .auto-scroll {
+ display: inline-flex; align-items: center; gap: 5px;
+ color: #9dabba; font-size: 12px; white-space: nowrap;
+ }
+ .auto-scroll input { width: auto; }
.log-scope {
padding: 4px 8px; border: 1px solid #35404c; border-radius: 999px;
color: #9dabba; font-size: 11px; white-space: nowrap;
}
#logs {
- overflow: auto; flex: 1; padding: 8px 0;
+ overflow: auto; flex: 1; min-height: 0; padding: 8px 0; overscroll-behavior: contain;
font-family: "Cascadia Mono", "Consolas", monospace; font-size: 12px;
}
.log {
@@ -124,8 +133,13 @@
.level-success { color: #59d19b; }
.empty { padding: 24px; text-align: center; color: #778493; }
@media (max-width: 980px) {
- main { grid-template-columns: 1fr; }
- .logs-panel { min-height: 52vh; }
+ body { overflow: auto; }
+ .shell { height: auto; min-height: 100vh; overflow: visible; }
+ main {
+ grid-template-columns: 1fr;
+ grid-template-rows: minmax(360px, 48vh) minmax(360px, 52vh);
+ overflow: visible;
+ }
.instance { grid-template-columns: 1fr 1fr; }
.actions { justify-content: flex-start; }
.token-box input { width: 180px; }
@@ -164,6 +178,10 @@
+
@@ -181,6 +199,7 @@
const summary = document.getElementById('summary');
const logsRoot = document.getElementById('logs');
const filterInput = document.getElementById('filter');
+ const autoScrollInput = document.getElementById('auto-scroll');
const clearButton = document.getElementById('clear');
const scopeLabel = document.getElementById('log-scope');
const scopeClearButton = document.getElementById('scope-clear');
@@ -196,6 +215,7 @@
const logs = [];
tokenInput.value = token;
+ autoScrollInput.checked = localStorage.getItem('douyu-control-auto-scroll') !== 'false';
if (bootstrapToken) {
localStorage.setItem('douyu-control-token', bootstrapToken);
history.replaceState(null, '', location.pathname + location.search);
@@ -212,6 +232,12 @@
logs.length = 0;
renderLogs();
});
+ autoScrollInput.addEventListener('change', () => {
+ localStorage.setItem('douyu-control-auto-scroll', String(autoScrollInput.checked));
+ if (autoScrollInput.checked) {
+ logsRoot.scrollTop = logsRoot.scrollHeight;
+ }
+ });
scopeClearButton.addEventListener('click', () => selectScope('', '', '', '全部实例'));
exportCsvButton.addEventListener('click', () => exportLogs('csv'));
exportJsonButton.addEventListener('click', () => exportLogs('json'));
@@ -546,6 +572,7 @@
function renderLogs() {
const filter = filterInput.value.trim().toLowerCase();
+ const previousScrollTop = logsRoot.scrollTop;
logsRoot.replaceChildren();
const visible = logs.filter(event => {
if (!filter) return true;
@@ -565,7 +592,11 @@
);
logsRoot.append(row);
}
- logsRoot.scrollTop = logsRoot.scrollHeight;
+ if (autoScrollInput.checked) {
+ logsRoot.scrollTop = logsRoot.scrollHeight;
+ } else {
+ logsRoot.scrollTop = previousScrollTop;
+ }
}
function element(tag, className = '', text = '') {