From 9c7f8f0f62eac65cfe1321c882258843d09d95cc Mon Sep 17 00:00:00 2001 From: OpenCode Bot Date: Mon, 11 May 2026 21:37:36 +0800 Subject: [PATCH] feat(ui): beautiful status page with file size and expiry info, 1px form hidden --- app.py | 8 +- templates/index.html | 206 ++++++++++++++++++------------------------- 2 files changed, 94 insertions(+), 120 deletions(-) diff --git a/app.py b/app.py index fb51432..548277d 100644 --- a/app.py +++ b/app.py @@ -3,6 +3,9 @@ import uuid from datetime import datetime from flask import Flask, request, render_template, send_file, jsonify, url_for, abort from config import UPLOAD_FOLDER, SECRET_KEY, MAX_CONTENT_LENGTH, EXPIRY_OPTIONS, DAILY_TRAFFIC_LIMIT + +MAX_FILE_SIZE_MB = MAX_CONTENT_LENGTH // (1024 * 1024) +DAILY_GB = DAILY_TRAFFIC_LIMIT // (1024 * 1024 * 1024) from database import init_db, add_file, get_file, delete_file, cleanup_expired, add_upload_traffic, add_download_traffic, get_client_ip, is_traffic_exceeded, get_daily_traffic app = Flask(__name__) @@ -15,7 +18,10 @@ init_db() @app.route('/') def index(): - return render_template('index.html', expiry_options=EXPIRY_OPTIONS) + return render_template('index.html', + expiry_options=EXPIRY_OPTIONS, + max_file_size_mb=MAX_FILE_SIZE_MB, + daily_gb=DAILY_GB) @app.route('/upload', methods=['POST']) def upload(): diff --git a/templates/index.html b/templates/index.html index 982c7bb..1b0b334 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,127 +4,95 @@ 临时文件传输 - + +
+
+

服务正在运行中

+ 运行正常 + +
+ 最大文件大小 + {{ max_file_size_mb }} MB +
+
+ 可保存时间 + 1小时 / 24小时 / 7天 +
+
+ 每日流量限制 + {{ daily_gb }} GB / IP +
+
+ API 上传 + POST /api/upload +
+
+
-

服务正在运行中

- -
-
-
📦
-
最大文件大小
-
500 MB
-
-
-
-
最长保存时间
-
7 天
-
-
-
📊
-
每日流量限制
-
20 GB / IP
-
-
- -
- 上传方式:API 调用 POST /api/upload 或使用 upload_client.py
- 过期选项:1h / 24h / 7d -
-

点击或拖拽文件到此处

@@ -219,4 +187,4 @@ } - \ No newline at end of file +