Skip to content

Placeholder PR for AI-developed functionality#61

Open
jine wants to merge 20 commits into
mainfrom
dev
Open

Placeholder PR for AI-developed functionality#61
jine wants to merge 20 commits into
mainfrom
dev

Conversation

@jine

@jine jine commented Mar 16, 2026

Copy link
Copy Markdown
Owner

No description provided.

jine added 20 commits March 16, 2026 11:52
Merge main into dev so i get a baseline for further development
…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).
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant