diff --git a/README.md b/README.md index 327e420..2a0ab72 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,14 @@ https://github.com/ZgDaniel/cc-web 给我装!

+## 更新记录 + +- **v1.2** + - 修复消息中包含代码块时可能触发的页面横向溢出问题:窗口不再被长代码撑宽,代码块可在块内横向滚动。 + - 优化移动端输入体验:手机浏览器回车键默认换行,不再直接发送消息;消息发送改为手动点击发送按钮。 +- **v1.1** + - 增加 Windows 环境下 Claude Code CLI 的兼容支持,完善本地部署与启动体验。 + ## 功能特性 - **超轻量** — 后端性能占用少,前端通过web访问,不易被杀后台 diff --git a/public/app.js b/public/app.js index 5fc003c..81f3fb0 100644 --- a/public/app.js +++ b/public/app.js @@ -807,6 +807,10 @@ msgInput.style.height = Math.min(msgInput.scrollHeight, max) + 'px'; } + function isMobileInputMode() { + return window.matchMedia('(max-width: 768px), (pointer: coarse)').matches; + } + // --- Event Listeners --- loginForm.addEventListener('submit', (e) => { e.preventDefault(); @@ -864,6 +868,14 @@ if (e.key === 'Escape') { hideCmdMenu(); return; } } if (e.key === 'Enter' && !e.shiftKey) { + if (isMobileInputMode()) { + if (!cmdMenu.hidden) { + e.preventDefault(); + selectCmdMenuItem(); + } + return; + } + e.preventDefault(); if (!cmdMenu.hidden) { // If menu is open and user presses Enter, select the item diff --git a/public/style.css b/public/style.css index 3a097fb..4b1edc6 100644 --- a/public/style.css +++ b/public/style.css @@ -337,6 +337,7 @@ body { .messages { flex: 1; overflow-y: auto; + overflow-x: hidden; padding: 16px; display: flex; flex-direction: column; @@ -368,6 +369,7 @@ body { display: flex; gap: 10px; max-width: 85%; + min-width: 0; animation: fadeIn 0.25s ease; } @keyframes fadeIn { @@ -396,6 +398,8 @@ body { border-radius: 16px; line-height: 1.65; word-break: break-word; + min-width: 0; + max-width: 100%; } .msg.user .msg-bubble { background: var(--bg-bubble-user); @@ -480,6 +484,7 @@ body { border-radius: 10px; overflow: hidden; border: 1px solid var(--border-color); + max-width: 100%; } .code-block-header { display: flex; @@ -504,12 +509,15 @@ body { margin: 0; padding: 12px; overflow-x: auto; + overflow-y: hidden; + max-width: 100%; -webkit-overflow-scrolling: touch; } .code-block-wrapper pre code { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; font-size: 13px; line-height: 1.5; + white-space: pre; } /* Tool calls */ @@ -655,6 +663,7 @@ body { outline: none; max-height: var(--input-max-height); min-height: 24px; + overflow-y: auto; } #msg-input::placeholder { color: var(--text-muted); } .send-btn, .abort-btn { diff --git a/server.js b/server.js index 6c315b8..7a1a090 100644 --- a/server.js +++ b/server.js @@ -140,10 +140,11 @@ function sendNotification(title, content) { const parsed = new URL(url); const contentType = isFormData ? 'application/x-www-form-urlencoded' : 'application/json'; - const req = https.request(parsed, { + const reqOptions = { method: 'POST', headers: { 'Content-Type': contentType, 'Content-Length': Buffer.byteLength(data) }, - }, (res) => { + }; + const req = https.request(parsed, reqOptions, (res) => { let body = ''; res.on('data', (c) => body += c); res.on('end', () => {