Add rename_path, move_path and delete_path for home files
The chat Files panel needs to rename, move and delete entries. Three
websocket requests, dispatched beside list_directory, operate on one
entry inside the operator's home and reply with path_mutated {path} or
an error frame (does not exist, already exists, is not empty, outside
the home directory, cannot be moved into itself).
The entry's parent folder and the move destination are resolved through
symlinks and must stay inside home; the entry's own symlink is never
followed, so a link is renamed, moved or removed as a link. The home
directory itself, anything outside it and pseudo filesystems are
refused. A folder is deleted only when empty unless recursive is set;
os.RemoveAll unlinks symlinks rather than descending into them.
This commit is contained in:
+16
@@ -632,6 +632,22 @@ sessions pipeline runs create. The protocol types are:
|
||||
similar) are refused, permission problems are reported as
|
||||
`permission denied: <path>`, and a reply carries at most 2000 entries with
|
||||
`truncated: true` when more exist.
|
||||
- `rename_path`, `move_path` and `delete_path` back the chat Files panel's
|
||||
Rename, Move and Delete. Bodies: `rename_path: {"path", "name"}` (a plain new
|
||||
name in the same folder: no separators, not `.`/`..`, at most 255 bytes),
|
||||
`move_path: {"path", "into"}` (the entry keeps its name; an existing name in
|
||||
`into` is refused, as is moving a folder into itself or a descendant) and
|
||||
`delete_path: {"path", "recursive"}` (files and symlinks always; a folder only
|
||||
when empty unless `recursive` is true). Every path is absolute or `~`-based and
|
||||
confined to the home subtree like `list_directory`: the parent folder (and
|
||||
`into`) is resolved through symlinks and must stay inside home, the home
|
||||
directory itself is never renamed, moved or deleted, pseudo filesystems are
|
||||
refused, and the entry's own symlink is never followed (the link is renamed,
|
||||
moved or removed; its target is untouched). The reply is
|
||||
`path_mutated: {"path"}` with the resulting path under home; refusals are
|
||||
`error` frames saying `... does not exist`, `... already exists`,
|
||||
`... is not empty`, `... cannot be moved into itself` or `... is outside the
|
||||
home directory ...`.
|
||||
- `server_stats` returns `server_stats_result` with a `server_stats` snapshot of
|
||||
host, CPU, memory, local storage, Pipelines data, process and GPU information.
|
||||
Sampling is bounded to about three seconds; unavailable sections carry an
|
||||
|
||||
Reference in New Issue
Block a user