Commit Graph
57 Commits
Author SHA1 Message Date
yusufipek d981d98cf5 feat(player): let editors upload subtitles for a version
Subtitle tracks hang off a version rather than off a video, because re-editing a cut shifts every cue. The file
always lands in our own S3-compatible storage whatever hosts the video, so a Bunny-hosted cut and an R2 one take the
same path: both already play through our own video element, so a track element is all it takes.

Uploads are normalised before they are stored. Whatever arrives, SRT or WebVTT, is parsed into cues and
re-serialised as a canonical WebVTT file, and anything we did not understand is dropped rather than passed through.
That is what makes it safe to serve a user-supplied text file from our own origin. Files saved out of Windows
editors are decoded as windows-1254 or windows-1252 when they are not valid UTF-8, rather than refused.

A YouTube version cannot carry an uploaded track, so the same CC menu drives YouTube's own captions through the
iframe module API. The embed hides YouTube's controls, so until now those captions were unreachable even when the
video had them.

Uploading and deleting take the editor permission rather than the commenter one: a subtitle is part of the
delivered cut, not a comment attachment.
2026-08-22 07:51:46 +03:00
Yusuf İpek 14ddf19d58 Merge pull request #63 from yusufipk/feat/multi-image-comment-attachments
feat(comments): carry a batch of screenshots on one comment
2026-08-20 11:43:38 +03:00
yusufipek b9e2006e34 feat(comments): carry a batch of screenshots on one comment
A comment held one image, and the paste handler took the first item off the
clipboard and dropped the rest. Reviewing a cut usually means several
screenshots about the same moment, which meant one comment per screenshot or
one screenshot and a paragraph describing the others. Editing a comment could
not attach anything at all: the edit box had no paste handler, no file picker
and no way to remove what was already there.

A comment now carries up to five images, in the composer, in a reply and in
the editor. One paste stages every image on the clipboard, the file picker
takes a multiple selection, and a drop lands on whichever editor is open. Over
the cap the extras are refused out loud rather than dropped quietly. A single
image still fills the width; several tile into a grid, and either opens full
screen on click.

The images move into their own table. `comments.imageUrl` stays and follows the
first of them, so a reader that has not been updated keeps working, and the
migration copies the existing attachments across so the new table is complete
from the first read. Every path that resolves a URL back to a comment now asks
the new table: R2 cleanup, the orphan sweep, the storage accounting and the
reference checks that decide whether an object can be deleted. Left on the old
column they would have treated images two through five as unreferenced and
swept them.

Detaching an image while editing only breaks the link. The file stays in R2 and
in the assets pane, which is where it is deleted from and where its bytes are
already billed.
2026-08-20 11:01:33 +03:00
yusufipek 7b7b1d21b2 feat(player): raise the playback speed ceiling off YouTube's limit
A single speed ladder fed both players, so the 2x cap that YouTube's
iframe API enforces also applied to Bunny and R2, which are plain <video>
elements the browser will play far faster. Pick the ladder per provider:
YouTube keeps 0.25x-2x, the native ones go up to 16x, where Chrome and
Firefox clamp playbackRate. The picker labels everything past 4x as
"no audio", since that is where the browsers stop pitch-correcting and
drop the audio track.
2026-08-20 10:50:42 +03:00
yusufipk b51e690062 fix: close the findings the test suite surfaced
The suite that landed in #43/#44 was written against existing behaviour, so a
number of tests pinned bugs rather than asserting correct behaviour. This fixes
the production code and moves each of those tests onto the fixed behaviour in
the same change.

Security:

- project-download: derive the archive entry extension from the last path
  segment and restrict it to a short alphanumeric run, so an extensionless
  allowlisted url can no longer contribute a path separator; validate the r2
  branch against the strict proxy-path pattern instead of a `startsWith`, which
  let `/api/upload/video/clip.mp4/../../etc/passwd` through verbatim.
- rate-limit: hash a key or action wider than its column instead of skipping the
  query. Both the guard and the failing INSERT used to answer "allowed", so the
  limit stopped applying entirely. Warn at startup when TRUSTED_PROXY_MODE is
  unset in production.
- video uploads: the file name decides the content type; a client-declared video
  mime no longer makes `payload.exe` acceptable.
- email templates: escape in the helpers rather than relying on every caller,
  with an explicit `rawEmailHtml()` opt-out for the one call site that builds
  markup. `escapeHtml` now covers the single quote.
- CSP: allow loopback object storage outside production only.
- route-access: reach the billing redirect only for the workspace owner. Keying
  it off the owner's billing status alone made the redirect target an oracle for
  whose subscription had lapsed, and sent members to a page they cannot act on.
- search: carry the same billing condition every other read path carries.
- logger: check `err.name` as well as `err.constructor.name`, so a re-thrown,
  deserialised or minified Prisma error is still redacted.
- upload tokens: resolve the signing secret outside the try, so a server booted
  without one fails loudly instead of reporting every grant as a forgery.
- invitations: never downgrade an existing membership, and report a scoped
  invitation that points at nothing as not_found rather than accepted.
- auth: resolve the workspace role for every signed-in caller, so
  checkProjectAccess and computeProjectAccess stop disagreeing about the owner
  who also owns the workspace. The `intent` option is gone with it.
- r2-media-proxy: validate the object key inside the proxy so the guard travels
  with the function; delete the unused, unanchored `mediaUrlToR2Key`.
- r2: sign the content type into presigned PUT grants.

Correctness:

- frame rate snapping picks the nearest standard, not the first within
  tolerance, so 24, 30 and 60 fps are reachable at all.
- a version upload registers its Bunny cleanup as soon as bunny-init answers, so
  a failed tus upload no longer leaves a billed video behind.
- deleting videos clears storage before the rows, so a refused DELETE leaves a
  retryable row rather than an orphaned object.
- an expired upload session can be cancelled, which is what releases its quota.
- `voice/` joins the delete allowlist, so a voice note can be removed by the
  module that wrote it.
- a failed CORS write propagates instead of being mistaken for an empty config
  and replacing the bucket's rules.
- filtering projects by workspace no longer hides projects the unfiltered call
  returns.
- upload retries skip aborts and permanent 4xx; progress no longer divides by
  zero.
- reply edits no longer clear the comment's tag; optimistic resolve rolls back
  to the state it replaced; the delete snapshot is captured once.
- assorted UI fixes: duplicate React keys, double-click guards reading stale
  closures, the tag list fetched twice per load, a failed member list rendering
  as an empty one, a stale "Initializing upload..." beside a failure, and a
  registration banner pointing at an email that never arrives.

Consistency and access:

- the two download routes answer 404 for an id belonging to another tenant, as
  the comment export route already did. A caller who does belong still gets 403.
- accessible names for the share-link password field, the guest name gates, the
  version dialog inputs and the comment-tag controls.

Repository health:

- the runner image installs production dependencies only.
- a setup file for the unit project restores stubbed env centrally.
- native tsconfig path resolution replaces vite-tsconfig-paths.
- `uploadBytesWithProgress` exists once.
- admin stats bill Bunny storage to the workspace owner like every other
  quota, gate on the configured flag, wire up the single-flight guard and count
  the statuses that belonged to no bucket.
- `r2Client.destroy()` releases the presign client too.
- `prepare` tolerates a production install, where husky is absent.
2026-07-26 18:53:54 +07:00
Yusuf İpek 58910a5f5a Merge pull request #39 from yusufipk/worktree-frame-counter
feat(player): add frame counter when scrubbing and seeking
2026-07-25 13:10:11 +03:00
yusufipk b23f3de666 feat(player): add frame counter when scrubbing and seeking
Show a timecode + frame readout above the timeline while dragging the
playhead, and flash it for a moment on keyboard/button seeks so frame
stepping is visible too.

Position and text are written from the existing rAF/DOM path that drives
the playhead, so the readout stays smooth without extra React renders.

Two supporting fixes the count depends on:

- Seed the frame rate from the HLS manifest FRAME-RATE attribute so a
  frame number is available before playback ever starts; previously the
  rate was only ever measured from requestVideoFrameCallback and stayed
  null until the video had played.
- Snap the measured rate to the nearest broadcast standard and skip
  samples taken mid-seek. A drifting float slid the count by whole
  frames late in a long video, and re-publishing a slightly different
  float on every presented frame forced a re-render per video frame.
2026-07-25 17:07:34 +07:00
yusufipk 2bad0a249f refactor(video): share R2 playback URL resolution and guard drift resync
- move resolveR2PlaybackUrl into lib/video-upload-validation.ts so the compare
  view and the main video page cannot drift apart
- validate the resolved URL with isPlayableVideoUrl before it reaches <video src>
- add a per-player cooldown so a follower that cannot keep up is not seeked
  every second, which would stutter rather than correct
2026-07-25 16:48:39 +07:00
yusufipk bede216081 perf: smooth playhead + live scrubbing preview
Drive the timeline progress fill and playhead directly via a
requestAnimationFrame loop (bypassing React state) so the playhead glides
at the display refresh rate during playback instead of stepping ~4x/sec.

Scrubbing now previews frames live like an editor: while dragging, the
video is seeked with coalescing (one seek in flight, chasing the latest
target) so HLS stays responsive without stale-seek pileup. Playback pauses
during a scrub and resumes on release. Dragging tracks the cursor anywhere
on the page via window listeners.
2026-07-10 21:31:36 +07:00
yusufipk 00124bc7c2 feat: bulk video uploads and S3 asset video support (#18)
Add multi-file drag-and-drop queues for project videos and the assets pane, and route asset video uploads through S3/R2 when direct Bunny uploads are disabled.
2026-06-13 23:24:21 +02:00
yusufipk 4bf6e821af feat: enable S3 video uploads and update related configurations
- Added support for self-hosted S3 video uploads with new environment variables: OPENFRAME_ENABLE_S3_VIDEO_UPLOADS and OPENFRAME_MAX_VIDEO_UPLOAD_BYTES.
- Updated .env.example and .env.docker.example to reflect new configuration options.
- Enhanced Content Security Policy to include origins for S3-compatible storage.
- Updated dependencies for AWS SDK to support new features.
- Refactored upload logic to accommodate both Bunny and S3 upload providers.
- Updated documentation to clarify the usage of direct uploads and S3 configurations.
- Closes #11
2026-05-27 17:04:39 +02:00
yusufipk 378ca1977b feat: enhance comment functionality with timestamp range support
- Added timestampEnd to Comment and CommentReply interfaces.
- Implemented logic for handling comment timestamp ranges in the comment composer and comments pane.
- Updated video player and player core to support frame stepping and improved seeking functionality.
- Introduced frame mode toggle for precise navigation during video playback.
- Closes #12
2026-04-25 22:58:16 +03:00
Enes Köksal 3cfea40fbd refactor: eslint and prettier conflict will be resolved and formatted 2026-04-23 17:05:43 +03:00
Yusuf İpek 439e74d037 feat(validation): implement validateAnnotationStrokes function for safe annotation data handling
feat(rate-limit): add TRUSTED_PROXY_MODE for configurable proxy header trust
feat(comments): validate annotation data structure in comment routes and components
2026-04-10 20:38:22 +03:00
Yusuf İpek b1b1715578 Refactor registration and dashboard features to support invite codes and Bunny uploads
- Moved registration logic to a new client component for better separation of concerns.
- Integrated invite code requirement based on feature flags in the registration process.
- Enhanced dashboard functionality to conditionally enable Bunny uploads based on feature flags.
- Updated various components and API routes to check for Bunny uploads and Stripe billing feature flags.
- Added new feature flag utilities for managing feature toggles in the application.
2026-04-08 18:46:12 +03:00
Yusuf İpek 75535e8cda feat(comments): add drag-and-drop support for image attachments and enhance image validation 2026-03-01 18:53:54 +03:00
Yusuf İpek 60add2a1c4 feat(comments): implement asset handling for attached images in comment creation 2026-02-26 12:45:23 +03:00
Yusuf İpek 4ea6099508 feat(bunny-cdn): refactor CDN hostname resolution and update asset URLs for improved flexibility 2026-02-26 11:53:03 +03:00
Yusuf İpek 15fa9452a4 feat(video-player): add Bunny original-source fallback and quality option, plus approval/download UI tweaks 2026-02-26 10:02:11 +03:00
Yusuf İpek 9ce033d306 feat(video-assets): add full video asset system (uploads, downloads, @mentions, and cleanup/billing integration) 2026-02-25 18:34:03 +03:00
Yusuf İpek a2b07b3e19 feat: add approvals workflow and unified member invitation management across projects, workspaces, and videos 2026-02-25 16:24:45 +03:00
Yusuf İpek 0ae1becc1b refactor(video-page): split video page into modular components, hooks, and shared types 2026-02-25 15:01:37 +03:00
Yusuf İpek a096a5ea02 Remove pinned timestamp control from video page comment composer 2026-02-24 18:30:50 +03:00
Yusuf İpek 068bc6f788 fix(player): stop YouTube iframe re-init loop 2026-02-24 18:23:20 +03:00
Yusuf İpek 9f32aeafe6 optimize watch progress persistence with debounced client saves and tiny-delta server skip 2026-02-24 17:51:40 +03:00
Yusuf İpek ffa55d7dcc feat(video): lazy-load version comments and add ETag-based comment caching 2026-02-24 16:34:16 +03:00
Yusuf İpek 4083651025 Restrict guest CSV comment export in UI and fix lint/typecheck cleanup in comment APIs 2026-02-24 15:03:42 +03:00
Yusuf İpek 1708c5c99c fix(video-player): preserve playback state when seeking to timestamps 2026-02-23 18:25:25 +03:00
Yusuf İpek dd884a325c Add admin-only comment resolution controls 2026-02-23 18:21:10 +03:00
Yusuf İpek fe7235052e Add guest upload tokens and share-session aware permissions 2026-02-23 18:17:22 +03:00
Yusuf İpek 9058317247 feat(share): add video-level secure share links with password unlock and session-based watch/comment access 2026-02-23 17:11:32 +03:00
Yusuf İpek d15e5192ac chore: clean up lint/type issues and tighten comment media URL validation 2026-02-23 16:06:43 +03:00
Yusuf İpek 0288fe08d3 feat(video-download): add Bunny original/compressed download options with secure file handling and tighter rate limits 2026-02-22 16:33:52 +03:00
Yusuf İpek 2115d986af feat(video): add secure download flow with Bunny API proxy, quality validation, rate limiting, and direct URL host allowlist 2026-02-22 14:19:09 +03:00
Yusuf İpek 72d14f4a5d feat(comments): add secure CSV/PDF export for version comments with auth, rate limits, and CSV injection hardening 2026-02-22 13:56:02 +03:00
Yusuf İpek e30b4a5b19 feat: harden Bunny upload flow, migrate Bunny playback to hls.js, and add Bunny storage admin stats 2026-02-22 13:03:45 +03:00
Yusuf İpek 0f24bcfe6c feat: Implement direct video file uploads via Bunny.net and TUS protocol, adding a new API route and UI for file selection. 2026-02-22 09:55:08 +03:00
Yusuf İpek 5547346082 feat: Implement multi-panel video comparison with shared playback controls, timeline comments, and YouTube API integration. 2026-02-22 07:56:27 +03:00
Yusuf İpek 87d6c0ab0a feat: Add a close button to the annotation toolbar and ensure annotation mode is correctly reset upon removal. 2026-02-22 06:30:10 +03:00
Yusuf İpek d731c9434a feat: Add drawing annotation functionality to comments, including a new canvas component and API integration for creation, retrieval, and updates. 2026-02-21 20:23:15 +03:00
Yusuf İpek 4cb4089caa feat: enhance responsive layout of video page by adjusting visibility of the sidebar, video title, and new version button on various screen sizes. 2026-02-21 19:29:43 +03:00
Yusuf İpek e32196c430 fix: address security vulnerabilities and add image attachments
- Fix type confusion vulnerability in comment content updates
- Validate pagination offsets to prevent negative values
- Validate timestamp is a valid number before parsing
- Exclude guestEmail from comment API responses for privacy
- Fix TypeScript error in audio upload route
- Add image attachment support for comments with upload API
- Update admin dashboard to track image attachments
- Rename cleanup functions to handle both voice and image media
2026-02-21 16:40:58 +03:00
Yusuf İpek cd9b89c971 feat: Introduce Linkify component to automatically convert URLs in comment and reply content into clickable links. 2026-02-21 10:50:45 +03:00
Yusuf İpek 1bb1c8e574 feat: Enhance dashboard responsiveness across various pages and update project visibility icons for improved clarity. 2026-02-20 14:28:43 +03:00
Yusuf İpek 7e55c578df remove experimental vimeo video provider support 2026-02-15 12:55:36 +03:00
Yusuf İpek c572ddb522 feat(video): add fullscreen mode with keyboard shortcut and error handling
- Add fullscreen toggle (F key and button) for video player
- Add comments panel visibility toggle in fullscreen mode
- Rename isFullscreen to isFullscreenMode for clarity
- Add toast error handling for fullscreen API failures
- Fix indentation issues in JSX
2026-02-15 12:50:37 +03:00
Yusuf İpek da8c62e60d fix(ui): use filteredComments instead of comments in video page 2026-02-15 10:56:41 +03:00
Yusuf İpek 643697dc00 fix(ui): add defensive checks for undefined replies in video page comments 2026-02-15 09:36:02 +03:00
Yusuf İpek bf6a8aa4e8 fix(ui): add defensive replies array handling in video page comments 2026-02-15 09:29:50 +03:00
Yusuf İpek 81c0d41a26 feat(watch): add pause and visibility change progress saving with rate limiting
- Save watch progress immediately when video is paused using player instance directly
- Save progress when tab becomes hidden (user switches tabs or minimizes)
- Add rate limiting (30/min) to watch progress API endpoint to prevent abuse
- Use player instance directly instead of React state for current time/duration to avoid stale values
2026-02-15 09:22:25 +03:00