Skip to content

feat: add media viewers for images and videos#9

Merged
itsmeares merged 15 commits intomainfrom
feature/phase-6-preview
Apr 6, 2026
Merged

feat: add media viewers for images and videos#9
itsmeares merged 15 commits intomainfrom
feature/phase-6-preview

Conversation

@itsmeares
Copy link
Copy Markdown
Owner

🚀 Summary

Replace the generated preview system with original-file viewers for images and videos across the private library and public shares. Add dedicated viewer/content routes with video range support, remove preview scheduling and FFmpeg-backed worker jobs, and update shared types, docs, and admin surfaces to use viewer semantics instead of preview state.

📊 Impacts and Changes

  • Photos and videos now open on dedicated viewer pages instead of preview assets.
  • Video playback now streams the original file with HTTP range support for seeking.
  • Public shares still allow image/video viewing even when downloadDisabled is enabled; that setting only removes explicit download actions.
  • PDF, text, and audio are now download-only in this phase.
  • Preview state was removed from Prisma and shared file typings were updated to expose viewerKind instead.
  • Upload, replace, worker, storage, health, and admin preview plumbing was removed.
  • Legacy preview routes remain only as compatibility redirects for image/video files.

🧪 Testing Checklist

  • pnpm lint passed
  • pnpm test passed
  • pnpm build successful
  • I added or updated tests for behavior changes, or this change does not alter behavior.
  • If this PR changes UI or UX behavior, I verified it manually in the local dev environment.

Review Checklist

  • I called out schema, auth, storage, or restore behavior changes when they apply.
  • I did not commit secrets, runtime data, or generated local storage contents.

🧗 Follow-ups or Limitations

PDF, text, and audio viewer models are the next follow-up. See #8

🔗 Linked Issues

None

@itsmeares
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9549d45be5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

});
}

const { start, end } = parseSingleRange(rangeHeader, stat.size);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Close file handle before rejecting invalid video ranges

createInlineOriginalContentResponse opens the file before parsing Range, but parseSingleRange(...) can throw MediaContentError and exit before any stream is created, so the FileHandle is never closed on that path. Because FileHandle.createReadStream() only auto-closes when a stream exists, repeated malformed Range requests can leak descriptors until media reads start failing under load.

Useful? React with 👍 / 👎.

const expiredFolderRoots = (await prisma.folder.findMany({
where: {
deletedAt: { lte: cutoff },
parentId: null, // Only top-level trashed roots
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Find expired trash roots without requiring parentId null

The retention pass only selects expired folders with parentId: null, but normal trashed folders keep their original parent and are soft-deleted by timestamp, so this filter skips virtually all real trashed folder trees. As a result, Step 2 never purges folder records/descendants, leaving soft-deleted folder metadata behind indefinitely even after retention cutoff.

Useful? React with 👍 / 👎.

@itsmeares
Copy link
Copy Markdown
Owner Author

will look into this tmrw

- Close file handles on invalid range errors
- Skip retention for files in still-trashed child folders
- Add coverage for streamed responses and trash revalidation
@itsmeares itsmeares merged commit 7a9eca4 into main Apr 6, 2026
1 check passed
@itsmeares itsmeares deleted the feature/phase-6-preview branch April 6, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant