From b58951249e7e7903606e531bf1ff56bfacdcefc5 Mon Sep 17 00:00:00 2001 From: Poyraz Avsever Date: Thu, 16 Apr 2026 21:53:06 +0300 Subject: [PATCH 01/10] chore: add contribution governance docs and dotenv dependency --- .github/ISSUE_TEMPLATE/bug_report.md | 52 +++++ .github/ISSUE_TEMPLATE/config.yml | 5 + .github/ISSUE_TEMPLATE/feature_request.md | 45 ++++ .github/PULL_REQUEST_TEMPLATE.md | 62 ++++++ CODEOWNERS | 10 + CODE_OF_CONDUCT.md | 80 +++++++ CONTRIBUTING.md | 244 ++++++++++++++++++++++ README.md | 8 + bun.lock | 7 +- package.json | 1 + 10 files changed, 512 insertions(+), 2 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 CODEOWNERS create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..a823016 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,52 @@ +--- +name: Bug report +about: Report a reproducible bug in OpenFrame +title: "bug: " +labels: [bug] +assignees: [] +--- + +## Bug summary + +What went wrong? + +## Steps to reproduce + +1. +2. +3. + +## Expected behavior + +What should have happened? + +## Actual behavior + +What happened instead? + +## Environment + +- OpenFrame version/branch: +- Bun version: +- Node version: +- Browser (if UI issue): +- OS: + +## Relevant logs/errors + +```text +Paste error logs, stack traces, or API errors here. +``` + +## Scope and impact + +- [ ] Blocking +- [ ] High +- [ ] Medium +- [ ] Low + +Who is affected and how? + +## Additional context + +Screenshots, recordings, or links. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..40b3872 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Questions and contribution help + url: https://github.com/yusufipk/OpenFrame/blob/main/CONTRIBUTING.md + about: Use issues for actionable tasks; for questions, include context and expected outcome. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..99b9e19 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,45 @@ +--- +name: Feature request +about: Suggest an improvement for OpenFrame +title: "feat: " +labels: [enhancement] +assignees: [] +--- + +## Problem statement + +What problem are you trying to solve? + +## Proposed solution + +What do you want to happen? + +## Alternatives considered + +What alternatives did you evaluate? + +## Scope + +Which areas are affected? + +- [ ] API +- [ ] Auth/access +- [ ] Database +- [ ] UI/UX +- [ ] Docs +- [ ] DevEx/Operations + +## Acceptance criteria + +How will we know this is done? + +- [ ] Criterion 1 +- [ ] Criterion 2 + +## Non-goals (optional) + +What is explicitly out of scope? + +## Additional context + +Mockups, examples, or references. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..d66db9e --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,62 @@ +## Summary + +Explain what changed in this PR. + +## Why + +Explain the problem this PR solves. + +## Type of change + +- [ ] feat +- [ ] fix +- [ ] docs +- [ ] refactor +- [ ] chore +- [ ] test + +## Scope + +What areas are affected? + +- [ ] API routes +- [ ] Auth / access control +- [ ] Database schema / migration +- [ ] UI / UX +- [ ] Documentation +- [ ] Other + +## Validation + +- [ ] I ran `bun run check`. +- [ ] I ran `bun run db:generate` if `prisma/schema.prisma` changed. +- [ ] I manually tested affected flows. + +Validation notes: + +```text +Paste command output or manual test notes here. +``` + +## Breaking changes + +- [ ] No breaking changes +- [ ] This PR introduces a breaking change (describe below) + +If breaking, explain migration path: + +## Database / migration notes + +If schema changed, summarize migration impact. + +## Screenshots / examples (if relevant) + +Add screenshots or API request/response examples. + +## Checklist + +- [ ] PR title follows Conventional Commits (`type(scope): summary`). +- [ ] I used `successResponse` / `apiErrors` for API response changes. +- [ ] I used `auth()` and shared access checks (`checkProjectAccess` / `checkWorkspaceAccess`) where relevant. +- [ ] I updated docs when behavior changed. +- [ ] No secrets or unrelated file changes are included. diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..ffe83da --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,10 @@ +# Global default owners +* @yusufipk + +# Critical security and access control areas + +/lib/auth.ts @yusufipk +/lib/route-access.ts @yusufipk +/app/api/auth/ @yusufipk +/app/api/stripe/ @yusufipk +/prisma/ @yusufipk diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..0439d9e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,80 @@ +# Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Taking responsibility, apologizing to those affected by mistakes, and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Enforcement Responsibilities + +Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to behavior they deem inappropriate, threatening, offensive, or harmful. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces and also applies when an individual is officially representing the project in public spaces. Examples include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Enforcement + +If you experience or witness unacceptable behavior, report it by opening a private security advisory at: + +- https://github.com/yusufipk/OpenFrame/security/advisories/new + +Reports will be reviewed and investigated promptly and fairly. +All maintainers are obligated to respect the privacy and security of the reporter. + +## Enforcement Guidelines + +Maintainers will follow these Community Impact Guidelines in determining consequences: + +### 1. Correction + +Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome. + +Consequence: A private, written warning from maintainers, providing clarity around the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +Community Impact: A violation through a single incident or series of actions. + +Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction, for a specified period. Violating these terms may lead to a temporary or permanent ban. + +### 3. Temporary Ban + +Community Impact: A serious violation of community standards, including sustained inappropriate behavior. + +Consequence: A temporary ban from any interaction or public communication with the community for a specified period. No public or private interaction with the people involved is allowed during this period. Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +Consequence: A permanent ban from any sort of public interaction within the project community. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 2.1: + +- https://www.contributor-covenant.org/version/2/1/code_of_conduct.html + +Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..51226e5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,244 @@ +# Contributing to OpenFrame + +Thanks for taking the time to contribute to OpenFrame. +This guide explains where contributions are most useful, how to prepare a pull request, and which project conventions are required. + +## Ways to Contribute + +You can contribute in several ways: + +- Fix bugs in existing behavior. +- Improve reliability, safety, and performance. +- Build features that align with product goals. +- Improve documentation in [README.md](README.md) and related in-repo docs. +- Add tests and increase confidence for risky paths. + +## What To Work On + +Good places to contribute: + +- API routes in [app/api](app/api) +- Auth and access control in [lib/auth.ts](lib/auth.ts) and [lib/route-access.ts](lib/route-access.ts) +- API response consistency in [lib/api-response.ts](lib/api-response.ts) +- Data model and migrations in [prisma/schema.prisma](prisma/schema.prisma) and [prisma/migrations](prisma/migrations) +- Video review UI in [components/video-page](components/video-page) +- Operational and setup docs in [README.md](README.md) + +If your change is large, open an issue first so scope can be aligned. + +## Local Setup + +1. Install dependencies: + +```bash +bun install +``` + +2. Copy environment file and set required values: + +```bash +cp .env.example .env +``` + +3. Ensure Prisma client is generated: + +```bash +bun run db:generate +``` + +4. Run validation: + +```bash +bun run check +``` + +Optional helpful commands: + +```bash +bun run db:push +bun run db:migrate +bun run db:seed +``` + +## Contribution Workflow + +1. Fork and create a branch from `main`. +2. Keep changes focused on one logical concern. +3. Follow coding and architecture conventions in this guide. +4. Run required validation locally. +5. Open a PR with a clear description and checklist. + +## Branch Naming + +Use one of these prefixes: + +- `feature/` +- `fix/` +- `docs/` +- `refactor/` +- `chore/` + +Examples: + +- `feature/approval-request-filters` +- `fix/share-link-password-validation` +- `docs/contributing-guide` + +## Commit and PR Title Standard + +Use Conventional Commits style: + +- `feat: add workspace invite resend endpoint` +- `fix: prevent guest comment without share permission` +- `docs: add contribution workflow examples` +- `refactor: simplify project access checks` + +Recommended pattern: + +```text +type(scope): short summary +``` + +Examples: + +- `feat(api): add comment export pagination` +- `fix(auth): block unverified credential sign-in` + +## Required Checks Before Opening a PR + +You should run: + +```bash +bun run check +``` + +If you changed [prisma/schema.prisma](prisma/schema.prisma), also run: + +```bash +bun run db:generate +``` + +Also verify: + +- No unrelated file changes are included. +- No secrets or private keys are committed. +- Docs are updated when behavior changes. + +## Project Conventions (Must Follow) + +### Package and scripts + +- Use Bun commands only for dependency and script workflows. +- Keep lockfile changes intentional and minimal. + +### Auth and authorization + +- Server-side session reads: use `auth()` from [lib/auth.ts](lib/auth.ts). +- Access checks: use `checkProjectAccess()` / `checkWorkspaceAccess()`. +- Do not implement ad-hoc role checks when shared helpers exist. + +### API responses + +- Use `successResponse` / `apiErrors` from [lib/api-response.ts](lib/api-response.ts). +- Keep error messages specific but safe. + +### Dynamic route params + +In App Router dynamic routes, keep `params` typed as `Promise<...>` and use `await params`. + +### Database write safety + +- For multi-step DB writes, use Prisma transactions. +- Prefer backward-compatible API changes unless a breaking change is explicitly required. +- If custom SQL is needed, manage it in migration SQL files under [prisma/migrations](prisma/migrations). + +### Imports + +- Prefer `@/` alias imports when available. + +## Database Change Guidelines + +When changing data model behavior: + +1. Update [prisma/schema.prisma](prisma/schema.prisma). +2. Generate Prisma client (`bun run db:generate`). +3. Add/update migration files as needed under [prisma/migrations](prisma/migrations). +4. Validate affected endpoints and access-control paths. +5. Include migration notes in the PR description. + +## Frontend Change Guidelines + +- Preserve existing UI patterns and information architecture. +- Keep components focused; extract reusable logic into hooks/services. +- Avoid unrelated visual churn in functional PRs. +- Ensure desktop and mobile behavior remains usable. + +## Documentation Change Guidelines + +- Primary project docs: [README.md](README.md) +- For technical changes, document behavior in the most relevant existing file or PR notes. +- Keep docs practical and update them in the same PR when behavior changes. + +## Pull Request Checklist + +Before submitting, confirm: + +- [ ] My branch is focused on one concern. +- [ ] I followed project conventions in this guide. +- [ ] I ran `bun run check`. +- [ ] I ran `bun run db:generate` if schema changed. +- [ ] I updated docs for user-visible or architectural changes. +- [ ] I added screenshots or request/response examples when useful. +- [ ] My PR description explains what changed and why. + +## PR Description Template (Recommended) + +```markdown +## Summary + +Short description of what changed. + +## Why + +What problem this solves. + +## Changes + +- Key change 1 +- Key change 2 + +## Validation + +- bun run check +- Manual test notes + +## Notes + +Any migration, compatibility, or follow-up notes. +``` + +## Review Expectations + +Maintainers will usually review for: + +- Correctness and regressions +- Security and access control +- API contract compatibility +- Code clarity and maintainability +- Operational safety (migrations, cleanup impact) + +Please be responsive to review comments and keep follow-up commits scoped. + +## Security Issues + +Do not open public issues for security vulnerabilities. +Please follow [SECURITY.md](SECURITY.md). + +## Code of Conduct + +Please follow [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). + +## Need Help? + +If you are unsure where to start, open an issue with context and a proposed approach. +Maintainers can help you scope the change before implementation. diff --git a/README.md b/README.md index 1cc221e..d6ed518 100644 --- a/README.md +++ b/README.md @@ -151,3 +151,11 @@ bun run check ``` Feature flags and self-hosting environment variables are documented in `.env.example` and `.env.docker.example`. + +## Contributing + +Contributions are welcome. + +- Read [CONTRIBUTING.md](CONTRIBUTING.md) for workflow, conventions, and PR requirements. +- Use [SECURITY.md](SECURITY.md) for responsible vulnerability reporting. +- Follow [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) in all project interactions. diff --git a/bun.lock b/bun.lock index 652c648..aeebb40 100644 --- a/bun.lock +++ b/bun.lock @@ -13,10 +13,11 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "date-fns": "^4.1.0", + "dotenv": "^17.4.2", "gsap": "^3.14.2", "hls.js": "^1.6.15", "lucide-react": "^0.563.0", - "next": "^16.2.3", + "next": "16.2.3", "next-auth": "^5.0.0-beta.30", "next-themes": "^0.4.6", "nodemailer": "^8.0.5", @@ -948,7 +949,7 @@ "doctrine": ["doctrine@2.1.0", "", { "dependencies": { "esutils": "^2.0.2" } }, "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw=="], - "dotenv": ["dotenv@17.2.3", "", {}, "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w=="], + "dotenv": ["dotenv@17.4.2", "", {}, "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw=="], "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="], @@ -1904,6 +1905,8 @@ "@dotenvx/dotenvx/commander": ["commander@11.1.0", "", {}, "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ=="], + "@dotenvx/dotenvx/dotenv": ["dotenv@17.2.3", "", {}, "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w=="], + "@dotenvx/dotenvx/execa": ["execa@5.1.1", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="], "@dotenvx/dotenvx/which": ["which@4.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg=="], diff --git a/package.json b/package.json index e7c766c..7f39697 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "date-fns": "^4.1.0", + "dotenv": "^17.4.2", "gsap": "^3.14.2", "hls.js": "^1.6.15", "lucide-react": "^0.563.0", From 97fbdc51a1caef08c8fdf396a5de55b92e88d74f Mon Sep 17 00:00:00 2001 From: Poyraz Avsever Date: Thu, 16 Apr 2026 21:53:23 +0300 Subject: [PATCH 02/10] docs: add security policy --- SECURITY.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..51c3d7c --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,51 @@ +# Security Policy + +## Supported Versions + +OpenFrame is under active development. +Security fixes are prioritized for the latest code on `main` and recent release tags (if available). + +## Reporting a Vulnerability + +Please do not report security vulnerabilities in public issues. + +Use GitHub private security advisories: + +- https://github.com/yusufipk/OpenFrame/security/advisories/new + +Include as much detail as possible: + +- Affected area (API route, auth flow, upload flow, etc.) +- Reproduction steps +- Proof of concept (if available) +- Potential impact +- Suggested remediation (optional) + +## What to Expect + +After a private report is submitted: + +1. Maintainers acknowledge receipt. +2. Impact and exploitability are triaged. +3. A fix is prepared and validated. +4. Disclosure timing is coordinated. +5. Credits are given when appropriate. + +## Scope Highlights + +Security-sensitive areas in this repository include: + +- Authentication and session handling in [lib/auth.ts](lib/auth.ts) +- Access control checks in [lib/route-access.ts](lib/route-access.ts) +- Share-link and guest access flows in [lib/share-links.ts](lib/share-links.ts) and [app/watch](app/watch) +- Upload validation and storage paths in [app/api/upload](app/api/upload) +- Billing and webhook handling in [app/api/billing](app/api/billing) and [app/api/stripe/webhook/route.ts](app/api/stripe/webhook/route.ts) + +## Safe Contribution Reminders + +When contributing fixes: + +- Avoid logging secrets or sensitive payloads. +- Keep error responses safe and non-leaky. +- Preserve access-control checks (do not bypass shared helpers). +- Add regression tests or reproduction notes for the fix. From e2272ed73ddcf2e41a1e4b24a01a2e3b1b817bc7 Mon Sep 17 00:00:00 2001 From: Poyraz Avsever Date: Thu, 16 Apr 2026 22:14:08 +0300 Subject: [PATCH 03/10] revert: remove dependency and lockfile updates --- bun.lock | 7 ++----- package.json | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bun.lock b/bun.lock index aeebb40..652c648 100644 --- a/bun.lock +++ b/bun.lock @@ -13,11 +13,10 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "date-fns": "^4.1.0", - "dotenv": "^17.4.2", "gsap": "^3.14.2", "hls.js": "^1.6.15", "lucide-react": "^0.563.0", - "next": "16.2.3", + "next": "^16.2.3", "next-auth": "^5.0.0-beta.30", "next-themes": "^0.4.6", "nodemailer": "^8.0.5", @@ -949,7 +948,7 @@ "doctrine": ["doctrine@2.1.0", "", { "dependencies": { "esutils": "^2.0.2" } }, "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw=="], - "dotenv": ["dotenv@17.4.2", "", {}, "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw=="], + "dotenv": ["dotenv@17.2.3", "", {}, "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w=="], "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="], @@ -1905,8 +1904,6 @@ "@dotenvx/dotenvx/commander": ["commander@11.1.0", "", {}, "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ=="], - "@dotenvx/dotenvx/dotenv": ["dotenv@17.2.3", "", {}, "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w=="], - "@dotenvx/dotenvx/execa": ["execa@5.1.1", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="], "@dotenvx/dotenvx/which": ["which@4.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg=="], diff --git a/package.json b/package.json index 7f39697..e7c766c 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "date-fns": "^4.1.0", - "dotenv": "^17.4.2", "gsap": "^3.14.2", "hls.js": "^1.6.15", "lucide-react": "^0.563.0", From ac70f657cb2d1a75768eace49c73f10ecbf8735b Mon Sep 17 00:00:00 2001 From: poyrazavsever Date: Sat, 18 Apr 2026 17:15:59 +0300 Subject: [PATCH 04/10] fix: update branch references from 'main' to 'master' in configuration and documentation files --- .github/ISSUE_TEMPLATE/config.yml | 2 +- CODEOWNERS | 8 ------- CONTRIBUTING.md | 39 +------------------------------ SECURITY.md | 2 +- 4 files changed, 3 insertions(+), 48 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 40b3872..ed246d2 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: true contact_links: - name: Questions and contribution help - url: https://github.com/yusufipk/OpenFrame/blob/main/CONTRIBUTING.md + url: https://github.com/yusufipk/OpenFrame/blob/master/CONTRIBUTING.md about: Use issues for actionable tasks; for questions, include context and expected outcome. diff --git a/CODEOWNERS b/CODEOWNERS index ffe83da..cfaab40 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,10 +1,2 @@ # Global default owners * @yusufipk - -# Critical security and access control areas - -/lib/auth.ts @yusufipk -/lib/route-access.ts @yusufipk -/app/api/auth/ @yusufipk -/app/api/stripe/ @yusufipk -/prisma/ @yusufipk diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 51226e5..09384be 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,7 +62,7 @@ bun run db:seed ## Contribution Workflow -1. Fork and create a branch from `main`. +1. Fork and create a branch from `master`. 2. Keep changes focused on one logical concern. 3. Follow coding and architecture conventions in this guide. 4. Run required validation locally. @@ -179,43 +179,6 @@ When changing data model behavior: - For technical changes, document behavior in the most relevant existing file or PR notes. - Keep docs practical and update them in the same PR when behavior changes. -## Pull Request Checklist - -Before submitting, confirm: - -- [ ] My branch is focused on one concern. -- [ ] I followed project conventions in this guide. -- [ ] I ran `bun run check`. -- [ ] I ran `bun run db:generate` if schema changed. -- [ ] I updated docs for user-visible or architectural changes. -- [ ] I added screenshots or request/response examples when useful. -- [ ] My PR description explains what changed and why. - -## PR Description Template (Recommended) - -```markdown -## Summary - -Short description of what changed. - -## Why - -What problem this solves. - -## Changes - -- Key change 1 -- Key change 2 - -## Validation - -- bun run check -- Manual test notes - -## Notes - -Any migration, compatibility, or follow-up notes. -``` ## Review Expectations diff --git a/SECURITY.md b/SECURITY.md index 51c3d7c..54f432a 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -3,7 +3,7 @@ ## Supported Versions OpenFrame is under active development. -Security fixes are prioritized for the latest code on `main` and recent release tags (if available). +Security fixes are prioritized for the latest code on `master` and recent release tags (if available). ## Reporting a Vulnerability From 702364ac9653d225e067c92747ae5be4ae6574c6 Mon Sep 17 00:00:00 2001 From: poyrazavsever Date: Sat, 18 Apr 2026 18:26:34 +0300 Subject: [PATCH 05/10] refactor: update issue templates for clarity and conciseness --- .github/ISSUE_TEMPLATE/bug_report.md | 6 ++---- .github/ISSUE_TEMPLATE/feature_request.md | 16 +++------------- .github/PULL_REQUEST_TEMPLATE.md | 8 -------- SECURITY.md | 12 ------------ 4 files changed, 5 insertions(+), 37 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index a823016..7ec1a6b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -32,11 +32,9 @@ What happened instead? - Browser (if UI issue): - OS: -## Relevant logs/errors +## Relevant logs/errors (attach files) -```text -Paste error logs, stack traces, or API errors here. -``` +Attach error logs, stack traces, or API error outputs as files/images. If needed, you can add a short summary here. ## Scope and impact diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 99b9e19..b883496 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -18,23 +18,13 @@ What do you want to happen? What alternatives did you evaluate? -## Scope - -Which areas are affected? - -- [ ] API -- [ ] Auth/access -- [ ] Database -- [ ] UI/UX -- [ ] Docs -- [ ] DevEx/Operations - ## Acceptance criteria How will we know this is done? -- [ ] Criterion 1 -- [ ] Criterion 2 +- [ ] User value: The proposed change solves the stated problem in an end-to-end user flow. +- [ ] Security and access control: Existing authorization rules are preserved, and no sensitive data is exposed. +- [ ] Verifiability: Completion is proven with test steps, reproducible evidence, or clear output/screenshots. ## Non-goals (optional) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d66db9e..b7a7dd4 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,14 +6,6 @@ Explain what changed in this PR. Explain the problem this PR solves. -## Type of change - -- [ ] feat -- [ ] fix -- [ ] docs -- [ ] refactor -- [ ] chore -- [ ] test ## Scope diff --git a/SECURITY.md b/SECURITY.md index 54f432a..bef3f47 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -9,10 +9,6 @@ Security fixes are prioritized for the latest code on `master` and recent releas Please do not report security vulnerabilities in public issues. -Use GitHub private security advisories: - -- https://github.com/yusufipk/OpenFrame/security/advisories/new - Include as much detail as possible: - Affected area (API route, auth flow, upload flow, etc.) @@ -41,11 +37,3 @@ Security-sensitive areas in this repository include: - Upload validation and storage paths in [app/api/upload](app/api/upload) - Billing and webhook handling in [app/api/billing](app/api/billing) and [app/api/stripe/webhook/route.ts](app/api/stripe/webhook/route.ts) -## Safe Contribution Reminders - -When contributing fixes: - -- Avoid logging secrets or sensitive payloads. -- Keep error responses safe and non-leaky. -- Preserve access-control checks (do not bypass shared helpers). -- Add regression tests or reproduction notes for the fix. From d9f62f861b2bab45517499b8332b94c5a6cb2d56 Mon Sep 17 00:00:00 2001 From: poyrazavsever Date: Sat, 18 Apr 2026 18:36:35 +0300 Subject: [PATCH 06/10] chore: update Code of Conduct enforcement section and version reference --- CODE_OF_CONDUCT.md | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 0439d9e..9001671 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -34,15 +34,6 @@ Project maintainers have the right and responsibility to remove, edit, or reject This Code of Conduct applies within all community spaces and also applies when an individual is officially representing the project in public spaces. Examples include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. -## Enforcement - -If you experience or witness unacceptable behavior, report it by opening a private security advisory at: - -- https://github.com/yusufipk/OpenFrame/security/advisories/new - -Reports will be reviewed and investigated promptly and fairly. -All maintainers are obligated to respect the privacy and security of the reporter. - ## Enforcement Guidelines Maintainers will follow these Community Impact Guidelines in determining consequences: @@ -73,8 +64,8 @@ Consequence: A permanent ban from any sort of public interaction within the proj ## Attribution -This Code of Conduct is adapted from the Contributor Covenant, version 2.1: +This Code of Conduct is adapted from the Contributor Covenant, version 3.0: -- https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +- https://www.contributor-covenant.org/version/3/0/code_of_conduct/ Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder. From d3d57b098bb2ce2b504db44665b10d4fb7e13cfa Mon Sep 17 00:00:00 2001 From: Poyraz Avsever Date: Sat, 18 Apr 2026 21:51:19 +0300 Subject: [PATCH 07/10] refactor: update issue and pull request templates for clarity and consistency --- .github/ISSUE_TEMPLATE/feature_request.md | 8 +++---- .github/PULL_REQUEST_TEMPLATE.md | 27 ++++++++++------------- SECURITY.md | 11 --------- 3 files changed, 15 insertions(+), 31 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index b883496..28d34ac 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -18,13 +18,11 @@ What do you want to happen? What alternatives did you evaluate? -## Acceptance criteria +## Success criteria (optional) -How will we know this is done? +How will we know this request is successful? -- [ ] User value: The proposed change solves the stated problem in an end-to-end user flow. -- [ ] Security and access control: Existing authorization rules are preserved, and no sensitive data is exposed. -- [ ] Verifiability: Completion is proven with test steps, reproducible evidence, or clear output/screenshots. +Describe 1-3 concrete outcomes. ## Non-goals (optional) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index b7a7dd4..33cf586 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,11 +1,10 @@ ## Summary -Explain what changed in this PR. + ## Why -Explain the problem this PR solves. - + ## Scope @@ -18,11 +17,17 @@ What areas are affected? - [ ] Documentation - [ ] Other -## Validation +## Before opening PR +- [ ] I have read [CONTRIBUTING.md](CONTRIBUTING.md) and followed repository conventions. - [ ] I ran `bun run check`. - [ ] I ran `bun run db:generate` if `prisma/schema.prisma` changed. - [ ] I manually tested affected flows. +- [ ] PR title follows Conventional Commits (`type(scope): summary`). +- [ ] I used `successResponse` / `apiErrors` for API response changes. +- [ ] I used `auth()` and shared access checks (`checkProjectAccess` / `checkWorkspaceAccess`) where relevant. +- [ ] I updated docs when behavior changed. +- [ ] No secrets or unrelated file changes are included. Validation notes: @@ -35,20 +40,12 @@ Paste command output or manual test notes here. - [ ] No breaking changes - [ ] This PR introduces a breaking change (describe below) -If breaking, explain migration path: + ## Database / migration notes -If schema changed, summarize migration impact. + ## Screenshots / examples (if relevant) -Add screenshots or API request/response examples. - -## Checklist - -- [ ] PR title follows Conventional Commits (`type(scope): summary`). -- [ ] I used `successResponse` / `apiErrors` for API response changes. -- [ ] I used `auth()` and shared access checks (`checkProjectAccess` / `checkWorkspaceAccess`) where relevant. -- [ ] I updated docs when behavior changed. -- [ ] No secrets or unrelated file changes are included. + diff --git a/SECURITY.md b/SECURITY.md index bef3f47..fc05a56 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -26,14 +26,3 @@ After a private report is submitted: 3. A fix is prepared and validated. 4. Disclosure timing is coordinated. 5. Credits are given when appropriate. - -## Scope Highlights - -Security-sensitive areas in this repository include: - -- Authentication and session handling in [lib/auth.ts](lib/auth.ts) -- Access control checks in [lib/route-access.ts](lib/route-access.ts) -- Share-link and guest access flows in [lib/share-links.ts](lib/share-links.ts) and [app/watch](app/watch) -- Upload validation and storage paths in [app/api/upload](app/api/upload) -- Billing and webhook handling in [app/api/billing](app/api/billing) and [app/api/stripe/webhook/route.ts](app/api/stripe/webhook/route.ts) - From c73bc9a19a7f059b3bf679945b3e445e15fe6421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusuf=20=C4=B0pek?= Date: Mon, 20 Apr 2026 16:48:10 +0300 Subject: [PATCH 08/10] fix(README): correct description of OpenFrame to emphasize fair source --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1cc221e..c05d703 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OpenFrame -OpenFrame is an open source video review and approval platform for teams that need clear feedback, version control, and client-friendly review links in one place. It supports collaborative review workflows out of the box and can be self-hosted with the Docker setup included in this repository. +OpenFrame is a fair source video review and approval platform for teams that need clear feedback, version control, and client-friendly review links in one place. It supports collaborative review workflows out of the box and can be self-hosted with the Docker setup included in this repository. Prefer not to self-host? You can try OpenFrame at [open-frame.net](https://open-frame.net) with a 7-day free trial, then continue on the hosted plan starting at $10. From 91033b1cfb4ccf9a25d72f3ea65bde49192aa9b7 Mon Sep 17 00:00:00 2001 From: Poyraz Avsever Date: Mon, 20 Apr 2026 22:52:07 +0300 Subject: [PATCH 09/10] refactor: streamline bug report template and enhance contributing guidelines --- .github/ISSUE_TEMPLATE/bug_report.md | 9 +- CONTRIBUTING.md | 189 +++++---------------------- SECURITY.md | 1 + 3 files changed, 37 insertions(+), 162 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7ec1a6b..e9d2179 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -36,14 +36,9 @@ What happened instead? Attach error logs, stack traces, or API error outputs as files/images. If needed, you can add a short summary here. -## Scope and impact +## Impact (optional) -- [ ] Blocking -- [ ] High -- [ ] Medium -- [ ] Low - -Who is affected and how? +Who is affected and how severe is the impact? ## Additional context diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 09384be..52fd458 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,76 +1,43 @@ # Contributing to OpenFrame -Thanks for taking the time to contribute to OpenFrame. -This guide explains where contributions are most useful, how to prepare a pull request, and which project conventions are required. +Thanks for taking the time to contribute. +This guide covers setup, PR expectations, and required conventions. -## Ways to Contribute +## Local setup -You can contribute in several ways: - -- Fix bugs in existing behavior. -- Improve reliability, safety, and performance. -- Build features that align with product goals. -- Improve documentation in [README.md](README.md) and related in-repo docs. -- Add tests and increase confidence for risky paths. - -## What To Work On - -Good places to contribute: - -- API routes in [app/api](app/api) -- Auth and access control in [lib/auth.ts](lib/auth.ts) and [lib/route-access.ts](lib/route-access.ts) -- API response consistency in [lib/api-response.ts](lib/api-response.ts) -- Data model and migrations in [prisma/schema.prisma](prisma/schema.prisma) and [prisma/migrations](prisma/migrations) -- Video review UI in [components/video-page](components/video-page) -- Operational and setup docs in [README.md](README.md) - -If your change is large, open an issue first so scope can be aligned. - -## Local Setup - -1. Install dependencies: +1. Install dependencies. ```bash bun install ``` -2. Copy environment file and set required values: +2. Copy environment variables. ```bash cp .env.example .env ``` -3. Ensure Prisma client is generated: +3. Generate Prisma client. ```bash bun run db:generate ``` -4. Run validation: +4. Run validation. ```bash bun run check ``` -Optional helpful commands: - -```bash -bun run db:push -bun run db:migrate -bun run db:seed -``` - -## Contribution Workflow +## Contribution workflow 1. Fork and create a branch from `master`. 2. Keep changes focused on one logical concern. -3. Follow coding and architecture conventions in this guide. -4. Run required validation locally. -5. Open a PR with a clear description and checklist. +3. Follow repository conventions in this file. +4. Run required checks locally. +5. Open a PR with a clear summary and checklist. -## Branch Naming - -Use one of these prefixes: +## Branch naming - `feature/` - `fix/` @@ -78,130 +45,42 @@ Use one of these prefixes: - `refactor/` - `chore/` -Examples: +## Commit and PR title standard -- `feature/approval-request-filters` -- `fix/share-link-password-validation` -- `docs/contributing-guide` - -## Commit and PR Title Standard - -Use Conventional Commits style: - -- `feat: add workspace invite resend endpoint` -- `fix: prevent guest comment without share permission` -- `docs: add contribution workflow examples` -- `refactor: simplify project access checks` - -Recommended pattern: +Use Conventional Commits with this pattern: ```text type(scope): short summary ``` -Examples: +## Required checks before opening a PR -- `feat(api): add comment export pagination` -- `fix(auth): block unverified credential sign-in` +- Run `bun run check`. +- If `prisma/schema.prisma` changed, run `bun run db:generate`. +- Ensure no unrelated file changes are included. +- Ensure no secrets or private keys are committed. +- Update docs when behavior changes. -## Required Checks Before Opening a PR - -You should run: - -```bash -bun run check -``` - -If you changed [prisma/schema.prisma](prisma/schema.prisma), also run: - -```bash -bun run db:generate -``` - -Also verify: - -- No unrelated file changes are included. -- No secrets or private keys are committed. -- Docs are updated when behavior changes. - -## Project Conventions (Must Follow) - -### Package and scripts - -- Use Bun commands only for dependency and script workflows. -- Keep lockfile changes intentional and minimal. - -### Auth and authorization - -- Server-side session reads: use `auth()` from [lib/auth.ts](lib/auth.ts). -- Access checks: use `checkProjectAccess()` / `checkWorkspaceAccess()`. -- Do not implement ad-hoc role checks when shared helpers exist. - -### API responses - -- Use `successResponse` / `apiErrors` from [lib/api-response.ts](lib/api-response.ts). -- Keep error messages specific but safe. - -### Dynamic route params - -In App Router dynamic routes, keep `params` typed as `Promise<...>` and use `await params`. - -### Database write safety +## Project conventions (must follow) +- Use Bun commands only. +- Server-side session reads must use `auth()` from [lib/auth.ts](lib/auth.ts). +- Access control should use `checkProjectAccess()` / `checkWorkspaceAccess()`. +- API responses should use `successResponse` / `apiErrors` from [lib/api-response.ts](lib/api-response.ts). +- In App Router dynamic routes, keep `params` typed as `Promise<...>` and use `await params`. - For multi-step DB writes, use Prisma transactions. -- Prefer backward-compatible API changes unless a breaking change is explicitly required. -- If custom SQL is needed, manage it in migration SQL files under [prisma/migrations](prisma/migrations). +- Prefer backward-compatible API changes unless a breaking change is explicitly requested. +- Prefer `@/` imports when available. -### Imports +## Security issues -- Prefer `@/` alias imports when available. +Do not open public issues for vulnerabilities. +Follow [SECURITY.md](SECURITY.md). -## Database Change Guidelines +## Code of conduct -When changing data model behavior: +Follow [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). -1. Update [prisma/schema.prisma](prisma/schema.prisma). -2. Generate Prisma client (`bun run db:generate`). -3. Add/update migration files as needed under [prisma/migrations](prisma/migrations). -4. Validate affected endpoints and access-control paths. -5. Include migration notes in the PR description. - -## Frontend Change Guidelines - -- Preserve existing UI patterns and information architecture. -- Keep components focused; extract reusable logic into hooks/services. -- Avoid unrelated visual churn in functional PRs. -- Ensure desktop and mobile behavior remains usable. - -## Documentation Change Guidelines - -- Primary project docs: [README.md](README.md) -- For technical changes, document behavior in the most relevant existing file or PR notes. -- Keep docs practical and update them in the same PR when behavior changes. - - -## Review Expectations - -Maintainers will usually review for: - -- Correctness and regressions -- Security and access control -- API contract compatibility -- Code clarity and maintainability -- Operational safety (migrations, cleanup impact) - -Please be responsive to review comments and keep follow-up commits scoped. - -## Security Issues - -Do not open public issues for security vulnerabilities. -Please follow [SECURITY.md](SECURITY.md). - -## Code of Conduct - -Please follow [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). - -## Need Help? +## Need help? If you are unsure where to start, open an issue with context and a proposed approach. -Maintainers can help you scope the change before implementation. diff --git a/SECURITY.md b/SECURITY.md index fc05a56..1b487f6 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -8,6 +8,7 @@ Security fixes are prioritized for the latest code on `master` and recent releas ## Reporting a Vulnerability Please do not report security vulnerabilities in public issues. +Report vulnerabilities by email to info@open-frame.net. Include as much detail as possible: From 066c4247dbdb16ddc2ab28b3bbd813b52008c91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusuf=20=C4=B0pek?= Date: Wed, 22 Apr 2026 15:31:09 +0300 Subject: [PATCH 10/10] feat: add sorting functionality to project videos and update search parameters --- app/(dashboard)/projects/[projectId]/page.tsx | 10 +++++++--- .../projects/[projectId]/project-content-client.tsx | 8 +------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/(dashboard)/projects/[projectId]/page.tsx b/app/(dashboard)/projects/[projectId]/page.tsx index f359c55..50bfdf9 100644 --- a/app/(dashboard)/projects/[projectId]/page.tsx +++ b/app/(dashboard)/projects/[projectId]/page.tsx @@ -36,7 +36,7 @@ function formatRelativeTime(date: Date): string { interface ProjectPageProps { params: Promise<{ projectId: string }>; - searchParams: Promise<{ page?: string }>; + searchParams: Promise<{ page?: string; sort?: string }>; } export default async function ProjectPage({ params, searchParams }: ProjectPageProps) { @@ -45,7 +45,8 @@ export default async function ProjectPage({ params, searchParams }: ProjectPageP const resolvedSearchParams = await searchParams; const page = Number(resolvedSearchParams?.page) || 1; - const pageSize = 20; + const sortOrder = resolvedSearchParams?.sort === 'asc' ? 'asc' : 'desc'; + const pageSize = 21; const skip = (page - 1) * pageSize; // Fetch project with videos @@ -107,7 +108,10 @@ export default async function ProjectPage({ params, searchParams }: ProjectPageP where: { projectId: project.id }, skip, take: pageSize, - orderBy: { position: 'asc' }, + orderBy: [ + { updatedAt: sortOrder }, + { id: sortOrder }, + ], include: { versions: { where: { isActive: true }, diff --git a/app/(dashboard)/projects/[projectId]/project-content-client.tsx b/app/(dashboard)/projects/[projectId]/project-content-client.tsx index ef56c0d..262239a 100644 --- a/app/(dashboard)/projects/[projectId]/project-content-client.tsx +++ b/app/(dashboard)/projects/[projectId]/project-content-client.tsx @@ -82,12 +82,6 @@ export function ProjectContentClient({ [searchParams] ); - const sortedVideos = [...localVideos].sort((a, b) => { - const dateA = new Date(a.updatedAt).getTime(); - const dateB = new Date(b.updatedAt).getTime(); - return sortOrder === 'desc' ? dateB - dateA : dateA - dateB; - }); - const handleVideoDeleted = useCallback((videoId: string) => { setLocalVideos((prev) => prev.filter((video) => video.id !== videoId)); }, []); @@ -188,7 +182,7 @@ export function ProjectContentClient({ {/* Videos Grid */} {localVideos.length > 0 ? (
- {sortedVideos.map((video) => ( + {localVideos.map((video) => (