feat(server): 添加静态状态页与调试入口

- 将状态页、调试页改为 `wwwroot` 静态资源
  - 补充调试配置接口与前端脚本
  - 为兼容层、规划层和运行时补充日志
  - 更新集成测试覆盖新入口
This commit is contained in:
2026-04-29 14:05:02 +08:00
parent 0724efebed
commit c38faddbf0
27 changed files with 2630 additions and 1894 deletions

View File

@@ -0,0 +1,424 @@
:root {
color-scheme: light;
--bg: #f5f7fb;
--surface: #ffffff;
--line: #d8dee9;
--text: #172033;
--muted: #5b667a;
--accent: #007c89;
--good: #12805c;
--warn: #b7791f;
--bad: #b42318;
--get: #1f6feb;
--post: #2da44e;
--put: #9a6700;
--delete: #cf222e;
--code-bg: #f4f6fa;
}
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
background: var(--bg);
color: var(--text);
font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
font-size: 14px;
}
header {
border-bottom: 1px solid var(--line);
background: var(--surface);
position: sticky;
top: 0;
z-index: 10;
}
.topbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
width: min(1280px, calc(100% - 32px));
margin: 0 auto;
padding: 18px 0;
}
h1 {
margin: 0;
font-size: 22px;
font-weight: 650;
}
.actions {
display: flex;
align-items: center;
gap: 10px;
}
button {
min-height: 34px;
padding: 0 14px;
border: 1px solid var(--accent);
border-radius: 6px;
background: var(--accent);
color: #ffffff;
font: inherit;
cursor: pointer;
}
button.secondary {
background: transparent;
color: var(--accent);
}
button:disabled {
opacity: 0.55;
cursor: default;
}
.link-button {
display: inline-flex;
align-items: center;
min-height: 34px;
padding: 0 14px;
border: 1px solid var(--accent);
border-radius: 6px;
background: transparent;
color: var(--accent);
font: inherit;
text-decoration: none;
}
.link-button:hover {
background: rgba(0, 124, 137, 0.08);
}
main {
width: min(1280px, calc(100% - 32px));
margin: 22px auto 60px;
}
.meta {
border: 1px solid var(--line);
border-radius: 8px;
background: var(--surface);
margin-bottom: 18px;
}
.meta dl {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 0;
margin: 0;
padding: 12px 16px;
}
.meta dt {
color: var(--muted);
font-size: 12px;
}
.meta dd {
margin: 4px 0 0;
font-family: Consolas, "Cascadia Mono", monospace;
overflow-wrap: anywhere;
}
.meta dd.bad { color: var(--bad); }
.meta dd.good { color: var(--good); }
.group {
margin-top: 22px;
}
.group h2 {
margin: 0 0 10px 4px;
font-size: 16px;
font-weight: 650;
color: var(--muted);
}
.card {
border: 1px solid var(--line);
border-radius: 8px;
background: var(--surface);
margin-bottom: 12px;
overflow: hidden;
}
.card-head {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
cursor: pointer;
user-select: none;
}
.card-head:hover {
background: #fafbfd;
}
.badge {
flex: 0 0 auto;
min-width: 60px;
padding: 3px 10px;
border-radius: 999px;
text-align: center;
color: #ffffff;
font-weight: 650;
font-size: 12px;
letter-spacing: 0.5px;
}
.badge.GET { background: var(--get); }
.badge.POST { background: var(--post); }
.badge.PUT { background: var(--put); }
.badge.DELETE { background: var(--delete); }
.badge.OTHER { background: var(--muted); }
.card-path {
flex: 1 1 auto;
font-family: Consolas, "Cascadia Mono", monospace;
font-size: 14px;
overflow-wrap: anywhere;
}
.card-summary {
flex: 0 1 auto;
max-width: 50%;
color: var(--muted);
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.card-toggle {
flex: 0 0 auto;
color: var(--muted);
font-size: 12px;
}
.card-body {
padding: 12px 16px 16px;
border-top: 1px solid var(--line);
}
.card.collapsed .card-body {
display: none;
}
.form-row {
display: grid;
grid-template-columns: 180px minmax(0, 1fr) 90px;
gap: 8px 12px;
align-items: center;
margin-bottom: 8px;
}
.form-row .name {
font-family: Consolas, "Cascadia Mono", monospace;
color: var(--text);
overflow-wrap: anywhere;
}
.form-row .name .required {
color: var(--bad);
margin-left: 4px;
}
.form-row input[type="text"],
.form-row input[type="number"] {
width: 100%;
min-height: 32px;
padding: 4px 10px;
border: 1px solid var(--line);
border-radius: 4px;
font: inherit;
}
.form-row .type {
color: var(--muted);
font-size: 12px;
font-family: Consolas, "Cascadia Mono", monospace;
}
.body-block {
margin-top: 6px;
}
.body-label {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 6px;
}
.body-label .left {
color: var(--muted);
font-size: 12px;
}
textarea.body-editor {
width: 100%;
min-height: 140px;
padding: 10px 12px;
border: 1px solid var(--line);
border-radius: 4px;
background: var(--code-bg);
font-family: Consolas, "Cascadia Mono", monospace;
font-size: 13px;
resize: vertical;
}
.button-row {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 12px;
}
.response-block {
margin-top: 14px;
padding-top: 12px;
border-top: 1px dashed var(--line);
}
.response-summary {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
margin-bottom: 8px;
font-size: 13px;
}
.status-badge {
padding: 2px 8px;
border-radius: 4px;
color: #ffffff;
font-weight: 650;
}
.status-badge.s2xx { background: var(--good); }
.status-badge.s3xx { background: var(--get); }
.status-badge.s4xx { background: var(--warn); }
.status-badge.s5xx { background: var(--bad); }
.status-badge.error { background: var(--bad); }
pre.response-body,
pre.response-headers {
margin: 6px 0 0;
padding: 10px 12px;
background: var(--code-bg);
border: 1px solid var(--line);
border-radius: 4px;
max-height: 360px;
overflow: auto;
white-space: pre-wrap;
overflow-wrap: anywhere;
font-family: Consolas, "Cascadia Mono", monospace;
font-size: 12.5px;
}
pre.response-headers {
max-height: 160px;
}
details > summary {
cursor: pointer;
color: var(--muted);
font-size: 12px;
margin: 6px 0 0;
}
.empty-hint {
padding: 12px 0;
color: var(--muted);
font-style: italic;
}
.history {
position: fixed;
right: 16px;
bottom: 16px;
width: 360px;
max-width: calc(100vw - 32px);
max-height: 50vh;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--surface);
box-shadow: 0 8px 24px rgba(23, 32, 51, 0.12);
display: flex;
flex-direction: column;
z-index: 20;
}
.history h3 {
margin: 0;
padding: 10px 14px;
border-bottom: 1px solid var(--line);
font-size: 13px;
font-weight: 650;
display: flex;
justify-content: space-between;
align-items: center;
}
.history h3 button {
min-height: 24px;
padding: 0 8px;
font-size: 12px;
}
.history ul {
list-style: none;
margin: 0;
padding: 6px 0;
overflow: auto;
}
.history li {
padding: 6px 14px;
font-size: 12px;
border-bottom: 1px solid #edf1f7;
display: grid;
grid-template-columns: 50px 1fr auto;
gap: 8px;
align-items: center;
}
.history li:last-child { border-bottom: 0; }
.history li .h-method {
font-weight: 650;
font-family: Consolas, "Cascadia Mono", monospace;
}
.history li .h-path {
font-family: Consolas, "Cascadia Mono", monospace;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@media (max-width: 920px) {
.form-row {
grid-template-columns: 1fr;
}
.meta dl {
grid-template-columns: 1fr;
}
.history {
position: static;
width: auto;
margin-top: 18px;
max-height: none;
}
}