perf(panel): speed up file browsing and preserve loading forms

This commit is contained in:
Lemon-miaow committed 2026-10-04 20:18:11 +08:00
1 parent 4d8e9af240
commit 2c98e8b2ab
27 files changed
+1387 -145

No files matched your search

+50
View File
@@ -1625,6 +1625,56 @@ paths:
'404':
$ref: '#/components/responses/NotFound'
/api/v1/internal/file-browser/{id}:
post:
tags: [files]
operationId: internalFileBrowser
summary: Exchange a read-only file Job's result for its next command.
description: >-
Internal face only. A random bearer token scopes the worker to one
world and a four-minute session; idle workers exit after 45 seconds.
The first request sends an empty object. Later requests return the
previous command's id and result or error. This endpoint dispatches
only reads already authorized by the external file API.
x-felis-face: [internal]
x-felis-tier: public
security: []
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: Authorization, in: header, required: true, schema: { type: string } }
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
id: { type: string }
result: { type: object }
error: { type: string }
responses:
'200':
description: The next authorized read command.
content:
application/json:
schema:
type: object
required: [id, op, path]
properties:
id: { type: string }
op: { type: string, enum: [list, read] }
path: { type: string }
'204':
$ref: '#/components/responses/NoContent'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/api/v1/internal/exports/{id}:
put:
tags: [backups]
+12 -2
View File
@@ -3170,8 +3170,18 @@ for 10 seconds (the Free plan's limits).
## 18. Server files: a change or an upload is refused
The panel's Files page is for the server's owner or an admin, and only while
the server is fully stopped. Each call runs a one-shot `felis files` Job in the
`minecraft` namespace, labelled `app.kubernetes.io/managed-by=felis-files` and
the server is fully stopped. Reads reuse a read-only `felis files` Job for the
same world, avoiding Pod startup for every folder and file. The worker pulls
commands from the existing internal API with a random, world-scoped token;
each request still passes the owner/admin and stopped gates. It exits after
45 idle seconds or four minutes total; at most four workers exist per API
process, with one-shot reads used at capacity. No file contents are cached.
The panel caches directory listings for 30 seconds; Refresh, a write, upload
or restore invalidates them. The text editor highlights common config formats
and preserves CRLF; binary and oversized files offer download instead.
Changes still run one-shot Jobs in the `minecraft` namespace, labelled
`app.kubernetes.io/managed-by=felis-files` and
`felis.lolicon.best/files-mode=<list|read|write|mkdir|delete|rename|upload|unzip>`.
A listing or a read holds nothing. Every change (a save, a new file or folder,
a rename, a delete, an upload, an unzip) holds the world for its Job (§3b), so a wake or a