Update app.py
Browse files
app.py
CHANGED
|
@@ -260,7 +260,7 @@ HTML_CONTENT = """<!DOCTYPE html>
|
|
| 260 |
border-left: 4px solid #3b82f6;
|
| 261 |
}
|
| 262 |
.api-docs code {
|
| 263 |
-
background: #
|
| 264 |
padding: 0.2rem 0.4rem;
|
| 265 |
border-radius: 6px;
|
| 266 |
font-family: monospace;
|
|
@@ -369,7 +369,7 @@ HTML_CONTENT = """<!DOCTYPE html>
|
|
| 369 |
<p><strong>成功响应:</strong> <code>{"success": true, "filename": "远程完整路径"}</code></p>
|
| 370 |
<p><strong>失败响应:</strong> <code>{"error": "错误信息"}</code> (HTTP 4xx/5xx)</p>
|
| 371 |
<!-- 修改后的代码框样式 -->
|
| 372 |
-
<pre style="background: #000000; color:
|
| 373 |
const fileInput = document.getElementById('fileInput'); // 文件选择 input
|
| 374 |
const file = fileInput.files[0];
|
| 375 |
const dir = "images/"; // 可选目录
|
|
@@ -400,7 +400,7 @@ fetch('/upload', {
|
|
| 400 |
</ul>
|
| 401 |
<p><strong>成功响应:</strong> 字符串数组,每个元素是文件或目录的完整路径(目录路径以 <code>/</code> 结尾)。例如:<code>["file.txt", "images/", "logs/"]</code></p>
|
| 402 |
<p><strong>失败响应:</strong> <code>{"error": "错误信息"}</code> (HTTP 5xx)</p>
|
| 403 |
-
<pre style="background: #
|
| 404 |
fetch('/list')
|
| 405 |
.then(res => res.json())
|
| 406 |
.then(files => {
|
|
|
|
| 260 |
border-left: 4px solid #3b82f6;
|
| 261 |
}
|
| 262 |
.api-docs code {
|
| 263 |
+
background: #000000;
|
| 264 |
padding: 0.2rem 0.4rem;
|
| 265 |
border-radius: 6px;
|
| 266 |
font-family: monospace;
|
|
|
|
| 369 |
<p><strong>成功响应:</strong> <code>{"success": true, "filename": "远程完整路径"}</code></p>
|
| 370 |
<p><strong>失败响应:</strong> <code>{"error": "错误信息"}</code> (HTTP 4xx/5xx)</p>
|
| 371 |
<!-- 修改后的代码框样式 -->
|
| 372 |
+
<pre style="background: #000000; color: white; padding: 1rem; border-radius: 12px; overflow-x: auto; font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.9rem; line-height: 1.5;"><code>// 使用 FormData 上传
|
| 373 |
const fileInput = document.getElementById('fileInput'); // 文件选择 input
|
| 374 |
const file = fileInput.files[0];
|
| 375 |
const dir = "images/"; // 可选目录
|
|
|
|
| 400 |
</ul>
|
| 401 |
<p><strong>成功响应:</strong> 字符串数组,每个元素是文件或目录的完整路径(目录路径以 <code>/</code> 结尾)。例如:<code>["file.txt", "images/", "logs/"]</code></p>
|
| 402 |
<p><strong>失败响应:</strong> <code>{"error": "错误信息"}</code> (HTTP 5xx)</p>
|
| 403 |
+
<pre style="background: #000000; color: white; padding: 1rem; border-radius: 12px; overflow-x: auto; font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.9rem; line-height: 1.5;"><code>// 列出根目录内容
|
| 404 |
fetch('/list')
|
| 405 |
.then(res => res.json())
|
| 406 |
.then(files => {
|