Skip to content

File Viewer: edit mode for text files (edit + save in the viewer) #212

Description

@Ark0N

Requested by an early user via the r/selfhosted thread (https://www.reddit.com/r/selfhosted/comments/1vebymy/): the File Viewer can browse and preview files, but small fixes still force a hop into the terminal (or another editor). An edit mode in the viewer closes that loop, especially from the phone: agent writes a file, you review it in the viewer, tweak two lines, save, tell the agent to continue.

Rough scope:

  • Frontend: an Edit toggle on text previews in the File Viewer; textarea (or CodeMirror-light) with Save/Cancel; dirty-state guard on close. Mobile-first sizing since review-on-phone is the main use case.
  • Backend: a write endpoint next to the existing read path in file-routes.ts. It must inherit the SAME confinement the reads have: realpath resolution, extension allowlist, ownership scoping in multi-user mode (canAccessOwned), and a size cap. Text files only in v1 (the preview pipeline already knows what is text).
  • Safety rails: never follow symlink escapes on write, reject binary, and no creation/deletion in v1 (edit-in-place only) to keep the surface small.

Out of scope for v1: syntax highlighting beyond what the preview already does, multi-file operations, and editing inside Docker/remote overlays where the viewer serves host-side bytes only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions