From bbca5a404cb796d80ff799da646ccdd01da8ba32 Mon Sep 17 00:00:00 2001 From: OpenCode Bot Date: Tue, 2 Jun 2026 22:11:42 +0800 Subject: [PATCH] docs: add API call methods documentation on homepage --- templates/index.html | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/templates/index.html b/templates/index.html index 40c3236..eedfe21 100644 --- a/templates/index.html +++ b/templates/index.html @@ -111,6 +111,36 @@ POST /api/upload +
+
API 调用方法 (参考 Flask 风格)
+
+ 1. 上传文件:
+ POST /api/upload
+ Headers: Content-Type: multipart/form-data
+ Form-data:
+ · file: <文件内容>
+ · expiry: 1h | 24h | 7d (可选, 默认24h)

+ + 2. 获取文件信息:
+ GET /api/file/<file_id>

+ + 3. 下载/访问文件:
+ GET /file/<file_id>

+ + cURL 示例:
+ curl -k -X POST "https://xiaji-temp.duckdns.org/api/upload" \ +   -F "file=@example.jpg" \ +   -F "expiry=24h"

+ + Python requests 示例:
+ import requests

+ url = "https://xiaji-temp.duckdns.org/api/upload"
+ files = {'file': open('example.jpg', 'rb')}
+ data = {'expiry': '24h'}
+ resp = requests.post(url, files=files, data=data, verify=False)
+ print(resp.json()) +
+
本月统计