diff --git a/components/ts_webui/web/css/style.css b/components/ts_webui/web/css/style.css
index 31a8d4d..78b83d2 100644
--- a/components/ts_webui/web/css/style.css
+++ b/components/ts_webui/web/css/style.css
@@ -14,12 +14,13 @@
--ok:#187030;--ok-dot:#34c759;--warn:#944b00;--warn-dot:#ff9500;--bad:#ad1b21;--bad-dot:#ff3b30;
--hair:rgba(0,0,0,.10);--hair-strong:rgba(0,0,0,.16);--fill:rgba(0,0,0,.045);--fill-2:rgba(0,0,0,.07);
--r-panel:32px;--r-card:16px;--r-inner:12px;--r-menu:16px;--r-item:10px;--r-ctl-sm:8px;--r-ctl:10px;--r-track:10px;--r-thumb:8px;
+--page-bg:#cddbe7;
--wall:radial-gradient(ellipse at 12% 0%,#f8d9a4 0%,transparent 48%),radial-gradient(ellipse at 90% 12%,#c4dfef 0%,transparent 45%),linear-gradient(140deg,#b9cddc 0%,#e1d5bd 42%,#bbd7ef 73%,#9ec0e0 100%);
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
-body{margin:0;background:#cddbe7;color:var(--ink);font:400 14px/20px var(--font);-webkit-font-smoothing:antialiased}
-body::before{content:"";position:fixed;inset:0;z-index:-1;background-color:#cddbe7;background-image:var(--wall)}
+body{margin:0;background:var(--page-bg);color:var(--ink);font:400 14px/20px var(--font);-webkit-font-smoothing:antialiased}
+body::before{content:"";position:fixed;inset:0;z-index:-1;background-color:var(--page-bg);background-image:var(--wall)}
h1,h2,h3,h4,p{margin:0}
a{color:var(--accent-text);text-decoration:none;cursor:pointer}
button,input,select,textarea{font:inherit;color:inherit}
@@ -70,6 +71,8 @@ footer.foot{padding:19px 0 18px}
.main{margin:12px 12px 0;border-radius:28px}
}
@media (max-width:600px){
+/* Match the solid background that Safari extends outside the page viewport. */
+body::before{background-image:linear-gradient(to bottom,var(--page-bg),transparent min(64px,12%),transparent max(calc(100% - 64px),88%),var(--page-bg)),var(--wall)}
#ws-status{font-size:0;gap:0}
#user-name{display:none}
.brand{min-width:0;max-width:100%;align-items:center;gap:8px}
@@ -377,6 +380,8 @@ input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-
.svc{display:grid;grid-template-columns:minmax(0,1fr);align-content:start;gap:0}
.nat-row{display:flex;align-items:center;gap:16px;margin-top:12px}
.net-lpmu{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px;padding:16px 20px}
+.net-lpmu-status{flex:1 1 240px;min-width:0;overflow-wrap:anywhere}
+.net-lpmu-actions{max-width:100%}
.dhcp-iface-row{display:flex;align-items:center;gap:8px}
select.field{-webkit-appearance:none;appearance:none;padding-right:30px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M.7 1.35 6 6.65l5.3-5.3' fill='none' stroke='%235f6670' stroke-width='1.5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 9.3px top calc(50% + 1.05px)}
.sel{position:relative;padding-right:30px}
@@ -468,13 +473,13 @@ input[type=radio]:checked{border:5px solid var(--accent-text)}
.pwt{position:absolute;right:4px;top:4px;width:28px;height:28px;padding:0;border:0;background:none;color:var(--ink-3);display:flex;align-items:center;justify-content:center;cursor:default}
.pwt:hover{color:var(--ink-2)}
.pwt.active{background:none;box-shadow:none;color:var(--ink)}
-.cert-lines{margin-top:8px;display:grid;gap:2px;font-size:13px;color:var(--ink-2)}
+.cert-lines{margin-top:8px;display:grid;gap:2px;font-size:13px;color:var(--ink-2);overflow-wrap:anywhere}
.cert-lines>:empty{display:none}
+#cert-info-details .kv>span:first-child{flex:none}
.kv-grid{display:grid;gap:0 24px;margin-top:8px}
.kv-grid.k4{grid-template-columns:repeat(4,1fr)}
-.kv-grid.k2{grid-template-columns:repeat(2,1fr);margin-top:12px}
-.kv-grid .kv>span:last-child{min-width:0;overflow-wrap:break-word}
-.kv-grid .kv>span.mono:last-child{overflow-wrap:anywhere}
+.kv-grid.k2{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:12px}
+.kv-grid .kv>span:last-child{min-width:0;overflow-wrap:anywhere}
.form-error{color:var(--bad);font-size:12px;line-height:16px;margin-top:8px}
.row .rl small.form-error{color:var(--bad)}
.field.err{border-color:var(--bad);box-shadow:0 0 0 1px var(--bad)}
@@ -482,6 +487,7 @@ input[type=radio]:checked{border:5px solid var(--accent-text)}
/* ===== 弹窗(分组表单,见 Audit 十七 / NativeDialogs)===== */
.modal>.sheet{position:relative;display:flex;flex-direction:column;max-width:calc(100% - 32px);max-height:calc(100% - 32px)}
.sheet>.sb{min-height:0;overflow-y:auto;margin:0 -24px;padding:0 24px}
+#services-modal .sb{overscroll-behavior:contain}
.sheet>.sb>.gt:first-child{margin-top:2px}
.gw>.gt:first-child{margin-top:18px}
.xbtn{border-color:transparent;background:var(--fill-2)}
@@ -615,6 +621,9 @@ input[type=color].swi::-webkit-color-swatch{border:0;border-radius:50%}
@media (max-width:819px){
.sys-top,.led-grid,.net-tiles{grid-template-columns:minmax(0,1fr)}
}
+@media (max-width:760px){
+.net-grid{grid-template-columns:minmax(0,1fr)}
+}
@media (max-width:600px){
.modal>.sheet::before{content:"";display:block;flex:none;width:36px;height:5px;border-radius:3px;background:rgba(60,60,67,.3);margin:-8px auto 14px}
.sheet .sh{margin-bottom:12px}
@@ -642,17 +651,21 @@ input[type=color].swi::-webkit-color-swatch{border:0;border-radius:50%}
.card-h{flex-wrap:wrap}
.stat{grid-template-columns:repeat(2,1fr);row-gap:12px}
.stat>div:nth-child(odd){border-left:0;padding-left:0}
-.net-grid{grid-template-columns:minmax(0,1fr)}
.nat-row{flex-wrap:wrap;gap:8px}
+.net-lpmu{gap:12px}
+.net-lpmu-status{flex-basis:100%}
.led-f{flex-wrap:wrap}
-.seg.full:has(>button:nth-child(4)){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:1fr}
-.seg.full:has(>button:nth-child(4)) button{min-height:34px;padding:5px 8px}
+.seg.full:not(.fan-modes):has(>button:nth-child(4)){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:1fr}
+.seg.full:not(.fan-modes):has(>button:nth-child(4)) button{min-height:34px;padding:5px 8px}
.seg button{height:auto;min-height:28px;line-height:18px;padding:5px 8px;white-space:normal}
+.fans-grid>.fan-card:not(:only-child){padding-inline:12px}
+.seg.fan-modes button{padding-inline:2px;white-space:nowrap}
+.seg.fan-modes button:focus-visible{outline:2px solid var(--accent-text);outline-offset:1px}
.memory-gauges{grid-template-columns:minmax(0,1fr)}
.ota-server{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
.ota-server>.t-label,.ota-server>.field{grid-column:1/-1}
-.sys-top,.sys-mid,.fans-grid,.led-grid,.ota-partitions,.kv-grid.k2,.match-grid{grid-template-columns:1fr}
-.kv-grid.k4{grid-template-columns:minmax(0,1fr)}
+.sys-top,.sys-mid,.fans-grid,.led-grid,.ota-partitions,.match-grid{grid-template-columns:1fr}
+.kv-grid.k2,.kv-grid.k4{grid-template-columns:minmax(0,1fr)}
}
/* Approved command list: one surface, centered header, full-width disclosure. */
diff --git a/components/ts_webui/web/index.html b/components/ts_webui/web/index.html
index 30a47ba..a2088b2 100644
--- a/components/ts_webui/web/index.html
+++ b/components/ts_webui/web/index.html
@@ -5,7 +5,7 @@
TianshanOS
-
+
diff --git a/components/ts_webui/web/js/app.js b/components/ts_webui/web/js/app.js
index 75875c6..42c4cf6 100644
--- a/components/ts_webui/web/js/app.js
+++ b/components/ts_webui/web/js/app.js
@@ -1182,7 +1182,7 @@ async function loadSystemPage() {
${t('system.resourceMonitorOob')}
-
+
@@ -1319,10 +1319,11 @@ async function loadSystemPage() {
-
-
${sheet(520, t('system.serviceStatusTitle'), '
', `
`, 'hideServicesModal()')}
+
${sheet(520, t('system.serviceStatusTitle'), '
', `
`, 'hideServicesModal()')}
`;
+ mountPageModals(content);
+
// 初始加载(不含快捷操作,避免 ssh.commands.list 慢响应阻塞)
await refreshSystemPageOnce();
if (!pageCurrent()) return;
@@ -2049,7 +2050,7 @@ function updateFanInfo(data) {
(typeof fan.guard_temperature === 'number' ? stat(t('fanPage.guardTempBrief'), `${fan.guard_temperature.toFixed(1)} °C`) : '') +
(typeof fan.predicted_temperature === 'number' ? stat(t('fanPage.predictedTempBrief'), `${fan.predicted_temperature.toFixed(1)} °C`) : '') +
(typeof fan.slope_c_per_min === 'number' ? stat(t('fanPage.slopeTempShort'), `${fan.slope_c_per_min.toFixed(2)} ${t('fanPage.slopeTempUnit')}`) : '')) : '') + '
';
- const tab = (m, label) => ``;
+ const tab = (m, label) => ``;
return `
@@ -2058,7 +2059,7 @@ function updateFanInfo(data) {
${stateText}${mode === 'auto' ? `` : ''}
${displayDuty}%
${rpm > 0 ? rpm + ' RPM' : ' '}
- ${tab('off', _off)}${tab('manual', _manual)}${tab('curve', _curve)}${tab('auto', _smart)}
+ ${tab('off', _off)}${tab('manual', _manual)}${tab('curve', _curve)}${tab('auto', _smart)}
${t('fanPage.speedAdjust')}
@@ -2139,7 +2140,24 @@ function updateServiceList(data) {
// 显示/隐藏服务模态框
function showServicesModal() {
const modal = document.getElementById('services-modal');
- if (modal) modal.classList.remove('hidden');
+ if (!modal) return;
+ const first = modal.querySelector('.xbtn');
+ const last = modal.querySelector('.sf button');
+ modal.onclick = event => {
+ if (event.target === modal) hideServicesModal();
+ };
+ modal.onkeydown = event => {
+ if (event.key === 'Escape') {
+ event.preventDefault();
+ event.stopPropagation();
+ hideServicesModal();
+ } else if (event.key === 'Tab' && event.target === (event.shiftKey ? first : last)) {
+ event.preventDefault();
+ (event.shiftKey ? last : first).focus();
+ }
+ };
+ modal.classList.remove('hidden');
+ first.focus();
}
/**
@@ -2195,7 +2213,9 @@ async function clearTestTemp() {
function hideServicesModal() {
const modal = document.getElementById('services-modal');
- if (modal) modal.classList.add('hidden');
+ if (!modal) return;
+ modal.classList.add('hidden');
+ document.getElementById('services-trigger')?.focus({ preventScroll: true });
}
async function setFanSpeed(id, speed) {
@@ -6639,13 +6659,15 @@ async function loadNetworkPage() {
-
+
${t('networkPage.lpmuAccessTitle')}
${t('networkPage.lpmuAccessIdle')}
-
-
+
+
+
+
+
-
diff --git a/tests/macos27/ui-correction.browser.cjs b/tests/macos27/ui-correction.browser.cjs
index 76dcc9e..6bc1177 100644
--- a/tests/macos27/ui-correction.browser.cjs
+++ b/tests/macos27/ui-correction.browser.cjs
@@ -2,7 +2,7 @@
const {test, before, after} = require('node:test');
const assert = require('node:assert/strict');
const path = require('node:path'), fs = require('node:fs');
-const {chromium} = require('playwright');
+const {chromium} = require('../prompts/node_modules/playwright');
const L = require('../macos27-r2/lib.cjs');
const out = path.join(L.REPO, 'output/playwright/ui-correction');
let browser, fixture;
@@ -136,3 +136,72 @@ for(const language of ['zh-CN','en-US']) test(language+': all eight pages at des
assert.deepEqual(errors,[]);
} finally {await page.close();}
});
+
+test('phone: certificate text, fan mode controls, service sheet and network error fit the viewport', async () => {
+ const page = await browser.newPage({ viewport: { width: 393, height: 694 } });
+ page.setDefaultTimeout(5000);
+ const go = route => page.goto(L.pageUrl(fixture.origin, route));
+ const fitsViewport = () => page.evaluate(() => document.documentElement.scrollWidth === innerWidth);
+ try {
+ await page.route('**/api/v1/cert/status*', route => route.fulfill({ json: { code: 0, data: {
+ has_certificate: true,
+ validity: 'valid',
+ https: { running: true, loaded_certificate_sha256: 'A'.repeat(64) },
+ cert_info: { serial: 'B'.repeat(64), validity: 'valid' }
+ } } }));
+ await go('/security');
+ await page.locator('#cert-active-fingerprint:not(:empty)').waitFor();
+ assert(await fitsViewport(), 'certificate text stays inside the document');
+ assert(await page.locator('#cert-status-card').evaluate(card => card.scrollWidth <= card.clientWidth));
+
+ await page.route('**/api/v1/service/list*', route => route.fulfill({ json: { code: 0, data: {
+ services: Array.from({ length: 16 }, (_, index) => ({ name: `service-${index}`, state: 'RUNNING', healthy: true }))
+ } } }));
+ await go('/');
+ const modes = page.locator('.fan-modes').first().locator('button');
+ await modes.first().waitFor();
+ const headerGap = await page.evaluate(() => {
+ const header = document.querySelector('.header');
+ const main = document.querySelector('.main');
+ return main.getBoundingClientRect().top - header.getBoundingClientRect().bottom;
+ });
+ assert.equal(headerGap, 12, 'the main panel starts below the two-row header with a gap');
+ const tops = await modes.evaluateAll(buttons => buttons.map(button => button.getBoundingClientRect().top));
+ assert.equal(tops.length, 4);
+ assert.equal(new Set(tops).size, 1);
+ assert(await modes.first().evaluate(button => {
+ const style = getComputedStyle(button);
+ const track = getComputedStyle(button.parentElement);
+ return style.borderTopWidth === '0px' && style.backgroundColor === 'rgba(0, 0, 0, 0)' &&
+ track.backgroundColor !== 'rgba(0, 0, 0, 0)';
+ }), 'fan modes share the desktop segment track');
+
+ await page.locator('#services-trigger').click();
+ const services = page.locator('#services-modal');
+ await services.getByText('service-15', { exact: true }).waitFor();
+ assert(await services.evaluate(modal => {
+ const title = modal.querySelector('.st').getBoundingClientRect();
+ return modal.parentElement === document.body && modal.contains(document.elementFromPoint(title.x + 4, title.y + 4));
+ }), 'the service sheet is above the header');
+ await page.keyboard.press('Escape');
+ await services.waitFor({ state: 'hidden' });
+ assert(await page.locator('#services-trigger').evaluate(button => button === document.activeElement));
+
+ await page.route('**/api/v1/network/lpmu_access/status*', route => route.fulfill({ json: { code: 0, data: {
+ run_id: 501, stage: 'failed', running: false, reason: 'access_script_failed',
+ output_tail: '✗ 错误: 没有找到可用的互联网连接'
+ } } }));
+ await go('/network');
+ const summary = page.locator('#network-lpmu-access-summary:not(:empty)');
+ await summary.waitFor();
+ assert.match(await summary.textContent(), /没有找到可用的互联网连接/);
+ assert(await summary.evaluate(text => {
+ const message = text.getBoundingClientRect();
+ const button = document.getElementById('network-lpmu-access-btn').getBoundingClientRect();
+ return text.offsetWidth === text.parentElement.clientWidth && message.bottom < button.top;
+ }), 'the error has the full status row above the actions');
+ assert(await fitsViewport());
+ } finally {
+ await page.close();
+ }
+});