feat: protect admin APIs

This commit is contained in:
TTlaji committed 2026-06-05 00:25:20 +08:00
1 parent 4f027a3728
commit 1e9228e50a
13 files changed
+657 -95

No files matched your search

+142 -40
View File
@@ -715,16 +715,23 @@ video {
}
.file-input {
min-height: 34px;
min-height: 44px;
display: flex;
align-items: center;
justify-content: center;
border: 1px dashed #aeb7c4;
border-radius: 7px;
border: 1px dashed #cbd5e1;
border-radius: 10px;
color: var(--muted);
background: var(--panel-soft);
background: #f8fafc;
cursor: pointer;
padding: 0 10px;
padding: 0 13px;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.file-input:hover {
border-color: #94a3b8;
color: #334155;
background: #f1f5f9;
}
.file-input span {
@@ -735,9 +742,10 @@ video {
}
.file-input.is-selected {
border-color: #5bb9a9;
color: #075e54;
background: var(--brand-soft);
border-color: #3182ce;
color: #1d4f7a;
background: #eff6ff;
box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.1);
}
.file-input input {
@@ -752,7 +760,7 @@ video {
.admin-page {
min-height: 100vh;
background: var(--bg);
background: #f8fafc;
color: var(--ink);
}
@@ -773,21 +781,22 @@ video {
.admin-shell {
display: grid;
grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
gap: 16px;
padding: 16px 24px 32px;
grid-template-columns: minmax(0, 55fr) minmax(360px, 45fr);
align-items: start;
gap: 28px;
padding: 28px 36px 44px;
}
.admin-panel,
.admin-locked {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 8px;
box-shadow: var(--shadow);
background: #fff;
border: 1px solid #edf2f7;
border-radius: 12px;
box-shadow: 0 22px 55px rgba(15, 23, 42, 0.07);
}
.admin-panel {
padding: 16px;
padding: 24px;
}
.admin-form-heading {
@@ -815,13 +824,40 @@ video {
.admin-page .admin-form {
grid-template-columns: 1fr;
gap: 10px;
gap: 12px;
}
.admin-page .admin-form textarea {
grid-row: auto;
}
.admin-page .admin-form input[type="text"],
.admin-page .admin-form input[type="url"],
.admin-page .admin-form textarea {
border-color: #e2e8f0;
border-radius: 10px;
padding: 11px 13px;
background: #fff;
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.admin-page .admin-form input[type="text"],
.admin-page .admin-form input[type="url"] {
min-height: 44px;
}
.admin-page .admin-form textarea {
min-height: 104px;
}
.admin-page .admin-form input[type="text"]:focus,
.admin-page .admin-form input[type="url"]:focus,
.admin-page .admin-form textarea:focus {
border-color: #3182ce;
box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.14);
background: #ffffff;
}
.admin-subtitle-editor {
display: grid;
gap: 12px;
@@ -833,12 +869,23 @@ video {
margin: 0;
}
.admin-ai-panel {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #ddd6fe;
border-radius: 12px;
background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}
.admin-ai-panel h3 {
color: #312e81;
font-size: 14px;
}
.admin-ai-panel p {
color: var(--muted);
color: #5b5f7a;
font-size: 13px;
line-height: 1.45;
}
@@ -949,15 +996,15 @@ video {
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
gap: 12px;
padding: 12px;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--panel-soft);
padding: 14px;
border: 1px solid #e2e8f0;
border-radius: 10px;
background: #f8fafc;
}
.admin-video-item.is-editing {
border-color: var(--brand);
background: var(--brand-soft);
border-color: #93c5fd;
background: #eff6ff;
}
.admin-video-item h3 {
@@ -984,17 +1031,19 @@ video {
}
.danger-action {
border-color: #fecaca;
border-radius: 6px;
border-color: #fecdd3;
border-radius: 8px;
color: #be123c;
background: #fff1f2;
white-space: nowrap;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.danger-action:hover {
border-color: #fda4af;
border-color: #fb7185;
color: #9f1239;
background: #ffe4e6;
box-shadow: 0 8px 18px rgba(190, 18, 60, 0.1);
}
.primary-link,
@@ -1003,16 +1052,24 @@ video {
align-items: center;
justify-content: center;
min-height: 36px;
border: 1px solid var(--line);
border-radius: 6px;
border: 1px solid #dbe4ee;
border-radius: 8px;
padding: 0 12px;
color: var(--ink);
background: var(--panel);
background: #fff;
text-decoration: none;
cursor: pointer;
white-space: nowrap;
}
.admin-video-actions .secondary-action,
.admin-form .secondary-action {
color: #1f3b57;
border-color: #dbe4ee;
background: #f8fafc;
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}
.primary-link {
color: #fff;
background: var(--brand);
@@ -1026,8 +1083,8 @@ video {
}
.secondary-action:hover {
border-color: #b8c0cc;
background: #f9fafb;
border-color: #b8c7d9;
background: #f1f5f9;
}
.home-page {
@@ -1074,7 +1131,8 @@ video {
}
.home-dashboard-title span,
.home-dashboard-title strong {
.home-plan-card strong,
.home-plan-card small {
display: block;
}
@@ -1083,12 +1141,22 @@ video {
font-size: 12px;
}
.home-dashboard-title strong {
margin-top: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 15px;
.home-plan-card {
display: grid;
gap: 6px;
margin-top: 8px;
}
.home-plan-card strong {
color: #0f2742;
font-size: 22px;
line-height: 1.15;
}
.home-plan-card small {
color: #667085;
font-size: 12px;
line-height: 1.45;
}
.home-metrics {
@@ -1259,10 +1327,36 @@ video {
background: #e5eaf1;
}
.home-cover-image {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
opacity: 0;
transition: transform 220ms ease, opacity 160ms ease;
}
.home-cover.has-image::after {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(180deg, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0.46));
}
.home-cover.has-image .home-cover-image {
opacity: 1;
}
.home-card:hover .home-cover.has-image .home-cover-image {
transform: scale(1.03);
}
.home-favorite {
position: absolute;
top: 10px;
right: 10px;
z-index: 2;
min-height: 28px;
border-color: rgba(255, 255, 255, 0.38);
color: #fff;
@@ -1298,6 +1392,8 @@ video {
}
.home-cover-badge {
position: relative;
z-index: 2;
width: fit-content;
max-width: calc(100% - 86px);
overflow: hidden;
@@ -1311,10 +1407,16 @@ video {
}
.home-cover strong {
position: relative;
z-index: 2;
font-size: 34px;
line-height: 1;
}
.home-cover.has-image strong {
visibility: hidden;
}
.home-card-body {
padding: 18px;
}