Repository navigation
feat(org-fs): public file sharing via read_public flag - #4125
Merged
Merged
Conversation
Add a per-file `read_public` flag to the org filesystem so a member can share a single file with the open internet over the same `/fs/:volume/read` proxy URL the org already uses. The Library file preview gains a Share popover (copy link + a public/org-only switch). When a file is public, the read route streams it with no auth or membership, and the org-membership middleware defers that one route to it so the link works for everyone — anonymous viewers, external embeds, and signed-in non-members alike. Publishing is gated on ORG_FS_WRITE; private files are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Resolve conflicts from main's Library preview refactor + new migrations: - Renumber the read_public migration 115 -> 120 (main took 115-119); register it after main's entries in migrations/index.ts. - Re-apply the FileShareButton into the new shared preview-content.tsx (LibraryFilePreview), where main consolidated the panel/dialog toolbars; take main's versions of preview-panel.tsx and preview-dialog.tsx. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Extend public sharing to folders: read_public is now settable on dir entries, and the read route serves a file publicly when its own flag is set OR a published ancestor folder covers it (isPubliclyReadable + hasPublicAncestorDir). Publishing a folder thus publishes its whole subtree — current and future contents — with no byte moves and no seq bump. UI: a shared ShareControls body (live-state visibility switch + copy link) reused by the preview-toolbar FileShareButton popover and a new ShareDialog opened from Library cards. Cards (file, folder, skill, recent) gain a Share menu item and a "public" globe badge; read-only public-set volumes are excluded. useOrgFsSetPublic invalidates the listing + recent feed so badges refresh. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…brary Return effectivePublic (own flag OR a published ancestor folder) from /stat, /list and /recent so the UI can reflect inherited visibility: - stat: one ancestor query; list: one query for the whole listing; recent: batched one query per volume (OrgFs.inheritsPublic / childrenInheritPublic / recentWithEffectivePublic + storage.publicDirPaths). Library cards now show a globe badge for any effective-public entry, in two tiers — solid (published here) vs muted (inherited from a parent folder). The share dialog reflects effective state, and when public-via-parent it shows an explanatory note and locks the switch (manage it on the folder). Also fix the share dialog URL row overflowing the rounded edge: the grid DialogContent left its item at min-width:auto, so ShareControls needed min-w-0 for the long URL to truncate. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…, docs - Delete + recreate now resets read_public to false for files AND folders (was fails-open: a regenerated deck at a stable path silently re-published). putFile/putDir use a CASE so reviving a tombstone clears the flag while an in-place overwrite preserves it. Note: putDir's `.where(deleted_at is not null)` is an ON CONFLICT index-predicate, not an update guard, so the SET fires for live dirs too — the CASE is what gates the reset, and a naive `read_public=false` would have unpublished a folder on every child write. - Optimistic share toggle flips effectivePublic alongside readPublic, so unpublish no longer transiently reads as inherited-public. - Refresh stale migration/types comments (the flag is meaningful on dirs; folder publish inherits across the subtree). - Add 5 regression tests: publish/revert, overwrite preserves, file & folder delete+recreate reset to private, folder inheritance incl. later writes. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
viktormarinho
enabled auto-merge (squash)
June 24, 2026 20:01
decocms Bot
pushed a commit
that referenced
this pull request
Jun 24, 2026
PR: #4125 feat(org-fs): public file sharing via read_public flag Bump type: minor - decocms (apps/mesh/package.json): 3.54.1 -> 3.55.0 Deploy-Scope: both
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this contribution about?
Adds a per-file
read_publicflag to the org filesystem so a member can share a single file with the open internet over the same/api/:org/fs/:volume/readproxy URL the org already uses. The Library file preview gains a Share popover — copy link plus a public ↔ org-only switch. When a file is public the read route streams it with no auth or membership, and the org-membership middleware defers that one route to it so the link works for everyone (anonymous viewers, external embeds, signed-in non-members); publishing is gated onORG_FS_WRITEand private files behave exactly as before.Screenshots/Demonstration
UI change — a Share button in the Library file preview toolbar (regular files, fullscreen dialog, and HTML/deck preview). Loom/screenshots can be added on request.
How to Test
curl) — it loads with no login.ORG_FS_WRITE.)Migration Notes
Adds migration
115-org-fs-read-public— aread_public boolean NOT NULL DEFAULT falsecolumn onorg_fs_entry, registered inmigrations/index.ts. Applies automatically on boot /bun run migrate; no config changes.Review Checklist
Summary by cubic
Add public sharing for files and folders via a per-entry
read_publicflag with inherited visibility from parent folders. The Library gains Share controls, and the read route serves public files without auth; private behavior is unchanged.New Features
public-*volumes are excluded./api/:org/fs/:volume/read?path=...: streams to anyone when public (own or inherited). Org-membership middleware defers only this route;?presignstays member-only. HTML gets a sandbox CSP; Cache-Control is public+revalidate for shared files and private otherwise.POST /:volume/public?path=...with{ public: boolean }toggles files and dirs (folders publish their subtree)./stat,/list, and/recentincludeeffectivePublic(own OR inherited) with batched queries. Optimistic toggle updates bothreadPublicandeffectivePublic, then invalidates listing/recent; visibility changes don’t bumpseq. In-place overwrites preserve the flag; delete+recreate resets it to private (files and folders).Migration
read_public boolean NOT NULL DEFAULT falsetoorg_fs_entry(120-org-fs-read-public), applied via the existing migration flow.Written for commit 0997ba5. Summary will update on new commits.