Commit Graph

79 Commits

Author SHA1 Message Date
cbf6f3c6b6 Fix delete button not refreshing UI after deletion
- Remove router.push() logic that was preventing refresh
- Always call router.refresh() after successful deletion
- Reset state before refresh to clear 'Deleting...' text
- Item now disappears immediately after deletion
2025-12-02 14:41:42 +00:00
e6067e76cd Improve real-time sync speed and caching
- Reduced polling interval from 3s to 2s for faster updates
- Added revalidate = 0 to prevent Next.js caching
- Updates from other browsers now appear within 2 seconds
- Both home page and list detail pages sync faster
2025-12-02 14:38:01 +00:00
78bfcb7ac3 Add optimistic updates for immediate UI feedback
- ToggleItemButton now uses useOptimistic for instant toggle feedback
- InlineItemCreate clears form immediately before server action
- Both components call router.refresh() after mutations
- UI updates appear instantly, no waiting for server response
2025-12-02 14:33:43 +00:00
0fc8c719b9 Add real-time updates and fix delete button state
- Simplified useRealtimeSync to use router.refresh() polling
- Created RealtimeUpdater component for easy integration
- Added real-time updates to home page (3s polling)
- Fixed DeleteItemButton to properly reset state on error
- Updates now refresh every 3 seconds and on window focus
- Changes from other users/browsers will appear quickly
2025-12-02 14:29:28 +00:00
78901c8e2e Fix hydration error in OfflineIndicator component
- Add mounted state to prevent SSR/client mismatch
- Component now only renders after client-side mount
- Resolves React hydration error
2025-12-02 14:22:34 +00:00
ade7ad19d6 Fix getCurrentSession for NextAuth v4 compatibility 2025-12-02 14:12:22 +00:00
d92f13fdc4 Remove build step, use dev server 2025-12-02 14:06:04 +00:00
909f51ff6b Use dev server for NextAuth v4 compatibility 2025-12-02 14:05:46 +00:00
d7297248c1 Fix all NextAuth v4 imports across codebase 2025-12-02 14:03:13 +00:00
2f7bc4fe8e Fix NextAuth v4 imports and exports 2025-12-02 14:01:05 +00:00
40b168b6d8 Update package-lock.json for NextAuth v4 2025-12-02 13:58:40 +00:00
fe783301e7 Downgrade to NextAuth v4 to fix constructor error 2025-12-02 13:56:57 +00:00
60ebf13a9c Simplify Docker setup to fix constructor error
- Remove standalone output mode from Next.js config
- Use single-stage Docker build with npm start
- Eliminate complex multi-stage build that was causing issues
2025-12-02 13:54:26 +00:00
3a3db4195f Fix Docker Prisma constructor error
- Remove --ignore-scripts from npm ci in builder stage
- Simplify Prisma client initialization
- Ensure proper file copying order in Docker
- Remove async connection handling that may cause issues
2025-12-02 13:49:51 +00:00
c0358d79d7 Fix Docker build and Next.js metadata configuration
- Move themeColor and viewport to separate viewport export in layout.tsx
- Improve Docker build process with npm ci and proper dependency handling
- Add Docker-friendly Next.js configuration settings
- Resolve constructor error and metadata warnings
2025-12-02 13:47:40 +00:00
ff16860d8a Revert to production build with proper cookie settings
- Production build is more stable than dev mode
- Cookie settings already fixed for HTTP
- NextAuth v5 beta works better in production mode
2025-12-02 13:31:19 +00:00
855abb98b7 Re-add redirect for unauthenticated users on home page 2025-12-02 13:28:39 +00:00
b9b28ad92c Run as root in dev mode for file write permissions 2025-12-02 13:26:15 +00:00
9f25b30083 Switch to dev server in Docker 2025-12-02 13:22:38 +00:00
adb4f6b119 Set NODE_ENV to development for better NextAuth compatibility
- Avoids production build issues with NextAuth v5 beta
- Enables better error messages for debugging
- Session cookies work correctly in development mode
2025-12-02 13:21:07 +00:00
9bd4dfe0e1 Fix cookie settings for HTTP deployment
- Remove __Secure- prefix for non-HTTPS
- Set secure: false to allow cookies over HTTP
- Enables session persistence in Docker deployment
2025-12-02 13:19:30 +00:00
f3d9ccde56 Remove manual redirect from home page - let middleware handle auth
- Middleware already handles authentication redirects
- Prevents error boundary from catching redirect errors
- Cleaner separation of concerns
2025-12-02 13:17:12 +00:00
ce7021e3fa Use npm install instead of npm ci for deployment flexibility 2025-12-02 13:14:46 +00:00
d677fcb9b5 Fix Docker file copying for standalone build
- Add @prisma client to copied files
- Set proper ownership for nextjs user
- Ensures all required files are available at runtime
2025-12-02 13:11:27 +00:00
b1705fa6da Simplify port mapping: expose 3500 externally, use 3000 internally
- Map host port 3500 to container port 3000
- Keep Next.js on default port 3000 inside container
- Simplifies auth configuration
2025-12-02 13:06:24 +00:00
a084853b6c Add AUTH_URL for NextAuth v5 compatibility
- NextAuth v5 uses AUTH_URL instead of NEXTAUTH_URL
- Keep both for backward compatibility
- Fixes UntrustedHost error
2025-12-02 13:02:10 +00:00
39401a3fa2 Update package-lock.json 2025-12-02 13:00:06 +00:00
899ba97457 Explicitly set trustHost in NextAuth initialization 2025-12-02 12:56:24 +00:00
1c0e0a097e Add AUTH_TRUST_HOST to build environment 2025-12-02 12:52:53 +00:00
fc06003701 Allow .env file in Docker build for private repo 2025-12-02 12:48:43 +00:00
8c9e1a76d1 Fix Prisma client generation for correct platform
- Skip Prisma postinstall during npm ci with --ignore-scripts
- Generate Prisma client explicitly in builder stage
- Ensures correct binary for Debian/Linux platform
2025-12-02 12:46:31 +00:00
92401c5324 Fix home page redirect for unauthenticated users
- Check session before calling getLists()
- Redirect to login page if not authenticated
- Prevents server component render error in production
2025-12-02 12:40:15 +00:00
c51bc28d67 Add AUTH_TRUST_HOST environment variable for Docker
- Set AUTH_TRUST_HOST=true in .env and docker-compose.yml
- Ensures NextAuth trusts all hosts in Docker environment
- Fixes UntrustedHost error
2025-12-02 12:35:23 +00:00
f1cbd88761 Switch to Debian-based Node image for Prisma compatibility
- Change from node:20-alpine to node:20-slim
- Fixes OpenSSL library compatibility issues with Prisma
- Debian has better support for Prisma's binary engines
2025-12-02 12:32:23 +00:00
9ebb2786b3 Fix Prisma OpenSSL compatibility for Alpine Docker
- Add openssl package to all Docker build stages
- Ensures Prisma engine works on Alpine Linux ARM64
- Fixes libssl.so.1.1 missing library error
2025-12-02 12:28:40 +00:00
86ef3c41d5 Fix NextAuth trusted host for Docker deployment
- Add trustHost: true to auth.config.ts
- Remove obsolete version field from docker-compose.yml
2025-12-02 12:15:08 +00:00
c5182e3b99 Update .env with DB credentials and port 3500 2025-12-02 10:14:48 +00:00
37e0620caf Include .env in repo for private deployment 2025-12-02 10:10:37 +00:00
0d26087049 Add Docker configuration for port 3500
- Add Dockerfile with multi-stage build for production
- Add docker-compose.yml for easy deployment
- Add .dockerignore to exclude unnecessary files
- Add DOCKER_SETUP.md with comprehensive setup guide
- Update next.config.js to enable standalone output mode
- Configure app to run on port 3500
- Keep MySQL server external to Docker
2025-12-02 10:09:13 +00:00
b2a59eecf1 feat: implement real-time list synchronization
- Add useRealtimeSync hook for polling server updates every 3 seconds
- Create API endpoint to check last updated timestamp for lists
- Integrate real-time sync into ListDetailView component
- Automatically refresh when other users make changes to shared lists
- Poll on interval and when page becomes visible again
2025-12-02 10:06:49 +00:00
11c4411f68 fix: Resolve Prisma Edge Runtime error in middleware
- Move all auth configuration to auth.config.ts to avoid Prisma imports in Edge Runtime
- Update middleware to use NextAuth with edge-compatible config
- Consolidate session, cookies, and callback configuration in auth.config.ts
- Update auth.ts to extend authConfig and only add Prisma-dependent providers
- This fixes the 'PrismaClient is not configured to run in Edge Runtime' error

The middleware now properly works with NextAuth v5 beta without trying to load Prisma in the Edge Runtime.
2025-12-02 01:38:26 +00:00
0e609af924 feat: Update PWA service worker for authentication
- Add authentication pages to static cache (/auth/login, /auth/register, /auth/error)
- Implement special handling for authentication API requests (network-only with offline error)
- Add authentication page caching strategy (cache-first with network fallback)
- Prevent caching of authentication errors (401, 403)
- Enhance offline page with online detection and auto-redirect
- Add authentication notice to offline page
- Update cache version to v2 for proper invalidation
- Create PWA_AUTH_GUIDE.md documentation

Task: 19. Update PWA service worker for authentication
Requirements: 4.4
2025-12-02 01:34:28 +00:00
534796edd7 feat: implement security enhancements (task 17)
- Add rate limiting for login, registration, and invitations
- Implement CSRF protection with SameSite cookies and security headers
- Configure secure session cookies with httpOnly and secure flags
- Enhance input sanitization for XSS and injection prevention
- Add comprehensive security tests (41 tests passing)
- Document security enhancements in SECURITY_ENHANCEMENTS.md

Requirements: 9.3, 9.4, 9.5
2025-12-02 01:29:35 +00:00
2ce89e7c6c feat: implement data migration for existing lists
- Created migration-actions.ts with server actions for claiming lists
- Added ClaimListsModal component for UI during registration
- Integrated claim modal into RegisterForm
- Created anonymous-lists.ts utilities for tracking lists in localStorage
- Added migrate-lists.ts script for deployment migration
- Created comprehensive MIGRATION_GUIDE.md documentation
- Added migration tests with 100% pass rate
- Updated package.json with db:migrate script
- Added tsx as dev dependency for running migration scripts

Requirements: 10.2, 10.3, 10.4, 10.5
- Users can claim existing lists on first registration
- All list data is preserved during migration
- All lists have an owner after migration
- Migrated lists appear in user's account
2025-12-02 01:20:35 +00:00
54612a4782 feat: update components for multi-user support
- Add sharing indicator to ListCard showing collaborator count
- Add permission badge and share button to ListDetailView
- Disable editing in ItemForm for viewers with visual feedback
- Add permission checks to item detail and edit pages
- Hide edit/delete buttons for viewers on item detail page
- Pass permission and collaborator data through component hierarchy
- Update navigation to include profile and invitations links (already done in previous tasks)

Implements task 15 from user-auth-and-sharing spec
2025-12-02 01:14:21 +00:00
85c8a1650b Implement profile management (task 14)
- Add updateProfile and updatePassword server actions
- Add getUserProfile function with sensitive data protection
- Create ProfileForm component for name and email updates
- Create PasswordChangeForm component with current password verification
- Create profile page at /profile with all profile management features
- Add profile and invitations navigation links to main page
- Implement email uniqueness validation
- Implement password hashing on password change

Requirements: 7.1, 7.2, 7.3, 7.4, 7.5
2025-12-02 01:06:21 +00:00
b102e86b33 feat: create sharing UI components (task 13)
- Add PermissionBadge component to display owner/editor/viewer roles
- Add InvitationCard component for accepting/declining invitations
- Add CollaboratorList component to manage list collaborators
- Add ShareListModal component for inviting users and viewing access
- Add invitations page to view and manage pending invitations

Requirements: 5.1, 5.4, 8.1, 8.2
2025-12-02 01:02:33 +00:00
7464620668 Complete task 12: Implement collaborator management
- Verified getCollaborators server action (Requirement 5.4)
- Verified updateCollaboratorPermission server action (Requirement 6.5)
- Verified removeCollaborator server action (Requirement 5.5)
- Added permission level enforcement throughout (Requirement 6.1)
- Created comprehensive test suite for collaborator management
- All tests passing (6/6 tests)
2025-12-02 01:00:03 +00:00
b73f761308 Implement invitation system with server actions
- Add inviteUserToList: Create invitations with email validation and expiration
- Add getInvitations: Retrieve pending invitations for current user
- Add acceptInvitation: Accept invitation and create collaborator record
- Add declineInvitation: Decline and remove invitation
- Add getCollaborators: List all collaborators for a list
- Add updateCollaboratorPermission: Change collaborator permission level
- Add removeCollaborator: Revoke collaborator access
- Include proper authorization checks and error handling
- Add invitation expiration logic (7 days)
- Implement transaction for atomic invitation acceptance

Requirements: 5.1, 5.2, 5.3, 8.1, 8.5
2025-12-02 00:57:50 +00:00
0e60c91b98 Complete task 10: Update item operations for access control
- All item operations (createItem, updateItem, deleteItem, toggleItem) now enforce access control
- Editor vs viewer permissions properly enforced (only owner/editor can modify)
- Item queries (searchItems, getItemsByFilter, getItem) filter by list access
- Validates Requirements 6.2, 6.3, and 9.2
2025-12-02 00:54:55 +00:00