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 @@
POST /api/upload 或使用 upload_client.py1h / 24h / 7d
- 点击或拖拽文件到此处
@@ -219,4 +187,4 @@ } -