Skip to content

Conversation

@Brendonovich
Copy link
Contributor

@Brendonovich Brendonovich commented Oct 31, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced embed code generation and sharing with automatic sanitization and improved error handling with user notifications.
  • Bug Fixes

    • Improved error handling for embedded video page access scenarios.
  • Documentation

    • Updated self-hosting documentation by removing outdated embedded video references.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The PR refactors embed code generation into a reusable hook with public environment URLs, improves error handling with try/catch patterns, removes deprecated video embeds from documentation, and adds a middleware routing exception for /middleware paths to prevent login redirects.

Changes

Cohort / File(s) Summary
Embed & Sharing Refactoring
apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx, apps/web/app/embed/[videoId]/page.tsx
Introduced useEmbedCode hook for sanitized embed HTML generation; replaced hard-coded embed logic with reusable hook call; added error handling with try/catch and toast notifications; refactored inline arrow function to single-line; changed NoSuchElementException error handling to delay notFound() evaluation via Effect.sync(() => notFound())
Middleware Access Control
apps/web/middleware.ts
Added /middleware as an allowed path exception alongside existing non-CAP flow exceptions (s/, dashboard, onboarding, api, login, signup, invite, self-hosting, terms, verify-otp) to prevent redirect-to-login behavior
Documentation Updates
apps/web/content/docs/self-hosting.mdx
Removed three video embed lines referencing cap.so/api/playlist endpoints

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Error handling behavioral change: The shift from Effect.sync(notFound()) to Effect.sync(() => notFound()) changes evaluation timing and warrants careful validation that the lazy evaluation does not introduce unexpected behavior in error scenarios.
  • New hook implementation: Review the useEmbedCode hook logic for correct whitespace normalization, sanitization, and proper use of usePublicEnv.
  • Integration consistency: Verify that the embed code generation is correctly applied across both the SharingDialog display and copy-to-clipboard paths.

Possibly related PRs

  • Cap#827: Refactors the same SharingDialog/embed code path to generate embed HTML using public environment URLs.
  • Cap#1156: Modifies the dashboard sharing flow with SharingDialog integration and usePublicEnv-driven URL and embed generation logic.

Poem

🐰 Embeds now nestle in hooks so fine,
With public URLs in perfect line,
Errors caught with try and care,
Middleware paths flow everywhere,
Old videos fade, refactored code takes flight!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch self-hosted-fixes

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 415d93d and b8e939f.

📒 Files selected for processing (4)
  • apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx (4 hunks)
  • apps/web/app/embed/[videoId]/page.tsx (2 hunks)
  • apps/web/content/docs/self-hosting.mdx (0 hunks)
  • apps/web/middleware.ts (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Brendonovich Brendonovich merged commit b4aceaf into main Oct 31, 2025
14 of 15 checks passed
@ameer2468 ameer2468 deleted the self-hosted-fixes branch October 31, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants