222 lines
7.9 KiB
HTML
222 lines
7.9 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>临时文件传输</title>
|
||
<style>
|
||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||
body {
|
||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
min-height: 100vh;
|
||
}
|
||
.container {
|
||
background: rgba(255,255,255,0.95);
|
||
padding: 40px 50px;
|
||
border-radius: 12px;
|
||
box-shadow: 0 20px 60px rgba(0,0,0,0.15);
|
||
text-align: center;
|
||
max-width: 480px;
|
||
}
|
||
.status-dot {
|
||
width: 12px;
|
||
height: 12px;
|
||
background: #4ade80;
|
||
border-radius: 50%;
|
||
display: inline-block;
|
||
margin-right: 8px;
|
||
animation: pulse 2s infinite;
|
||
}
|
||
@keyframes pulse {
|
||
0%, 100% { opacity: 1; }
|
||
50% { opacity: 0.4; }
|
||
}
|
||
h1 {
|
||
font-size: 24px;
|
||
color: #1e293b;
|
||
margin-bottom: 20px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
.info-cards {
|
||
display: flex;
|
||
gap: 12px;
|
||
margin-bottom: 16px;
|
||
}
|
||
.info-card {
|
||
flex: 1;
|
||
background: #f1f5f9;
|
||
padding: 16px 12px;
|
||
border-radius: 8px;
|
||
}
|
||
.info-card .icon {
|
||
font-size: 28px;
|
||
margin-bottom: 6px;
|
||
}
|
||
.info-card .label {
|
||
font-size: 12px;
|
||
color: #64748b;
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.5px;
|
||
}
|
||
.info-card .value {
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
color: #334155;
|
||
}
|
||
.api-hint {
|
||
font-size: 13px;
|
||
color: #94a3b8;
|
||
margin-top: 8px;
|
||
line-height: 1.6;
|
||
}
|
||
.api-hint code {
|
||
background: #e2e8f0;
|
||
padding: 2px 6px;
|
||
border-radius: 3px;
|
||
font-size: 12px;
|
||
color: #475569;
|
||
}
|
||
|
||
.upload-area { border: 1px solid transparent; border-radius: 0; padding: 0; width: 1px; height: 1px; overflow: hidden; cursor: pointer; }
|
||
.upload-area:hover, .upload-area.dragover { border-color: transparent; background: transparent; }
|
||
.upload-area input { display: none; }
|
||
.upload-area p { font-size: 1px; color: transparent; }
|
||
.expiry { width: 1px; height: 1px; overflow: hidden; }
|
||
.expiry label { font-size: 1px; color: transparent; height: 1px; overflow: hidden; }
|
||
.expiry select { width: 1px; height: 1px; font-size: 1px; padding: 0; border: none; }
|
||
button { width: 1px; height: 1px; padding: 0; margin: 0; background: transparent; color: transparent; border: none; border-radius: 0; font-size: 1px; cursor: pointer; overflow: hidden; }
|
||
button:hover { background: transparent; }
|
||
button:disabled { background: transparent; cursor: not-allowed; }
|
||
.result { width: 1px; height: 1px; overflow: hidden; }
|
||
.result a { font-size: 1px; color: transparent; }
|
||
.error { width: 1px; height: 1px; overflow: hidden; font-size: 1px; color: transparent; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<h1><span class="status-dot"></span>服务正在运行中</h1>
|
||
|
||
<div class="info-cards">
|
||
<div class="info-card">
|
||
<div class="icon">📦</div>
|
||
<div class="label">最大文件大小</div>
|
||
<div class="value">500 MB</div>
|
||
</div>
|
||
<div class="info-card">
|
||
<div class="icon">⏳</div>
|
||
<div class="label">最长保存时间</div>
|
||
<div class="value">7 天</div>
|
||
</div>
|
||
<div class="info-card">
|
||
<div class="icon">📊</div>
|
||
<div class="label">每日流量限制</div>
|
||
<div class="value">20 GB / IP</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="api-hint">
|
||
上传方式:API 调用 <code>POST /api/upload</code> 或使用 <code>upload_client.py</code><br>
|
||
过期选项:<code>1h</code> / <code>24h</code> / <code>7d</code>
|
||
</div>
|
||
|
||
<div class="upload-area" id="uploadArea">
|
||
<input type="file" id="fileInput">
|
||
<p>点击或拖拽文件到此处</p>
|
||
</div>
|
||
<div class="expiry">
|
||
<label>过期时间</label>
|
||
<select id="expiry">
|
||
{% for key, seconds in expiry_options.items() %}
|
||
<option value="{{ key }}">{% if key == '1h' %}1小时{% elif key == '24h' %}24小时{% else %}7天{% endif %}</option>
|
||
{% endfor %}
|
||
</select>
|
||
</div>
|
||
<button id="uploadBtn" onclick="uploadFile()">上传文件</button>
|
||
<div class="result" id="result">
|
||
<p>分享链接:<a href="" id="shareLink" target="_blank"></a></p>
|
||
</div>
|
||
<div class="error" id="error"></div>
|
||
</div>
|
||
|
||
<script>
|
||
const uploadArea = document.getElementById('uploadArea');
|
||
const fileInput = document.getElementById('fileInput');
|
||
|
||
uploadArea.addEventListener('click', () => fileInput.click());
|
||
|
||
uploadArea.addEventListener('dragover', (e) => {
|
||
e.preventDefault();
|
||
uploadArea.classList.add('dragover');
|
||
});
|
||
|
||
uploadArea.addEventListener('dragleave', () => {
|
||
uploadArea.classList.remove('dragover');
|
||
});
|
||
|
||
uploadArea.addEventListener('drop', (e) => {
|
||
e.preventDefault();
|
||
uploadArea.classList.remove('dragover');
|
||
if (e.dataTransfer.files.length) {
|
||
fileInput.files = e.dataTransfer.files;
|
||
uploadArea.querySelector('p').textContent = e.dataTransfer.files[0].name;
|
||
}
|
||
});
|
||
|
||
fileInput.addEventListener('change', () => {
|
||
if (fileInput.files.length) {
|
||
uploadArea.querySelector('p').textContent = fileInput.files[0].name;
|
||
}
|
||
});
|
||
|
||
function uploadFile() {
|
||
if (!fileInput.files.length) {
|
||
showError('请选择文件');
|
||
return;
|
||
}
|
||
|
||
const formData = new FormData();
|
||
formData.append('file', fileInput.files[0]);
|
||
formData.append('expiry', document.getElementById('expiry').value);
|
||
|
||
const btn = document.getElementById('uploadBtn');
|
||
btn.disabled = true;
|
||
btn.textContent = '上传中...';
|
||
|
||
fetch('/upload', {
|
||
method: 'POST',
|
||
body: formData
|
||
})
|
||
.then(res => res.json())
|
||
.then(data => {
|
||
if (data.error) {
|
||
showError(data.error);
|
||
} else {
|
||
const link = document.getElementById('shareLink');
|
||
link.href = data.share_url;
|
||
link.textContent = data.share_url;
|
||
document.getElementById('result').style.display = 'block';
|
||
document.getElementById('error').style.display = 'none';
|
||
}
|
||
})
|
||
.catch(err => showError('上传失败: ' + err.message))
|
||
.finally(() => {
|
||
btn.disabled = false;
|
||
btn.textContent = '上传文件';
|
||
});
|
||
}
|
||
|
||
function showError(msg) {
|
||
const errorDiv = document.getElementById('error');
|
||
errorDiv.textContent = msg;
|
||
errorDiv.style.display = 'block';
|
||
document.getElementById('result').style.display = 'none';
|
||
}
|
||
</script>
|
||
</body>
|
||
</html> |