DeepTutor icon indicating copy to clipboard operation
DeepTutor copied to clipboard

[Feature Request]: Manage workspace files from the web UI

Open panghufattiger996-maker opened this issue 5 days ago • 0 comments

DeepTutor creates and consumes files inside every workspace, but the web UI has no way to reach them. A workspace holds Markdown notes, PDFs and question banks, and today the only way to put a file into one, rename it, or take it out is to reach the host filesystem or the container volume.

I would like a Manage files panel in Settings → Workspace that covers the everyday operations: browse folders, create a folder, upload, rename, delete, and read a Markdown or plain-text file without downloading it.

Two constraints matter to me and I think should be part of the design:

1. Writes must stay behind the existing explicit grant. ContentWorkspaceService.resolve already refuses any write outside outputs/ with "Writes outside outputs require an explicit user grant." I would rather implement that grant than widen the rule: a per-workspace, revocable opt-in that names the workspace before it is enabled. Enabling management for one folder should not open any other workspace, and revoking should take effect immediately.

2. Delete should be recoverable. Files people upload are not regenerable the way generated outputs are, so a soft delete with a trash and a restore action is safer than removing them outright.

Protected paths should stay refused for both reading and writing — at minimum the .deeptutor internal directory, skills, and database files (*.db, *.sqlite, *.sqlite3, plus their journal/WAL/SHM siblings).


Use Case

A learner keeps a question bank and study notes in a workspace. Today, adding a PDF they downloaded, fixing a typo in a Markdown note, or removing an outdated file means opening the host shell and editing the workspace directory by hand. That is out of reach for anyone running DeepTutor as a container, and it is easy to corrupt a workspace by editing the wrong path.

With a file manager, the common loop stays inside the app: upload the exam paper, rename the notes, preview the Markdown, delete the draft. The grant dialog means a user who never opens the panel is not exposed to anything new.


Related Module

API/Backend (the grant model and most of the work live there; the panel is the Frontend/Web side)


Additional Context

I have a working implementation on a branch, built against dev:

  • Backend — per-workspace grant stored in the account settings tree, plus listing, folder creation, chunked upload, rename, slot-based trash and restore, and text preview, exposed as eleven endpoints.
  • Frontend — a Manage files panel in Settings → Workspace.
  • Protected paths refused for read and write: .deeptutor, skills, and database files (*.db, *.sqlite, *.sqlite3 and their journal/WAL/SHM siblings).
  • Tests — 42 backend tests and 5 frontend tests, plus the regenerated API contract and all 13 locale catalogs.

Some notes on choices I made while building it, in case they affect whether you want this:

  • The trash records each delete as a slot rather than by path. A path-keyed trash cannot represent two deletions of the same name, and it cannot restore a folder whose children were trashed separately. Restoring into a deleted parent recreates the parent. It keeps the newest 30 delete batches.
  • Uploads are capped at 50 MB. The endpoint reads the part in 1 MB chunks so the cap fires early instead of after buffering a multi-GB body, but an accepted upload (≤ 50 MB) is still held in memory before it is written. Truly streaming it to disk would need a different handler than the one I wrote; I kept the simpler version because the ceiling bounds it, and I would rather point that out than describe it as streaming.
  • The grant lives in the per-account settings tree rather than on the workspace binding, because the binding is resolved by other consumers too and I did not want all of them to gain write access.
  • Listings hide .deeptutor and skills and sort folders before files; the panel shows at most 1000 entries.

I am not opening the PR yet. CONTRIBUTING.md asks for the direction to be agreed in an issue before code is written, and I did not do that — I started from my own need and only read the guideline afterwards. So before I put it up, I would like your call on two things:

  1. Is a general workspace file manager something you want? The closest prior attempt I found, #2050, scoped this to generated output files and was closed rather than merged, so I would rather ask than assume the direction is open.
  2. Is the grant model right? An explicit per-workspace opt-in is the version that felt closest to what the service already documents, but if you would prefer this gated behind an existing admin or role check, or gated per user rather than per workspace, that is a smaller change now than later.

I am happy to reduce the scope if that is easier to review — for example read-only browsing plus upload first, with rename/delete/trash deferred to a follow-up. Tell me which of these you would accept and I will shape the PR to it.

panghufattiger996-maker avatar Nov 30 '26 07:11 panghufattiger996-maker