Conversation
Merge main into dev so i get a baseline for further development
Sync main to dev
…with "output: standalone" configuration. Use "node .next/standalone/server.js" instead."
…handling
This commit adds a complete image upload and management system to the
Tiptap editor with the following features:
Backend:
- Add POST /api/upload/image API route with authentication via better-auth
- Implement file validation: type (JPEG, PNG, GIF, WebP), extension matching,
and size limit (10MB)
- Add automatic image resizing using sharp - images larger than 1920x1080
are downscaled while maintaining aspect ratio (GIFs preserved)
- Generate unique timestamp-based filenames: YYYY-MM-DD-HH-mm-ss-{random}.{ext}
- Store uploads in public/uploads/images/ (gitignored)
Frontend:
- Replace mock upload with real XMLHttpRequest implementation featuring
real-time progress tracking and abort support
- Add useImageUpload hook for centralized upload state management with
error handling
- Create CustomImage Tiptap extension using Next.js Image component
- Implement interactive image resizing with 4 corner drag handles
- Uses direct DOM manipulation during drag for 60fps performance
- Supports both mouse and touch events
- Saves dimensions to node attributes on resize end
- Add @tiptap/extension-file-handler for drag-drop and paste support
- Drop images anywhere in editor content
- Paste images from clipboard
- Add visual feedback: upload progress indicator and error toast notifications
Security:
- Require authentication for all uploads
- Validate MIME type matches file extension
- Skip processing for GIF files to preserve animations
Files changed:
- .gitignore: exclude public/uploads/
- next.config.ts: enable unoptimized images for user uploads
- package.json: add sharp, @tiptap/extension-file-handler
- src/app/api/upload/image/route.ts: new upload API
- src/lib/tiptap-utils.ts: real upload handler with XMLHttpRequest
- src/hooks/use-image-upload.ts: new shared upload hook
- src/components/tiptap-node/image-node/*: custom resizable image node
- src/components/tiptap-templates/simple/simple-editor.tsx: integrate
FileHandler and error UI
---
Note: This feature was developed with assistance from AI (Kimi Code).
…der phase. By wrapping the callback in requestAnimationFrame, the state update is deferred to after the current render cycle.
Add Docker HEALTHCHECK instruction for Coolify deployment monitoring: - Install curl in runner stage for health checks - Configure health check with 30s interval, 3s timeout - Set 5s start period and 3 retries for startup tolerance - Check application root endpoint (http://localhost:3000/) This allows Coolify to monitor container health and auto-restart if the application becomes unresponsive. Note: This feature was developed with assistance from AI (Kimi Code).
Feature/local image upload
feat: add Coolify health check to Dockerfile
Add docker-entrypoint.sh to fix permission issues when using Docker volumes: - Install gosu for reliable user switching - Create entrypoint script that chowns uploads directory at runtime - This ensures node user can write to volume-mounted directories - Remove USER instruction from Dockerfile (handled by entrypoint) The volume mount from Coolify creates directories as root, so we need to fix ownership at container startup before the app runs.
fix: resolve permission issues with Coolify volume mounts
Next.js standalone mode doesn't reliably serve files added to public/ at runtime. Add explicit route handler for /uploads/images/* that: - Reads files from public/uploads/images/ - Validates filename to prevent directory traversal - Sets proper MIME types and cache headers (24h) - Returns 404 for missing or invalid files This ensures uploaded images are served correctly in production.
fix: add dedicated route handler for serving uploaded images
Add privacy protection by removing all EXIF data from uploaded images: - GPS location data - Camera make/model - Date/time taken - User comments - Thumbnail previews - Orientation data (image is auto-oriented) Sharp strips metadata by default when processing images. GIF files are skipped to preserve animation. Note: This feature was developed with assistance from AI (Kimi Code).
feat: strip EXIF metadata from uploaded images
Show 404 for unpublished posts when not signed in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.