This commit is contained in:
tao.chen
2026-08-27 12:58:48 +08:00
parent c8e4996c34
commit 7225b72906
10 changed files with 1092 additions and 923 deletions
+327
View File
@@ -0,0 +1,327 @@
:root {
--bg: #0f1115;
--panel: #1a1d24;
--panel-2: #232732;
--border: #2c3140;
--text: #e6e8ee;
--text-dim: #8a92a3;
--primary: #5b8cff;
--primary-hover: #4a7af0;
--success: #4ade80;
--danger: #f87171;
--warning: #fbbf24;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
padding: 40px 20px;
line-height: 1.5;
}
.container { max-width: 880px; margin: 0 auto; }
header { text-align: center; margin-bottom: 32px; }
h1 {
font-size: 28px;
font-weight: 600;
margin-bottom: 8px;
background: linear-gradient(90deg, #5b8cff, #a78bfa);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.subtitle { color: var(--text-dim); font-size: 14px; }
.badge {
display: inline-block;
margin-left: 8px;
padding: 2px 8px;
background: var(--panel-2);
border: 1px solid var(--border);
border-radius: 4px;
font-size: 12px;
color: var(--warning);
-webkit-text-fill-color: var(--warning);
vertical-align: middle;
}
.card {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 12px;
padding: 24px;
margin-bottom: 24px;
}
/* Drop zone */
.dropzone {
border: 2px dashed var(--border);
border-radius: 12px;
padding: 48px 24px;
text-align: center;
cursor: pointer;
transition: all 0.2s;
background: var(--panel-2);
user-select: none;
}
.dropzone:hover, .dropzone.dragover, .dropzone:focus-visible {
border-color: var(--primary);
background: rgba(91, 140, 255, 0.05);
outline: none;
}
.dropzone .icon {
font-size: 48px;
margin-bottom: 12px;
color: var(--text-dim);
}
.dropzone .hint { color: var(--text-dim); font-size: 13px; margin-top: 6px; }
/* Buttons */
.btn {
display: inline-block;
padding: 10px 20px;
background: var(--primary);
color: white;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn:hover { background: var(--primary-hover); }
.btn:disabled { background: var(--text-dim); cursor: not-allowed; }
.btn.ghost { background: var(--panel-2); }
.btn.danger { background: var(--danger); }
.btn-row { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
/* Progress */
.progress-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.progress-item {
background: var(--panel-2);
border: 1px solid var(--border);
border-radius: 8px;
padding: 12px;
transition: opacity 0.3s;
}
.progress-item.done { border-color: var(--success); }
.progress-item.error { border-color: var(--danger); }
.progress-item-head {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 13px;
color: var(--text-dim);
margin-bottom: 6px;
gap: 8px;
}
.progress-item-head .name {
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
min-width: 0;
}
.progress-item-head .size-info { font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-item-head .status {
width: 20px;
height: 20px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
flex-shrink: 0;
}
.progress-item.done .status { background: var(--success); color: #0f1115; }
.progress-item.error .status { background: var(--danger); color: #0f1115; }
.progress-bar {
height: 4px;
background: var(--border);
border-radius: 2px;
overflow: hidden;
}
.progress-bar > div {
height: 100%;
background: var(--primary);
width: 0%;
transition: width 0.2s;
}
.progress-item.done .progress-bar > div { background: var(--success); width: 100% !important; }
.progress-item.error .progress-bar > div { background: var(--danger); }
.progress-item-actions {
display: flex;
gap: 6px;
margin-top: 8px;
justify-content: flex-end;
}
.progress-item-actions button {
background: transparent;
border: 1px solid var(--border);
color: var(--text-dim);
border-radius: 4px;
padding: 3px 10px;
font-size: 12px;
cursor: pointer;
}
.progress-item-actions button:hover { color: var(--text); border-color: var(--text-dim); }
/* File list */
.files-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
gap: 12px;
}
.files-header h2 { font-size: 16px; font-weight: 600; }
.files-header .meta { font-size: 12px; color: var(--text-dim); }
/* Quota */
.quota-wrap { margin-bottom: 16px; }
.quota-row {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
color: var(--text-dim);
margin-bottom: 4px;
}
.quota-row .quota-text strong { color: var(--text); font-variant-numeric: tabular-nums; }
.quota-row .quota-text.warn strong { color: var(--warning); }
.quota-row .quota-text.danger strong { color: var(--danger); }
.quota-bar {
height: 6px;
background: var(--border);
border-radius: 3px;
overflow: hidden;
}
.quota-bar > div {
height: 100%;
background: var(--success);
width: 0%;
transition: width 0.3s, background 0.3s;
}
.quota-bar.warn > div { background: var(--warning); }
.quota-bar.danger > div { background: var(--danger); }
.file-item {
display: flex;
align-items: center;
gap: 12px;
padding: 12px;
background: var(--panel-2);
border: 1px solid var(--border);
border-radius: 8px;
margin-bottom: 8px;
}
.file-icon {
width: 36px;
height: 36px;
border-radius: 6px;
background: var(--panel);
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-name {
font-size: 14px;
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-meta {
font-size: 12px;
color: var(--text-dim);
margin-top: 2px;
display: flex;
gap: 10px;
flex-wrap: wrap;
align-items: center;
}
.file-meta .ttl { color: var(--warning); font-variant-numeric: tabular-nums; }
.file-meta .ttl.danger { color: var(--danger); }
.file-actions { display: flex; gap: 6px; }
.icon-btn {
width: 32px;
height: 32px;
border-radius: 6px;
border: 1px solid var(--border);
background: var(--panel);
color: var(--text);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
text-decoration: none;
}
.icon-btn:hover { background: var(--primary); border-color: var(--primary); }
.icon-btn.danger:hover { background: var(--danger); border-color: var(--danger); }
.empty {
text-align: center;
padding: 40px 20px;
color: var(--text-dim);
font-size: 14px;
}
.skeleton {
background: linear-gradient(90deg, var(--panel-2) 0%, var(--border) 50%, var(--panel-2) 100%);
background-size: 200% 100%;
animation: shimmer 1.4s infinite;
border-radius: 6px;
height: 56px;
margin-bottom: 8px;
}
@keyframes shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
.toast {
position: fixed;
bottom: 24px;
right: 24px;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
padding: 12px 16px;
font-size: 14px;
box-shadow: 0 8px 24px rgba(0,0,0,0.3);
opacity: 0;
transform: translateY(8px);
transition: all 0.2s;
pointer-events: none;
z-index: 9999;
max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }
footer {
text-align: center;
color: var(--text-dim);
font-size: 12px;
margin-top: 24px;
}
.total-progress {
flex: 1;
height: 4px;
background: var(--border);
border-radius: 2px;
overflow: hidden;
min-width: 120px;
}
.total-progress > div {
height: 100%;
background: var(--primary);
width: 0%;
transition: width 0.2s;
}
.total-label { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
-388
View File
@@ -1,388 +1,3 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>临时文件上传 · TTL 24h</title>
<style>
:root {
--bg: #0f1115;
--panel: #1a1d24;
--panel-2: #232732;
--border: #2c3140;
--text: #e6e8ee;
--text-dim: #8a92a3;
--primary: #5b8cff;
--primary-hover: #4a7af0;
--success: #4ade80;
--danger: #f87171;
--warning: #fbbf24;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
padding: 40px 20px;
line-height: 1.5;
}
.container { max-width: 880px; margin: 0 auto; }
header { text-align: center; margin-bottom: 32px; }
h1 {
font-size: 28px;
font-weight: 600;
margin-bottom: 8px;
background: linear-gradient(90deg, #5b8cff, #a78bfa);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.subtitle { color: var(--text-dim); font-size: 14px; }
.badge {
display: inline-block;
margin-left: 8px;
padding: 2px 8px;
background: var(--panel-2);
border: 1px solid var(--border);
border-radius: 4px;
font-size: 12px;
color: var(--warning);
-webkit-text-fill-color: var(--warning);
vertical-align: middle;
}
.card {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 12px;
padding: 24px;
margin-bottom: 24px;
}
/* Drop zone */
.dropzone {
border: 2px dashed var(--border);
border-radius: 12px;
padding: 48px 24px;
text-align: center;
cursor: pointer;
transition: all 0.2s;
background: var(--panel-2);
user-select: none;
}
.dropzone:hover, .dropzone.dragover, .dropzone:focus-visible {
border-color: var(--primary);
background: rgba(91, 140, 255, 0.05);
outline: none;
}
.dropzone .icon {
font-size: 48px;
margin-bottom: 12px;
color: var(--text-dim);
}
.dropzone .hint { color: var(--text-dim); font-size: 13px; margin-top: 6px; }
/* Buttons */
.btn {
display: inline-block;
padding: 10px 20px;
background: var(--primary);
color: white;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn:hover { background: var(--primary-hover); }
.btn:disabled { background: var(--text-dim); cursor: not-allowed; }
.btn.ghost { background: var(--panel-2); }
.btn.danger { background: var(--danger); }
.btn-row { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
/* Progress */
.progress-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.progress-item {
background: var(--panel-2);
border: 1px solid var(--border);
border-radius: 8px;
padding: 12px;
transition: opacity 0.3s;
}
.progress-item.done { border-color: var(--success); }
.progress-item.error { border-color: var(--danger); }
.progress-item-head {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 13px;
color: var(--text-dim);
margin-bottom: 6px;
gap: 8px;
}
.progress-item-head .name {
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
min-width: 0;
}
.progress-item-head .size-info { font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-item-head .status {
width: 20px;
height: 20px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
flex-shrink: 0;
}
.progress-item.done .status { background: var(--success); color: #0f1115; }
.progress-item.error .status { background: var(--danger); color: #0f1115; }
.progress-bar {
height: 4px;
background: var(--border);
border-radius: 2px;
overflow: hidden;
}
.progress-bar > div {
height: 100%;
background: var(--primary);
width: 0%;
transition: width 0.2s;
}
.progress-item.done .progress-bar > div { background: var(--success); width: 100% !important; }
.progress-item.error .progress-bar > div { background: var(--danger); }
.progress-item-actions {
display: flex;
gap: 6px;
margin-top: 8px;
justify-content: flex-end;
}
.progress-item-actions button {
background: transparent;
border: 1px solid var(--border);
color: var(--text-dim);
border-radius: 4px;
padding: 3px 10px;
font-size: 12px;
cursor: pointer;
}
.progress-item-actions button:hover { color: var(--text); border-color: var(--text-dim); }
/* File list */
.files-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
gap: 12px;
}
.files-header h2 { font-size: 16px; font-weight: 600; }
.files-header .meta { font-size: 12px; color: var(--text-dim); }
/* Quota */
.quota-wrap { margin-bottom: 16px; }
.quota-row {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
color: var(--text-dim);
margin-bottom: 4px;
}
.quota-row .quota-text strong { color: var(--text); font-variant-numeric: tabular-nums; }
.quota-row .quota-text.warn strong { color: var(--warning); }
.quota-row .quota-text.danger strong { color: var(--danger); }
.quota-bar {
height: 6px;
background: var(--border);
border-radius: 3px;
overflow: hidden;
}
.quota-bar > div {
height: 100%;
background: var(--success);
width: 0%;
transition: width 0.3s, background 0.3s;
}
.quota-bar.warn > div { background: var(--warning); }
.quota-bar.danger > div { background: var(--danger); }
.file-item {
display: flex;
align-items: center;
gap: 12px;
padding: 12px;
background: var(--panel-2);
border: 1px solid var(--border);
border-radius: 8px;
margin-bottom: 8px;
}
.file-icon {
width: 36px;
height: 36px;
border-radius: 6px;
background: var(--panel);
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-name {
font-size: 14px;
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-meta {
font-size: 12px;
color: var(--text-dim);
margin-top: 2px;
display: flex;
gap: 10px;
flex-wrap: wrap;
align-items: center;
}
.file-meta .ttl { color: var(--warning); font-variant-numeric: tabular-nums; }
.file-meta .ttl.danger { color: var(--danger); }
.file-actions { display: flex; gap: 6px; }
.icon-btn {
width: 32px;
height: 32px;
border-radius: 6px;
border: 1px solid var(--border);
background: var(--panel);
color: var(--text);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
text-decoration: none;
}
.icon-btn:hover { background: var(--primary); border-color: var(--primary); }
.icon-btn.danger:hover { background: var(--danger); border-color: var(--danger); }
.empty {
text-align: center;
padding: 40px 20px;
color: var(--text-dim);
font-size: 14px;
}
.skeleton {
background: linear-gradient(90deg, var(--panel-2) 0%, var(--border) 50%, var(--panel-2) 100%);
background-size: 200% 100%;
animation: shimmer 1.4s infinite;
border-radius: 6px;
height: 56px;
margin-bottom: 8px;
}
@keyframes shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
.toast {
position: fixed;
bottom: 24px;
right: 24px;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
padding: 12px 16px;
font-size: 14px;
box-shadow: 0 8px 24px rgba(0,0,0,0.3);
opacity: 0;
transform: translateY(8px);
transition: all 0.2s;
pointer-events: none;
z-index: 9999;
max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }
footer {
text-align: center;
color: var(--text-dim);
font-size: 12px;
margin-top: 24px;
}
.total-progress {
flex: 1;
height: 4px;
background: var(--border);
border-radius: 2px;
overflow: hidden;
min-width: 120px;
}
.total-progress > div {
height: 100%;
background: var(--primary);
width: 0%;
transition: width 0.2s;
}
.total-label { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
</style>
</head>
<body>
<div class="container">
<header>
<h1>临时文件传输<span class="badge">TTL 24h</span></h1>
<div class="subtitle">上传后 24 小时内有效 · 被下载会自动续期 · 自动清理</div>
</header>
<div class="card">
<div class="dropzone" id="dropzone" tabindex="0" role="button" aria-label="选择或拖拽文件上传">
<div class="icon"></div>
<div><strong>点击选择文件</strong> </div>
<div class="hint">支持多文件 · 受配额限制</div>
</div>
<input type="file" id="fileInput" multiple hidden />
<div class="progress-list" id="progressList"></div>
<div class="btn-row" id="actionRow" style="display:none">
<div class="total-progress" id="totalProgress" style="display:none"><div></div></div>
<span class="total-label" id="totalLabel" style="display:none"></span>
<button class="btn" id="uploadBtn">开始上传</button>
<button class="btn ghost" id="clearBtn">清空</button>
</div>
</div>
<div class="card">
<div class="files-header">
<h2>文件列表</h2>
<span class="meta" id="filesMeta">加载中...</span>
</div>
<div class="quota-wrap" id="quotaWrap" style="display:none">
<div class="quota-row">
<span class="quota-text" id="quotaText">--</span>
<span id="quotaPercent">--</span>
</div>
<div class="quota-bar" id="quotaBar"><div></div></div>
</div>
<div id="filesList">
<div class="skeleton"></div>
<div class="skeleton"></div>
</div>
</div>
<footer>每个文件 TTL 默认 24 小时, 后台每小时扫描清理 · 每次下载会重置过期时间</footer>
</div>
<div class="toast" id="toast"></div>
<script>
'use strict';
const $ = id => document.getElementById(id);
@@ -869,6 +484,3 @@ function escapeHtml(s) {
// ---------------------------------------------------------------------------
loadFiles();
setInterval(loadFiles, 30000);
</script>
</body>
</html>
+61
View File
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>临时文件上传 · TTL 24h</title>
<style>
/*EMBED_CSS*/</style>
</head>
<body>
<div class="container">
<header>
<h1>临时文件传输<span class="badge">TTL 24h</span></h1>
<div class="subtitle">上传后 24 小时内有效 · 被下载会自动续期 · 自动清理</div>
</header>
<div class="card">
<div class="dropzone" id="dropzone" tabindex="0" role="button" aria-label="选择或拖拽文件上传">
<div class="icon">⬆</div>
<div><strong>点击选择文件</strong> 或将文件拖拽到此处</div>
<div class="hint">支持多文件 · 受配额限制</div>
</div>
<input type="file" id="fileInput" multiple hidden />
<div class="progress-list" id="progressList"></div>
<div class="btn-row" id="actionRow" style="display:none">
<div class="total-progress" id="totalProgress" style="display:none"><div></div></div>
<span class="total-label" id="totalLabel" style="display:none"></span>
<button class="btn" id="uploadBtn">开始上传</button>
<button class="btn ghost" id="clearBtn">清空</button>
</div>
</div>
<div class="card">
<div class="files-header">
<h2>文件列表</h2>
<span class="meta" id="filesMeta">加载中...</span>
</div>
<div class="quota-wrap" id="quotaWrap" style="display:none">
<div class="quota-row">
<span class="quota-text" id="quotaText">--</span>
<span id="quotaPercent">--</span>
</div>
<div class="quota-bar" id="quotaBar"><div></div></div>
</div>
<div id="filesList">
<div class="skeleton"></div>
<div class="skeleton"></div>
</div>
</div>
<footer>每个文件 TTL 默认 24 小时, 后台每小时扫描清理 · 每次下载会重置过期时间</footer>
</div>
<div class="toast" id="toast"></div>
<script>
/*EMBED_JS*/</script>
</body>
</html>