LifeVta commited on
Commit
052238a
·
verified ·
1 Parent(s): e8f6b76

Update app/statics/admin/cache.html

Browse files
Files changed (1) hide show
  1. app/statics/admin/cache.html +74 -774
app/statics/admin/cache.html CHANGED
@@ -8,13 +8,13 @@
8
  <link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css" rel="stylesheet">
9
  <link href="/static/css/app.css?v={{APP_VERSION}}" rel="stylesheet">
10
  <style>
11
- body { background: #1a1a1a } /* 修改背景颜色为深灰色 */
12
- body { color: #fdfdfd } /* 修改文字颜色为浅灰色 */
13
 
14
  /* Page header */
15
  .page-hd { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:20px }
16
- .page-title{ font-size:22px; font-weight:700; line-height:1.2 }
17
- .page-sub { font-size:13px; color:var(--fg-muted); margin-top:5px }
18
  .page-actions { display:flex; gap:8px; align-items:center; flex-shrink:0 }
19
  .section-head {
20
  display:flex;
@@ -26,31 +26,32 @@
26
  .section-title {
27
  font-size:13px;
28
  font-weight:600;
29
- color:#fff;
30
  letter-spacing:.01em;
31
  }
 
32
  .page-action-btn {
33
  height:32px; padding:0 14px; border-radius:999px;
34
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
35
  font-size:13px; font-weight:600;
36
- border:1px solid #444; background:#333; color:#fdfdfd;
37
  }
38
- .page-action-btn:hover { background:#444; border-color:#555 }
39
- .page-action-btn-primary { background:#fff; border-color:#fff; color:#111 }
40
- .page-action-btn-primary:hover { background:#fdfdfd; border-color:#fdfdfd }
41
 
42
- /* Stats */
43
  .stat-grid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; margin-bottom:30px }
44
- .stat-cell { min-height:96px; padding:14px 16px; border-radius:12px; background:#333; display:flex; flex-direction:column; gap:12px }
45
  .stat-top { display:flex; align-items:center; justify-content:space-between; gap:10px }
46
- .stat-label{ font-size:11px; color:#aaa; letter-spacing:.01em; white-space:nowrap }
47
- .stat-icon { width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; color:#ccc; flex:0 0 auto }
48
  .stat-icon svg { width:14px; height:14px; stroke:currentColor }
49
  .stat-num { font-size:22px; font-weight:600; line-height:1; letter-spacing:-.02em; margin-top:auto }
50
  .stat-sub {
51
  margin-top:-4px;
52
  font-size:11px;
53
- color:#aaa;
54
  font-variant-numeric:tabular-nums;
55
  min-height:14px;
56
  }
@@ -58,7 +59,7 @@
58
  height:5px;
59
  margin-top:-2px;
60
  border-radius:999px;
61
- background:#444;
62
  overflow:hidden;
63
  }
64
  .stat-progress-fill {
@@ -66,10 +67,10 @@
66
  height:100%;
67
  width:0;
68
  border-radius:999px;
69
- background:#666;
70
  transition:width .2s ease, background-color .2s ease;
71
  }
72
- .stat-progress-fill.image { background:#4f46e5 }
73
  .stat-progress-fill.video { background:#8b5cf6 }
74
  .stat-progress-fill.over { background:#ef4444 }
75
 
@@ -84,12 +85,12 @@
84
  }
85
  .sec-tab {
86
  height:30px; padding:0 12px; border-radius:999px;
87
- font-size:12px; font-weight:500; color:#aaa;
88
- background:#333; cursor:pointer;
89
  transition:background .15s, color .15s;
90
  }
91
- .sec-tab:hover { color:#fff; background:#444 }
92
- .sec-tab.active { background:#fff; color:#111; font-weight:600 }
93
  .sec-panel { display:none }
94
  .sec-panel.active { display:block }
95
 
@@ -100,7 +101,7 @@
100
  gap:8px;
101
  margin-bottom:8px;
102
  flex-wrap:wrap;
103
- color:#aaa;
104
  font-size:12px;
105
  font-weight:500;
106
  font-family:inherit;
@@ -116,6 +117,9 @@
116
  color:inherit;
117
  flex:0 0 auto;
118
  font:inherit;
 
 
 
119
  }
120
  .toolbar-icon-btn:hover { color:#fff }
121
  .toolbar-icon-btn svg {
@@ -127,726 +131,17 @@
127
  fill:none;
128
  }
129
  .toolbar-icon-btn-danger { color:inherit }
130
- .toolbar-icon-btn-danger:hover { color:#fff }
131
  .toolbar-page-size {
132
  width:96px !important;
133
  height:28px;
134
  border-radius:999px;
135
  font:inherit;
136
- color:inherit;
137
- background:#333;
138
- border-color:transparent;
139
- flex:0 0 auto;
140
- }
141
- .pagi-btn {
142
- width:28px;
143
- height:28px;
144
- border-radius:6px;
145
- display:inline-flex;
146
- align-items:center;
147
- justify-content:center;
148
- color:inherit;
149
- transition:background .1s, color .1s;
150
- font:inherit;
151
- }
152
- .pagi-btn:hover { background:var(--border) }
153
- .pagi-btn:disabled { opacity:.35; pointer-events:none }
154
- .pagi-meta { display:flex; align-items:center; gap:0; min-height:28px; min-width:0; color:inherit; font:inherit; flex-wrap:nowrap }
155
- .pagi-page { min-width:0; padding:0 4px; font:inherit; color:inherit; font-variant-numeric:tabular-nums; white-space:nowrap }
156
- .pagi-dot { width:4px; height:4px; border-radius:50%; background:#d4d4d4; flex:0 0 auto }
157
- .pagi-info { font-size:11px; color:#a3a3a3 }
158
- .asset-summary { font-size:12px; color:#a3a3a3 }
159
- .cb {
160
- width:14px;
161
- height:14px;
162
- accent-color:#111;
163
- vertical-align:middle;
164
- }
165
-
166
- /* Table */
167
- .table-card { background:#333; border:none; border-radius:14px; overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch }
168
- .table-card > table { width:max-content; min-width:100%; border-collapse:collapse }
169
- .table-freeze-last { --table-sticky-bg:#333; --table-sticky-hover-bg:#444 }
170
- table { width:100%; border-collapse:collapse }
171
- th { background:#333; font-size:11px; font-weight:500; color:#ccc; padding:11px 16px; text-align:left; letter-spacing:.01em }
172
- td { font-size:13px; padding:13px 16px; border-bottom:none; vertical-align:middle; color:#fdfdfd }
173
- tr:last-child td { border-bottom:none }
174
- tr:hover td { background:#444 }
175
- .table-empty { text-align:center; color:#bbb; font-size:13px; padding:40px 16px }
176
- .row-name {
177
- display:flex;
178
- align-items:center;
179
- gap:10px;
180
- min-width:0;
181
- }
182
- .row-icon {
183
- width:18px;
184
- height:18px;
185
- display:inline-flex;
186
- align-items:center;
187
- justify-content:center;
188
- color:#aaa;
189
- flex:0 0 auto;
190
- }
191
- .row-icon svg {
192
- width:13px;
193
- height:13px;
194
- stroke:currentColor;
195
- stroke-linecap:round;
196
- stroke-linejoin:round;
197
- fill:none;
198
- }
199
- .row-value {
200
- min-width:0;
201
- font-family:'Geist Mono','Courier New',monospace;
202
- font-size:12px;
203
- word-break:break-all;
204
- }
205
- .row-actions {
206
- display:flex;
207
- align-items:center;
208
- gap:8px;
209
- flex-wrap:nowrap;
210
- white-space:nowrap;
211
- }
212
- .row-action {
213
- color:#aaa;
214
- width:22px;
215
- height:22px;
216
- display:inline-flex;
217
- align-items:center;
218
- justify-content:center;
219
- flex:0 0 auto;
220
- }
221
- .row-action:hover { color:#fff }
222
- .row-action-danger { color:#c77d75 }
223
- .row-action svg {
224
- width:13px;
225
- height:13px;
226
- stroke:currentColor;
227
- stroke-linecap:round;
228
- stroke-linejoin:round;
229
- fill:none;
230
- }
231
- .meta-badge {
232
- display:inline-flex;
233
- align-items:center;
234
- height:20px;
235
- padding:0 8px;
236
- border-radius:999px;
237
- font-size:11px;
238
- font-weight:500;
239
- color:#ccc;
240
- background:#444;
241
- }
242
-
243
- /* Online asset panel */
244
- /* asset sub-rows */
245
- .sub-row td { background:#2a2a2a; padding:9px 16px 9px 36px; font-size:12px; color:#aaa; border-top:1px solid #333 }
246
- .sub-row:hover td { background:#333 }
247
- .expand-btn { width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; background:none; color:#aaa; transition:transform .15s, color .15s }
248
- .expand-btn:hover { color:#fff }
249
- .expand-btn.open { transform:rotate(90deg) }
250
- .asset-count-badge { display:inline-flex; align-items:center; height:20px; padding:0 8px; border-radius:999px; font-size:11px; font-weight:500; background:#444; color:#ccc }
251
- .asset-count-badge.has-items { background:#444; color:#ccc }
252
- .asset-err { font-size:11px; color:#ef4444 }
253
- @keyframes spin { to { transform:rotate(360deg) } }
254
- .progress-bar-outer { height:6px; background:#444; border-radius:999px; overflow:hidden }
255
- .progress-bar-inner { height:100%; background:#fff; border-radius:999px; transition:width .3s }
256
-
257
- @media (max-width: 840px) {
258
- .page-hd,
259
- .section-head {
260
- flex-direction:column;
261
- align-items:flex-start;
262
- }
263
- .table-toolbar {
264
- flex-wrap:nowrap;
265
- overflow-x:auto;
266
- overflow-y:hidden;
267
- -webkit-overflow-scrolling:touch;
268
- }
269
- .table-toolbar-left,
270
- .table-toolbar-actions {
271
- flex-wrap:nowrap;
272
- flex-shrink:0;
273
- }
274
- .stat-grid {
275
- grid-template-columns:repeat(2, minmax(0, 1fr));
276
- }
277
- }
278
- </style>
279
- </head>
280
- <body>
281
-
282
- <!-- ── Header (rendered by admin-header.js) ─────────────────────────────── -->
283
- <div id="admin-header" data-active="/admin/cache"></div>
284
-
285
- <main class="admin-main" style="padding-bottom:60px">
286
-
287
- <!-- Page header -->
288
- <div class="page-hd">
289
- <div>
290
- <div class="page-title" data-i18n="cache.pageHeading">缓存管理</div>
291
- <div class="page-sub" data-i18n="cache.pageSubtitle">统一查看本地缓存文件、容量上限与账户在线资产。</div>
292
- </div>
293
- </div>
294
-
295
- <div class="section-head">
296
- <div class="section-title" data-i18n="cache.sectionOverview">缓存概览</div>
297
- </div>
298
-
299
- <!-- Stats -->
300
- <div class="stat-grid">
301
- <div class="stat-cell">
302
- <div class="stat-top">
303
- <div class="stat-label" data-i18n="cache.statImageCount">图片缓存数量</div>
304
- <span class="stat-icon" style="color:#2563eb">
305
- <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
306
- </span>
307
- </div>
308
- <div class="stat-num" id="s-img-count" style="color:#2563eb">—</div>
309
- </div>
310
- <div class="stat-cell">
311
- <div class="stat-top">
312
- <div class="stat-label" data-i18n="cache.statVideoCount">视频缓存数量</div>
313
- <span class="stat-icon" style="color:#7c3aed">
314
- <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>
315
- </span>
316
- </div>
317
- <div class="stat-num" id="s-vid-count" style="color:#7c3aed">—</div>
318
- </div>
319
- <div class="stat-cell">
320
- <div class="stat-top">
321
- <div class="stat-label" data-i18n="cache.statImageSize">图片缓存大小</div>
322
- <span class="stat-icon" style="color:#2563eb">
323
- <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
324
- </span>
325
- </div>
326
- <div class="stat-num" id="s-img-size" style="color:#2563eb">—</div>
327
- <div class="stat-sub" id="s-img-usage">—</div>
328
- <div class="stat-progress" aria-hidden="true">
329
- <span class="stat-progress-fill image" id="s-img-progress"></span>
330
- </div>
331
- </div>
332
- <div class="stat-cell">
333
- <div class="stat-top">
334
- <div class="stat-label" data-i18n="cache.statVideoSize">视频缓存大小</div>
335
- <span class="stat-icon" style="color:#7c3aed">
336
- <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
337
- </span>
338
- </div>
339
- <div class="stat-num" id="s-vid-size" style="color:#7c3aed">—</div>
340
- <div class="stat-sub" id="s-vid-usage">—</div>
341
- <div class="stat-progress" aria-hidden="true">
342
- <span class="stat-progress-fill video" id="s-vid-progress"></span>
343
- </div>
344
- </div>
345
- </div>
346
-
347
- <div class="section-head">
348
- <div class="section-title" data-i18n="cache.sectionDetails">缓存明细</div>
349
- </div>
350
- <div class="sec-tabs" style="margin:-2px 0 14px">
351
- <button class="sec-tab active" onclick="switchView('image')" data-cache-view="image" data-i18n="cache.tabLocalImage">本地图片</button>
352
- <button class="sec-tab" onclick="switchView('video')" data-cache-view="video" data-i18n="cache.tabLocalVideo">本地视频</button>
353
- <button class="sec-tab" onclick="switchView('online')" data-cache-view="online" data-i18n="cache.tabOnline">在线资产</button>
354
- </div>
355
-
356
- <!-- ── 本地缓存 panel ─────────────────────────────────────────── -->
357
- <div class="sec-panel active" id="panel-local">
358
- <div class="table-toolbar">
359
- <div class="table-toolbar-left" style="display:flex;align-items:center;gap:6px">
360
- <button class="pagi-btn" onclick="prevPage()" id="btn-prev" disabled>
361
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 18 9 12 15 6"/></svg>
362
- </button>
363
- <div class="pagi-meta">
364
- <span class="pagi-page" id="pagi-page">第 0 / 0 页</span>
365
- </div>
366
- <button class="pagi-btn" onclick="nextPage()" id="btn-next" disabled>
367
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
368
- </button>
369
- </div>
370
- <div class="table-toolbar-actions">
371
- <button class="toolbar-icon-btn toolbar-icon-btn-danger" onclick="clearLocal()" id="btn-clear">
372
- <svg viewBox="0 0 24 24" stroke-width="1.8"><path d="M5 7h14"/><path d="M9 7V4h6v3"/><path d="M8 10v7"/><path d="M12 10v7"/><path d="M16 10v7"/><path d="M7 7l1 13h8l1-13"/></svg>
373
- </button>
374
- <button class="toolbar-icon-btn toolbar-icon-btn-danger" onclick="deleteSelectedLocal()" id="btn-local-delete-selected" style="display:none">
375
- <svg viewBox="0 0 24 24" stroke-width="1.8"><path d="M5 7h14"/><path d="M9 7V4h6v3"/><path d="M8 10v7"/><path d="M12 10v7"/><path d="M16 10v7"/><path d="M7 7l1 13h8l1-13"/></svg>
376
- </button>
377
- <select class="input toolbar-page-size" id="page-size-sel" onchange="changePageSize(this.value)">
378
- <option value="50">50 / 页</option>
379
- <option value="100">100 / 页</option>
380
- <option value="200">200 / 页</option>
381
- <option value="500">500 / 页</option>
382
- <option value="1000">1000 / 页</option>
383
- <option value="2000">2000 / 页</option>
384
- </select>
385
- </div>
386
- </div>
387
-
388
- <div class="table-card table-freeze-last">
389
- <table>
390
- <thead>
391
- <tr>
392
- <th style="width:36px"><input type="checkbox" class="cb" id="cb-local-all" onchange="toggleAllLocal(this.checked)"></th>
393
- <th data-i18n="cache.colFileName">文件名</th>
394
- <th style="width:100px" data-i18n="cache.colSize">大小</th>
395
- <th style="width:160px" data-i18n="cache.colModified">修改时间</th>
396
- <th style="width:56px" data-i18n="cache.colActions">操作</th>
397
- </tr>
398
- </thead>
399
- <tbody id="cache-tbody"></tbody>
400
- </table>
401
- </div>
402
- </div>
403
-
404
- <!-- ── 在线资产 panel ──────────────────────────────────────────── -->
405
- <div class="sec-panel" id="panel-online">
406
- <div class="table-toolbar" style="margin-bottom:14px">
407
- <div class="table-toolbar-left">
408
- <span id="asset-summary" class="asset-summary"></span>
409
- </div>
410
- <div class="table-toolbar-actions">
411
- <button class="toolbar-icon-btn" onclick="loadAssets()" id="btn-load-assets">
412
- <svg viewBox="0 0 24 24" stroke-width="1.8"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>
413
- </button>
414
- <button class="toolbar-icon-btn toolbar-icon-btn-danger" onclick="clearAllAssets()" id="btn-clear-all-assets" style="display:none">
415
- <svg viewBox="0 0 24 24" stroke-width="1.8"><path d="M5 7h14"/><path d="M9 7V4h6v3"/><path d="M8 10v7"/><path d="M12 10v7"/><path d="M16 10v7"/><path d="M7 7l1 13h8l1-13"/></svg>
416
- </button>
417
- <button class="toolbar-icon-btn toolbar-icon-btn-danger" onclick="clearSelectedAssets()" id="btn-clear-selected-assets" style="display:none">
418
- <svg viewBox="0 0 24 24" stroke-width="1.8"><path d="M5 7h14"/><path d="M9 7V4h6v3"/><path d="M8 10v7"/><path d="M12 10v7"/><path d="M16 10v7"/><path d="M7 7l1 13h8l1-13"/></svg>
419
- </button>
420
- <button class="toolbar-icon-btn toolbar-icon-btn-danger" onclick="cancelAssetClear()" id="btn-asset-cancel" style="display:none">
421
- <svg viewBox="0 0 24 24" stroke-width="1.8"><path d="M6 6 18 18"/><path d="M18 6 6 18"/></svg>
422
- </button>
423
- </div>
424
- </div>
425
-
426
-
427
- <div class="table-card table-freeze-last" id="assets-table-wrap">
428
- <table>
429
- <thead>
430
- <tr>
431
- <th style="width:36px"><input type="checkbox" class="cb" id="cb-asset-all" onchange="toggleAllAssets(this.checked)"></th>
432
- <th style="width:32px"></th>
433
- <th data-i18n="cache.colToken">Token</th>
434
- <th style="width:72px" data-i18n="cache.colFileCount">文件数</th>
435
- <th style="width:56px" data-i18n="cache.colActions">操作</th>
436
- </tr>
437
- </thead>
438
- <tbody id="assets-tbody"></tbody>
439
- </table>
440
- </div>
441
- </div>
442
-
443
- </main>
444
-
445
- <script src="/static/js/i18n.js?v={{APP_VERSION}}"></script>
446
- <script src="/static/js/auth.js?v={{APP_VERSION}}"></script>
447
- <script src="/static/js/admin-header.js?v={{APP_VERSION}}"></script>
448
- <script src="/static/js/toast.js?v={{APP_VERSION}}"></script>
449
- <script src="/static/js/footer.js?v={{APP_VERSION}}"></script>
450
- <script>
451
- const PAGE_SIZE_KEY = 'admin.cache.page_size';
452
- const PAGE_SIZE_OPTIONS = [50, 100, 200, 500, 1000, 2000];
453
- const REFRESH_ICON = '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>';
454
- const SPINNER_ICON = '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" style="animation:spin .8s linear infinite"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>';
455
-
456
- let _type = 'image';
457
- let _view = 'image';
458
- let _page = 1;
459
- let _pageSize = loadSavedPageSize();
460
- let _total = 0;
461
- let _localItems = [];
462
- const _localSel = new Set();
463
- let _assetData = [];
464
- let _assetTotal = 0;
465
- let _expanded = {};
466
- const _assetSel = new Set();
467
- let _assetTaskId = null;
468
- let _assetEs = null;
469
- let _assetLoaded = false;
470
- let _localViewVersion = 0;
471
- let _localViewCacheVersion = -1;
472
- let _localViewCache = null;
473
- let _assetViewVersion = 0;
474
- let _assetViewCacheVersion = -1;
475
- let _assetViewCache = null;
476
-
477
- function tr(key, params, fallback) {
478
- const value = t(key, params);
479
- return value === key ? (fallback ?? key) : value;
480
- }
481
-
482
- function waitI18n() {
483
- return new Promise((resolve) => I18n.onReady(resolve));
484
- }
485
-
486
- function getLocale() {
487
- return I18n.getLang() === 'en' ? 'en-US' : 'zh-CN';
488
- }
489
-
490
- function getTypeNoun(type = _type) {
491
- return tr(type === 'image' ? 'cache.typeImageNoun' : 'cache.typeVideoNoun', null, type === 'image' ? '图片' : '视频');
492
- }
493
-
494
- function loadSavedPageSize() {
495
- const raw = Number(localStorage.getItem(PAGE_SIZE_KEY));
496
- return PAGE_SIZE_OPTIONS.includes(raw) ? raw : 100;
497
- }
498
-
499
- function _fmtRatio(value) {
500
- const num = Number(value);
501
- if (!Number.isFinite(num)) return tr('cache.na', null, '—');
502
- return `${num.toFixed(1)}%`;
503
- }
504
-
505
- function _usageSummary(stats) {
506
- const used = _fmtBytes(stats.size_bytes ?? 0);
507
- if (!stats?.limited || !stats?.limit_bytes) {
508
- return tr('cache.usageSummaryUnlimited', { used }, `${used} · 未限制`);
509
- }
510
- const limit = _fmtBytes(stats.limit_bytes);
511
- const percent = _fmtRatio(stats.usage_percent);
512
- return tr(
513
- 'cache.usageSummaryLimited',
514
- { used, limit, percent },
515
- `${used} / ${limit} · ${percent}`
516
- );
517
- }
518
-
519
- function _applyUsageBar(id, type, stats) {
520
- const el = document.getElementById(id);
521
- if (!el) return;
522
- const limited = !!stats?.limited && Number(stats.limit_bytes) > 0;
523
- const percent = limited ? Number(stats.usage_percent ?? 0) : 0;
524
- const safe = Number.isFinite(percent) ? percent : 0;
525
- el.style.width = `${Math.max(0, Math.min(safe, 100))}%`;
526
- el.classList.toggle('over', limited && safe > 100);
527
- el.classList.toggle('image', type === 'image');
528
- el.classList.toggle('video', type === 'video');
529
- }
530
-
531
- function invalidateLocalView() {
532
- _localViewVersion += 1;
533
- }
534
-
535
- function invalidateAssetView() {
536
- _assetViewVersion += 1;
537
- }
538
-
539
- function getLocalView() {
540
- if (_localViewCache && _localViewCacheVersion === _localViewVersion) return _localViewCache;
541
-
542
- const selectedNames = [];
543
- for (const item of _localItems) {
544
- if (_localSel.has(item.name)) selectedNames.push(item.name);
545
- }
546
- const selectedCount = selectedNames.length;
547
-
548
- _localViewCacheVersion = _localViewVersion;
549
- _localViewCache = {
550
- items: _localItems,
551
- selectedNames,
552
- totalItems: _localItems.length,
553
- selectedCount,
554
- hasSelection: selectedCount > 0,
555
- allSelected: _localItems.length > 0 && selectedCount === _localItems.length,
556
- someSelected: selectedCount > 0 && selectedCount < _localItems.length,
557
- };
558
- return _localViewCache;
559
- }
560
-
561
- function getAssetView() {
562
- if (_assetViewCache && _assetViewCacheVersion === _assetViewVersion) return _assetViewCache;
563
-
564
- const rows = [];
565
- const clearableTokens = [];
566
- const selectedClearableTokens = [];
567
- let countedAssets = 0;
568
- let selectedCount = 0;
569
-
570
- for (const row of _assetData) {
571
- const masked = row.masked || _maskToken(row.token || '');
572
- const count = row.count || 0;
573
- const hasItems = count > 0;
574
- const isSelected = _assetSel.has(row.token);
575
- const assets = Array.isArray(row.assets) ? row.assets : [];
576
-
577
- countedAssets += count;
578
- if (isSelected) selectedCount += 1;
579
- if (hasItems) clearableTokens.push(row.token);
580
- if (isSelected && hasItems) selectedClearableTokens.push(row.token);
581
-
582
- rows.push({
583
- row,
584
- masked,
585
- assets,
586
- hasItems,
587
- isOpen: !!_expanded[masked],
588
- isSelected,
589
- });
590
- }
591
-
592
- const totalRows = rows.length;
593
- const selectedClearableCount = selectedClearableTokens.length;
594
-
595
- _assetViewCacheVersion = _assetViewVersion;
596
- _assetViewCache = {
597
- loaded: _assetLoaded,
598
- rows,
599
- totalRows,
600
- totalAccounts: totalRows,
601
- totalAssets: _assetTotal || countedAssets,
602
- selectedCount,
603
- hasSelection: selectedCount > 0,
604
- allSelected: totalRows > 0 && selectedCount === totalRows,
605
- someSelected: selectedCount > 0 && selectedCount < totalRows,
606
- clearableTokens,
607
- hasClearable: clearableTokens.length > 0,
608
- selectedClearableTokens,
609
- selectedClearableCount,
610
- };
611
- return _assetViewCache;
612
- }
613
-
614
- function setLoadAssetsButton(labelKey, fallback, spinning = false) {
615
- const btn = document.getElementById('btn-load-assets');
616
- if (!btn) return;
617
- btn.innerHTML = spinning ? SPINNER_ICON : REFRESH_ICON;
618
- const label = tr(labelKey, null, fallback);
619
- btn.setAttribute('data-tip', label);
620
- btn.setAttribute('aria-label', label);
621
- btn.setAttribute('title', label);
622
- }
623
-
624
- function applyToolbarI18n() {
625
- const tips = [
626
- ['btn-clear', 'cache.clearCurrent', '清空当前缓存'],
627
- ['btn-local-delete-selected', 'cache.deleteSelected', '删除选中'],
628
- ['btn-load-assets', 'cache.loadAssets', '加载资产列表'],
629
- ['btn-clear-all-assets', 'cache.clearAll', '清理全部'],
630
- ['btn-clear-selected-assets', 'cache.clearSelected', '清理选中'],
631
- ['btn-asset-cancel', 'cache.cancel', '取消'],
632
- ];
633
- tips.forEach(([id, key, fallback]) => {
634
- const el = document.getElementById(id);
635
- if (!el) return;
636
- const label = tr(key, null, fallback);
637
- el.setAttribute('data-tip', label);
638
- el.setAttribute('aria-label', label);
639
- el.setAttribute('title', label);
640
- });
641
- }
642
-
643
- function updateAssetSummary(view = getAssetView()) {
644
- if (!view.loaded) {
645
- document.getElementById('asset-summary').textContent = tr('cache.assetSummaryIdle', null, '点击右侧获取在线资产');
646
- updateAssetBatchButtons(view);
647
- return;
648
- }
649
- document.getElementById('asset-summary').textContent = tr(
650
- 'cache.assetSummary',
651
- { accounts: view.totalAccounts, files: view.totalAssets },
652
- `共 ${view.totalAccounts} 个账户 · ${view.totalAssets} 个文件`
653
- );
654
- updateAssetBatchButtons(view);
655
- }
656
-
657
- function applyCacheI18n() {
658
- document.title = tr('cache.pageTitle', null, 'Grok2API - 缓存管理');
659
- document.querySelectorAll('#page-size-sel option').forEach((opt) => {
660
- opt.textContent = tr('cache.pageSizeOption', { n: opt.value }, `${opt.value} / 页`);
661
- });
662
- const pageSizeSel = document.getElementById('page-size-sel');
663
- if (pageSizeSel) pageSizeSel.value = String(_pageSize);
664
- applyToolbarI18n();
665
- setLoadAssetsButton('cache.loadAssets', '加载资产列表');
666
- _renderPagi();
667
- if (_assetLoaded) {
668
- _renderAssets();
669
- }
670
- updateAssetSummary();
671
- }
672
-
673
- async function _api(method, path, body) {
674
- const key = await adminKey.get();
675
- const r = await fetch(ADMIN_API + path, {
676
- method,
677
- headers: { ...(body != null && { 'Content-Type': 'application/json' }), Authorization: `Bearer ${key}` },
678
- ...(body != null && { body: JSON.stringify(body) }),
679
- });
680
- if (!r.ok) {
681
- const d = await r.json().catch(() => ({}));
682
- throw new Error(d.detail || r.status);
683
- }
684
- return r.json();
685
- }
686
-
687
- async function loadStats() {
688
- try {
689
- const d = await _api('GET', '/cache');
690
- const img = d.local_image || {};
691
- const vid = d.local_video || {};
692
- document.getElementById('s-img-count').textContent = img.count ?? 0;
693
- document.getElementById('s-img-size').textContent = _fmtMb(img.size_mb);
694
- document.getElementById('s-img-usage').textContent = _usageSummary(img);
695
- _applyUsageBar('s-img-progress', 'image', img);
696
- document.getElementById('s-vid-count').textContent = vid.count ?? 0;
697
- document.getElementById('s-vid-size').textContent = _fmtMb(vid.size_mb);
698
- document.getElementById('s-vid-usage').textContent = _usageSummary(vid);
699
- _applyUsageBar('s-vid-progress', 'video', vid);
700
- } catch (e) {
701
- console.warn('stats error', e);
702
- }
703
- }
704
-
705
- async function loadList() {
706
- try {
707
- const d = await _api('GET', `/cache/list?type=${_type}&page=${_page}&page_size=${_pageSize}`);
708
- 把整体背景改为深灰色的代码如下,你可以把这段代码复制到你的 html 文件中。
709
-
710
- ```html
711
- <!DOCTYPE html>
712
- <html lang="zh-CN">
713
- <head>
714
- <meta charset="UTF-8">
715
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
716
- <title data-i18n="cache.pageTitle">Grok2API - 缓存管理</title>
717
- <link rel="icon" href="/favicon.ico?v={{APP_VERSION}}">
718
- <link href="[https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css](https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css)" rel="stylesheet">
719
- <link href="/static/css/app.css?v={{APP_VERSION}}" rel="stylesheet">
720
- <style>
721
- body { background: #1a1a1a } /* 修改背景颜色为深灰色 */
722
- body { color: #fdfdfd } /* 修改文字颜色为浅灰色 */
723
-
724
- /* Page header */
725
- .page-hd { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:20px }
726
- .page-title{ font-size:22px; font-weight:700; line-height:1.2 }
727
- .page-sub { font-size:13px; color:var(--fg-muted); margin-top:5px }
728
- .page-actions { display:flex; gap:8px; align-items:center; flex-shrink:0 }
729
- .section-head {
730
- display:flex;
731
- align-items:baseline;
732
- justify-content:space-between;
733
- gap:12px;
734
- margin:28px 0 14px;
735
- }
736
- .section-title {
737
- font-size:13px;
738
- font-weight:600;
739
- color:#fff;
740
- letter-spacing:.01em;
741
- }
742
- .page-action-btn {
743
- height:32px; padding:0 14px; border-radius:999px;
744
- display:inline-flex; align-items:center; justify-content:center; gap:6px;
745
- font-size:13px; font-weight:600;
746
- border:1px solid #444; background:#333; color:#fdfdfd;
747
- }
748
- .page-action-btn:hover { background:#444; border-color:#555 }
749
- .page-action-btn-primary { background:#fff; border-color:#fff; color:#111 }
750
- .page-action-btn-primary:hover { background:#fdfdfd; border-color:#fdfdfd }
751
-
752
- /* Stats */
753
- .stat-grid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; margin-bottom:30px }
754
- .stat-cell { min-height:96px; padding:14px 16px; border-radius:12px; background:#333; display:flex; flex-direction:column; gap:12px }
755
- .stat-top { display:flex; align-items:center; justify-content:space-between; gap:10px }
756
- .stat-label{ font-size:11px; color:#aaa; letter-spacing:.01em; white-space:nowrap }
757
- .stat-icon { width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; color:#ccc; flex:0 0 auto }
758
- .stat-icon svg { width:14px; height:14px; stroke:currentColor }
759
- .stat-num { font-size:22px; font-weight:600; line-height:1; letter-spacing:-.02em; margin-top:auto }
760
- .stat-sub {
761
- margin-top:-4px;
762
- font-size:11px;
763
- color:#aaa;
764
- font-variant-numeric:tabular-nums;
765
- min-height:14px;
766
- }
767
- .stat-progress {
768
- height:5px;
769
- margin-top:-2px;
770
- border-radius:999px;
771
- background:#444;
772
- overflow:hidden;
773
- }
774
- .stat-progress-fill {
775
- display:block;
776
- height:100%;
777
- width:0;
778
- border-radius:999px;
779
- background:#666;
780
- transition:width .2s ease, background-color .2s ease;
781
- }
782
- .stat-progress-fill.image { background:#4f46e5 }
783
- .stat-progress-fill.video { background:#8b5cf6 }
784
- .stat-progress-fill.over { background:#ef4444 }
785
-
786
- /* Section tabs */
787
- .sec-tabs {
788
- display:flex;
789
- align-items:center;
790
- gap:6px;
791
- align-self:flex-start;
792
- flex-wrap:wrap;
793
- padding:0;
794
- }
795
- .sec-tab {
796
- height:30px; padding:0 12px; border-radius:999px;
797
- font-size:12px; font-weight:500; color:#aaa;
798
- background:#333; cursor:pointer;
799
- transition:background .15s, color .15s;
800
- }
801
- .sec-tab:hover { color:#fff; background:#444 }
802
- .sec-tab.active { background:#fff; color:#111; font-weight:600 }
803
- .sec-panel { display:none }
804
- .sec-panel.active { display:block }
805
-
806
- /* Toolbar */
807
- .table-toolbar {
808
- display:flex;
809
- align-items:center;
810
- gap:8px;
811
- margin-bottom:8px;
812
- flex-wrap:wrap;
813
- color:#aaa;
814
- font-size:12px;
815
- font-weight:500;
816
- font-family:inherit;
817
- }
818
- .table-toolbar-left { flex:1 }
819
- .table-toolbar-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap }
820
- .toolbar-icon-btn {
821
- width:28px;
822
- height:28px;
823
- display:inline-flex;
824
- align-items:center;
825
- justify-content:center;
826
- color:inherit;
827
- flex:0 0 auto;
828
- font:inherit;
829
- }
830
- .toolbar-icon-btn:hover { color:#fff }
831
- .toolbar-icon-btn svg {
832
- width:14px;
833
- height:14px;
834
- stroke:currentColor;
835
- stroke-linecap:round;
836
- stroke-linejoin:round;
837
- fill:none;
838
- }
839
- .toolbar-icon-btn-danger { color:inherit }
840
- .toolbar-icon-btn-danger:hover { color:#fff }
841
- .toolbar-page-size {
842
- width:96px !important;
843
- height:28px;
844
- border-radius:999px;
845
- font:inherit;
846
- color:inherit;
847
- background:#333;
848
- border-color:transparent;
849
  flex:0 0 auto;
 
850
  }
851
  .pagi-btn {
852
  width:28px;
@@ -858,32 +153,34 @@ async function loadList() {
858
  color:inherit;
859
  transition:background .1s, color .1s;
860
  font:inherit;
 
 
 
861
  }
862
- .pagi-btn:hover { background:var(--border) }
863
  .pagi-btn:disabled { opacity:.35; pointer-events:none }
864
  .pagi-meta { display:flex; align-items:center; gap:0; min-height:28px; min-width:0; color:inherit; font:inherit; flex-wrap:nowrap }
865
  .pagi-page { min-width:0; padding:0 4px; font:inherit; color:inherit; font-variant-numeric:tabular-nums; white-space:nowrap }
866
- .pagi-dot { width:4px; height:4px; border-radius:50%; background:#d4d4d4; flex:0 0 auto }
867
- .pagi-dot { background:#666 }
868
- .pagi-info { font-size:11px; color:#a3a3a3 }
869
- .asset-summary { font-size:12px; color:#a3a3a3 }
870
  .cb {
871
  width:14px;
872
  height:14px;
873
- accent-color:#111;
874
  vertical-align:middle;
875
  }
876
 
877
- /* Table */
878
- .table-card { background:#333; border:none; border-radius:14px; overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch }
879
  .table-card > table { width:max-content; min-width:100%; border-collapse:collapse }
880
- .table-freeze-last { --table-sticky-bg:#333; --table-sticky-hover-bg:#444 }
881
  table { width:100%; border-collapse:collapse }
882
- th { background:#333; font-size:11px; font-weight:500; color:#ccc; padding:11px 16px; text-align:left; letter-spacing:.01em }
883
- td { font-size:13px; padding:13px 16px; border-bottom:none; vertical-align:middle; color:#fdfdfd }
884
  tr:last-child td { border-bottom:none }
885
- tr:hover td { background:#444 }
886
- .table-empty { text-align:center; color:#bbb; font-size:13px; padding:40px 16px }
887
  .row-name {
888
  display:flex;
889
  align-items:center;
@@ -896,7 +193,7 @@ async function loadList() {
896
  display:inline-flex;
897
  align-items:center;
898
  justify-content:center;
899
- color:#aaa;
900
  flex:0 0 auto;
901
  }
902
  .row-icon svg {
@@ -921,16 +218,20 @@ async function loadList() {
921
  white-space:nowrap;
922
  }
923
  .row-action {
924
- color:#aaa;
925
  width:22px;
926
  height:22px;
927
  display:inline-flex;
928
  align-items:center;
929
  justify-content:center;
930
  flex:0 0 auto;
 
 
 
931
  }
932
  .row-action:hover { color:#fff }
933
- .row-action-danger { color:#c77d75 }
 
934
  .row-action svg {
935
  width:13px;
936
  height:13px;
@@ -947,23 +248,22 @@ async function loadList() {
947
  border-radius:999px;
948
  font-size:11px;
949
  font-weight:500;
950
- color:#ccc;
951
- background:#444;
952
  }
953
 
954
- /* Online asset panel */
955
- /* asset sub-rows */
956
- .sub-row td { background:#2a2a2a; padding:9px 16px 9px 36px; font-size:12px; color:#aaa; border-top:1px solid #333 }
957
- .sub-row:hover td { background:#333 }
958
- .expand-btn { width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; background:none; color:#aaa; transition:transform .15s, color .15s }
959
  .expand-btn:hover { color:#fff }
960
  .expand-btn.open { transform:rotate(90deg) }
961
- .asset-count-badge { display:inline-flex; align-items:center; height:20px; padding:0 8px; border-radius:999px; font-size:11px; font-weight:500; background:#444; color:#ccc }
962
- .asset-count-badge.has-items { background:#444; color:#ccc }
963
- .asset-err { font-size:11px; color:#ef4444 }
964
  @keyframes spin { to { transform:rotate(360deg) } }
965
- .progress-bar-outer { height:6px; background:#444; border-radius:999px; overflow:hidden }
966
- .progress-bar-inner { height:100%; background:#fff; border-radius:999px; transition:width .3s }
967
 
968
  @media (max-width: 840px) {
969
  .page-hd,
@@ -1012,29 +312,29 @@ async function loadList() {
1012
  <div class="stat-cell">
1013
  <div class="stat-top">
1014
  <div class="stat-label" data-i18n="cache.statImageCount">图片缓存数量</div>
1015
- <span class="stat-icon" style="color:#2563eb">
1016
  <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
1017
  </span>
1018
  </div>
1019
- <div class="stat-num" id="s-img-count" style="color:#2563eb">—</div>
1020
  </div>
1021
  <div class="stat-cell">
1022
  <div class="stat-top">
1023
  <div class="stat-label" data-i18n="cache.statVideoCount">视频缓存数量</div>
1024
- <span class="stat-icon" style="color:#7c3aed">
1025
  <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>
1026
  </span>
1027
  </div>
1028
- <div class="stat-num" id="s-vid-count" style="color:#7c3aed">—</div>
1029
  </div>
1030
  <div class="stat-cell">
1031
  <div class="stat-top">
1032
  <div class="stat-label" data-i18n="cache.statImageSize">图片缓存大小</div>
1033
- <span class="stat-icon" style="color:#2563eb">
1034
  <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
1035
  </span>
1036
  </div>
1037
- <div class="stat-num" id="s-img-size" style="color:#2563eb">—</div>
1038
  <div class="stat-sub" id="s-img-usage">—</div>
1039
  <div class="stat-progress" aria-hidden="true">
1040
  <span class="stat-progress-fill image" id="s-img-progress"></span>
@@ -1043,11 +343,11 @@ async function loadList() {
1043
  <div class="stat-cell">
1044
  <div class="stat-top">
1045
  <div class="stat-label" data-i18n="cache.statVideoSize">视频缓存大小</div>
1046
- <span class="stat-icon" style="color:#7c3aed">
1047
  <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
1048
  </span>
1049
  </div>
1050
- <div class="stat-num" id="s-vid-size" style="color:#7c3aed">—</div>
1051
  <div class="stat-sub" id="s-vid-usage">—</div>
1052
  <div class="stat-progress" aria-hidden="true">
1053
  <span class="stat-progress-fill video" id="s-vid-progress"></span>
@@ -1637,10 +937,10 @@ function _renderAssets(view = getAssetView()) {
1637
  <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><path d="M8 3h6l5 5v13H8a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M14 3v5h5"/></svg>
1638
  </span>
1639
  <span class="row-value" style="font-size:11px">${_esc(asset.name || asset.id)}</span>
1640
- ${asset.content_type ? `<span style="color:#aaa;font-size:11px">${_esc(asset.content_type)}</span>` : ''}
1641
  </div>
1642
  </td>
1643
- <td style="color:#aaa;font-size:11px">${asset.size ? _fmtBytes(asset.size) : _esc(naLabel)}</td>
1644
  <td>
1645
  <div class="row-actions"><button class="row-action row-action-danger" onclick="deleteAssetItem('${_esc(row.token)}','${_esc(masked)}','${_esc(asset.id)}')" title="${_esc(deleteLabel)}" aria-label="${_esc(deleteLabel)}"><svg viewBox="0 0 24 24" stroke-width="1.8"><path d="M5 7h14"/><path d="M9 7V4h6v3"/><path d="M8 10v7"/><path d="M12 10v7"/><path d="M16 10v7"/><path d="M7 7l1 13h8l1-13"/></svg></button></div>
1646
  </td>
 
8
  <link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css" rel="stylesheet">
9
  <link href="/static/css/app.css?v={{APP_VERSION}}" rel="stylesheet">
10
  <style>
11
+ /* 整体深色背景及基础文字颜色 */
12
+ body { background: #18181b; color: #e4e4e7; }
13
 
14
  /* Page header */
15
  .page-hd { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:20px }
16
+ .page-title{ font-size:22px; font-weight:700; line-height:1.2; color: #ffffff; }
17
+ .page-sub { font-size:13px; color:#a1a1aa; margin-top:5px }
18
  .page-actions { display:flex; gap:8px; align-items:center; flex-shrink:0 }
19
  .section-head {
20
  display:flex;
 
26
  .section-title {
27
  font-size:13px;
28
  font-weight:600;
29
+ color:#f4f4f5;
30
  letter-spacing:.01em;
31
  }
32
+ /* 按钮深色适配 */
33
  .page-action-btn {
34
  height:32px; padding:0 14px; border-radius:999px;
35
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
36
  font-size:13px; font-weight:600;
37
+ border:1px solid #3f3f46; background:#27272a; color:#e4e4e7;
38
  }
39
+ .page-action-btn:hover { background:#3f3f46; border-color:#52525b; color:#fff; }
40
+ .page-action-btn-primary { background:#fafafa; border-color:#fafafa; color:#111 }
41
+ .page-action-btn-primary:hover { background:#e4e4e7; border-color:#e4e4e7 }
42
 
43
+ /* Stats 卡片深色适配 */
44
  .stat-grid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; margin-bottom:30px }
45
+ .stat-cell { min-height:96px; padding:14px 16px; border-radius:12px; background:#27272a; display:flex; flex-direction:column; gap:12px; border: 1px solid #3f3f46; }
46
  .stat-top { display:flex; align-items:center; justify-content:space-between; gap:10px }
47
+ .stat-label{ font-size:11px; color:#a1a1aa; letter-spacing:.01em; white-space:nowrap }
48
+ .stat-icon { width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; color:#a3a3a3; flex:0 0 auto }
49
  .stat-icon svg { width:14px; height:14px; stroke:currentColor }
50
  .stat-num { font-size:22px; font-weight:600; line-height:1; letter-spacing:-.02em; margin-top:auto }
51
  .stat-sub {
52
  margin-top:-4px;
53
  font-size:11px;
54
+ color:#a1a1aa;
55
  font-variant-numeric:tabular-nums;
56
  min-height:14px;
57
  }
 
59
  height:5px;
60
  margin-top:-2px;
61
  border-radius:999px;
62
+ background:#3f3f46;
63
  overflow:hidden;
64
  }
65
  .stat-progress-fill {
 
67
  height:100%;
68
  width:0;
69
  border-radius:999px;
70
+ background:#52525b;
71
  transition:width .2s ease, background-color .2s ease;
72
  }
73
+ .stat-progress-fill.image { background:#3b82f6 }
74
  .stat-progress-fill.video { background:#8b5cf6 }
75
  .stat-progress-fill.over { background:#ef4444 }
76
 
 
85
  }
86
  .sec-tab {
87
  height:30px; padding:0 12px; border-radius:999px;
88
+ font-size:12px; font-weight:500; color:#a1a1aa;
89
+ background:#27272a; cursor:pointer; border:none;
90
  transition:background .15s, color .15s;
91
  }
92
+ .sec-tab:hover { color:#fff; background:#3f3f46 }
93
+ .sec-tab.active { background:#fafafa; color:#111; font-weight:600 }
94
  .sec-panel { display:none }
95
  .sec-panel.active { display:block }
96
 
 
101
  gap:8px;
102
  margin-bottom:8px;
103
  flex-wrap:wrap;
104
+ color:#a1a1aa;
105
  font-size:12px;
106
  font-weight:500;
107
  font-family:inherit;
 
117
  color:inherit;
118
  flex:0 0 auto;
119
  font:inherit;
120
+ background:none;
121
+ border:none;
122
+ cursor:pointer;
123
  }
124
  .toolbar-icon-btn:hover { color:#fff }
125
  .toolbar-icon-btn svg {
 
131
  fill:none;
132
  }
133
  .toolbar-icon-btn-danger { color:inherit }
134
+ .toolbar-icon-btn-danger:hover { color:#ef4444 }
135
  .toolbar-page-size {
136
  width:96px !important;
137
  height:28px;
138
  border-radius:999px;
139
  font:inherit;
140
+ color:#e4e4e7;
141
+ background:#27272a;
142
+ border:1px solid #3f3f46;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  flex:0 0 auto;
144
+ padding: 0 8px;
145
  }
146
  .pagi-btn {
147
  width:28px;
 
153
  color:inherit;
154
  transition:background .1s, color .1s;
155
  font:inherit;
156
+ background:none;
157
+ border:none;
158
+ cursor:pointer;
159
  }
160
+ .pagi-btn:hover { background:#3f3f46 }
161
  .pagi-btn:disabled { opacity:.35; pointer-events:none }
162
  .pagi-meta { display:flex; align-items:center; gap:0; min-height:28px; min-width:0; color:inherit; font:inherit; flex-wrap:nowrap }
163
  .pagi-page { min-width:0; padding:0 4px; font:inherit; color:inherit; font-variant-numeric:tabular-nums; white-space:nowrap }
164
+ .pagi-dot { width:4px; height:4px; border-radius:50%; background:#52525b; flex:0 0 auto }
165
+ .pagi-info { font-size:11px; color:#71717a }
166
+ .asset-summary { font-size:12px; color:#a1a1aa }
 
167
  .cb {
168
  width:14px;
169
  height:14px;
170
+ accent-color:#fafafa;
171
  vertical-align:middle;
172
  }
173
 
174
+ /* Table 深色适配 */
175
+ .table-card { background:#27272a; border:1px solid #3f3f46; border-radius:14px; overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch }
176
  .table-card > table { width:max-content; min-width:100%; border-collapse:collapse }
177
+ .table-freeze-last { --table-sticky-bg:#27272a; --table-sticky-hover-bg:#323235 }
178
  table { width:100%; border-collapse:collapse }
179
+ th { background:#27272a; font-size:11px; font-weight:500; color:#a1a1aa; padding:11px 16px; text-align:left; letter-spacing:.01em; border-bottom:1px solid #3f3f46; }
180
+ td { font-size:13px; padding:13px 16px; border-bottom:1px solid #3f3f46; vertical-align:middle; color:#e4e4e7 }
181
  tr:last-child td { border-bottom:none }
182
+ tr:hover td { background:#323235 }
183
+ .table-empty { text-align:center; color:#71717a; font-size:13px; padding:40px 16px }
184
  .row-name {
185
  display:flex;
186
  align-items:center;
 
193
  display:inline-flex;
194
  align-items:center;
195
  justify-content:center;
196
+ color:#a1a1aa;
197
  flex:0 0 auto;
198
  }
199
  .row-icon svg {
 
218
  white-space:nowrap;
219
  }
220
  .row-action {
221
+ color:#a1a1aa;
222
  width:22px;
223
  height:22px;
224
  display:inline-flex;
225
  align-items:center;
226
  justify-content:center;
227
  flex:0 0 auto;
228
+ background:none;
229
+ border:none;
230
+ cursor:pointer;
231
  }
232
  .row-action:hover { color:#fff }
233
+ .row-action-danger { color:#f87171 }
234
+ .row-action-danger:hover { color:#ef4444 }
235
  .row-action svg {
236
  width:13px;
237
  height:13px;
 
248
  border-radius:999px;
249
  font-size:11px;
250
  font-weight:500;
251
+ color:#d4d4d4;
252
+ background:#3f3f46;
253
  }
254
 
255
+ /* Online asset panel 子行适配 */
256
+ .sub-row td { background:#1f1f23; padding:9px 16px 9px 36px; font-size:12px; color:#a1a1aa; border-top:1px solid #27272a }
257
+ .sub-row:hover td { background:#27272a }
258
+ .expand-btn { width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; background:none; color:#a1a1aa; transition:transform .15s, color .15s; border:none; cursor:pointer; }
 
259
  .expand-btn:hover { color:#fff }
260
  .expand-btn.open { transform:rotate(90deg) }
261
+ .asset-count-badge { display:inline-flex; align-items:center; height:20px; padding:0 8px; border-radius:999px; font-size:11px; font-weight:500; background:#3f3f46; color:#d4d4d4 }
262
+ .asset-count-badge.has-items { background:#3f3f46; color:#d4d4d4 }
263
+ .asset-err { font-size:11px; color:#f87171 }
264
  @keyframes spin { to { transform:rotate(360deg) } }
265
+ .progress-bar-outer { height:6px; background:#3f3f46; border-radius:999px; overflow:hidden }
266
+ .progress-bar-inner { height:100%; background:#fafafa; border-radius:999px; transition:width .3s }
267
 
268
  @media (max-width: 840px) {
269
  .page-hd,
 
312
  <div class="stat-cell">
313
  <div class="stat-top">
314
  <div class="stat-label" data-i18n="cache.statImageCount">图片缓存数量</div>
315
+ <span class="stat-icon" style="color:#3b82f6">
316
  <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
317
  </span>
318
  </div>
319
+ <div class="stat-num" id="s-img-count" style="color:#3b82f6">—</div>
320
  </div>
321
  <div class="stat-cell">
322
  <div class="stat-top">
323
  <div class="stat-label" data-i18n="cache.statVideoCount">视频缓存数量</div>
324
+ <span class="stat-icon" style="color:#8b5cf6">
325
  <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>
326
  </span>
327
  </div>
328
+ <div class="stat-num" id="s-vid-count" style="color:#8b5cf6">—</div>
329
  </div>
330
  <div class="stat-cell">
331
  <div class="stat-top">
332
  <div class="stat-label" data-i18n="cache.statImageSize">图片缓存大小</div>
333
+ <span class="stat-icon" style="color:#3b82f6">
334
  <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
335
  </span>
336
  </div>
337
+ <div class="stat-num" id="s-img-size" style="color:#3b82f6">—</div>
338
  <div class="stat-sub" id="s-img-usage">—</div>
339
  <div class="stat-progress" aria-hidden="true">
340
  <span class="stat-progress-fill image" id="s-img-progress"></span>
 
343
  <div class="stat-cell">
344
  <div class="stat-top">
345
  <div class="stat-label" data-i18n="cache.statVideoSize">视频缓存大小</div>
346
+ <span class="stat-icon" style="color:#8b5cf6">
347
  <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
348
  </span>
349
  </div>
350
+ <div class="stat-num" id="s-vid-size" style="color:#8b5cf6">—</div>
351
  <div class="stat-sub" id="s-vid-usage">—</div>
352
  <div class="stat-progress" aria-hidden="true">
353
  <span class="stat-progress-fill video" id="s-vid-progress"></span>
 
937
  <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8"><path d="M8 3h6l5 5v13H8a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M14 3v5h5"/></svg>
938
  </span>
939
  <span class="row-value" style="font-size:11px">${_esc(asset.name || asset.id)}</span>
940
+ ${asset.content_type ? `<span style="color:#71717a;font-size:11px">${_esc(asset.content_type)}</span>` : ''}
941
  </div>
942
  </td>
943
+ <td style="color:#a1a1aa;font-size:11px">${asset.size ? _fmtBytes(asset.size) : _esc(naLabel)}</td>
944
  <td>
945
  <div class="row-actions"><button class="row-action row-action-danger" onclick="deleteAssetItem('${_esc(row.token)}','${_esc(masked)}','${_esc(asset.id)}')" title="${_esc(deleteLabel)}" aria-label="${_esc(deleteLabel)}"><svg viewBox="0 0 24 24" stroke-width="1.8"><path d="M5 7h14"/><path d="M9 7V4h6v3"/><path d="M8 10v7"/><path d="M12 10v7"/><path d="M16 10v7"/><path d="M7 7l1 13h8l1-13"/></svg></button></div>
946
  </td>