#disfactory-notification

2025-12-01
2025-12-03
github2 19:31:14
`<https://github.com/Disfactory/SpotDiff/commit/323d993708891210ad6a5c38e070ac5478cd7fc0|323d9937>` - Add data directory for CSV exports and update gitignore `<https://github.com/Disfactory/SpotDiff/commit/fcebb7a4aff3c7881651f3754bccd69165cb126e|fcebb7a4>` - Add utility scripts for location and answer operations `<https://github.com/Disfactory/SpotDiff/commit/71281a369e34c23e4e95f8847ff12b1b5b136a73|71281a36>` - Enable production config with CORS for <http://spot.disfactory.tw|spot.disfactory.tw> `<https://github.com/Disfactory/SpotDiff/commit/32d128ee9c4b7f2b583d89bdeabd7368888a3eac|32d128ee>` - Move CSV files to data/ directory
github2 19:31:14
`<https://github.com/Disfactory/SpotDiff/commit/323d993708891210ad6a5c38e070ac5478cd7fc0|323d9937>` - Add data directory for CSV exports and update gitignore `<https://github.com/Disfactory/SpotDiff/commit/fcebb7a4aff3c7881651f3754bccd69165cb126e|fcebb7a4>` - Add utility scripts for location and answer operations `<https://github.com/Disfactory/SpotDiff/commit/71281a369e34c23e4e95f8847ff12b1b5b136a73|71281a36>` - Enable production config with CORS for <http://spot.disfactory.tw|spot.disfactory.tw> `<https://github.com/Disfactory/SpotDiff/commit/32d128ee9c4b7f2b583d89bdeabd7368888a3eac|32d128ee>` - Move CSV files to data/ directory
github2 19:54:01
`<https://github.com/Disfactory/SpotDiff/commit/39af90395ae472164ac5750a29869b151bc984cc|39af9039>` - Refactor config to use environment-based selection
github2 19:54:01
`<https://github.com/Disfactory/SpotDiff/commit/39af90395ae472164ac5750a29869b151bc984cc|39af9039>` - Refactor config to use environment-based selection
github2 21:12:54
## Summary This PR implements a file system-based image upload API that provides an Imgur API-compatible interface, allowing the frontend to switch between Imgur and local storage seamlessly. ## Key Changes • Added a new `/api/upload` endpoint that stores images locally with validation for file type, size, and actual image content • Configured Docker volume for media file storage • Implemented comprehensive test coverage for the upload functionality ## Environment Variables The following existing environment variables are used by this feature: | Variable | Description | Example | | ----------------------------- | --------------------------------------------------------- | ----------------------------------------- | | DISFACTORY_BACKEND_MEDIA_ROOT | Media root path (already exists) | /home/deployer/Disfactory/backend/images/ | | DISFACTORY_BACKEND_DOMAIN | Backend domain for generating image URLs (already exists) | <https://disfactory.tw> | New variable for Docker deployment: | Variable | Description | Example | | -------------------- | -------------------------------------- | --------------------- | | DISFACTORY_MEDIA_DIR | Host directory for Docker volume mount | /var/disfactory/media | ## Setup ### Backend Setup Your existing `.env` should already have the required variables: DISFACTORY_BACKEND_MEDIA_ROOT="/home/deployer/Disfactory/backend/images/" DISFACTORY_BACKEND_DOMAIN="<https://disfactory.tw>" For Docker deployment, add the media directory mount: DISFACTORY_MEDIA_DIR=/path/to/media/storage ### Caddy Configuration (Production) The production Caddyfile already has the required configuration to serve uploaded media files: ``` file_server /media/* { root /home/deployer/Disfactory/backend } ``` This serves files from `MEDIA_ROOT` (e.g., `/home/deployer/Disfactory/backend/images/`) at URLs like `<https://api.disfactory.tw/media/uploads/abc123.jpg>`. *No Caddy changes required* - this is already configured. ### Frontend Setup To use the new backend upload instead of Imgur, update the frontend `.env`: VUE_APP_IMAGE_UPLOAD_PROVIDER=backend VUE_APP_IMAGE_UPLOAD_URL=<https://api.disfactory.tw/api/upload> ## API Response Format The endpoint returns an Imgur API-compatible response: { "data": { "link": "<https://api.disfactory.tw/media/uploads/abc123.jpg>", "deletehash": "abc123def456" }, "success": true, "status": 200 } ## Testing Run the tests using Docker Compose: docker compose -f docker-compose.dev.yml run --rm web pytest api/views/tests/test_image_upload.py -v ## Files Changed • `backend/api/views/image_upload.py` - New upload endpoint implementation • `backend/api/views/tests/test_image_upload.py` - Test suite • `backend/api/urls.py` - Route registration • `backend/docker-compose.yml` - Media volume configuration • `backend/.env.sample` - Environment variable documentation • `backend/.env.test` - Test environment configuration • `backend/docs/TESTING.md` - Testing documentation
github2 21:12:54
• *feat: support image upload to local file system* • *feat: add deployment requirements variables*
github2 23:08:32
This PR implements a local filesystem-based image upload service that replaces the Imgur API while maintaining full API compatibility and requiring minimal frontend/backend changes. ## Overview The new service provides a drop-in replacement for Imgur uploads with enhanced privacy and control over image storage. All images are processed locally, EXIF data is stripped for privacy while preserving GPS coordinates and datetime metadata, and files are stored with UUID-based filenames for security. ## Key Features ### :wrench: *New Upload Endpoint* • *POST `/api/upload-image`* - Accepts multipart form data with `image` field • Returns Imgur-compatible JSON responses with `link`, `deletehash`, and extracted EXIF data • Comprehensive error handling for invalid formats, file size limits, and processing errors ### :shield: *Security &amp; Privacy* • File type validation (JPEG, PNG, WEBP only) • 10MB file size limit • UUID-based filenames prevent directory traversal attacks • EXIF metadata stripped for privacy while preserving GPS/datetime • No executable file uploads allowed ### :camera_with_flash: *Image Processing* • Automatic EXIF extraction for GPS coordinates and datetime before stripping • Format standardization (all images converted to JPEG) • Quality optimization while maintaining visual fidelity • Robust error handling for corrupted or invalid images ### :gear: *Configuration* • `DISFACTORY_BACKEND_MEDIA_ROOT` - Configurable storage path for Docker volume mounting • `DISFACTORY_BACKEND_DOMAIN` - Domain for constructing image URLs • Automatic directory creation and proper file permissions ## Implementation Details ### Files Added • `api/services/image_upload.py` - Core image processing service • `api/views/upload_image.py` - Django view with Swagger documentation • `api/services/README.md` - Comprehensive documentation • `api/views/tests/test_upload_image.py` - Test suite ### API Response Format { "data": { "link": "<https://api.disfactory.tw/media/550e8400-e29b-41d4-a716-446655440000.jpg>", "deletehash": "delete_550e8400e29b41d4a716446655440000", "Latitude": 23.8103, "Longitude": 121.5598, "DateTimeOriginal": "2023:08:27 15:30:45" }, "success": true, "status": 200 } ## Migration Strategy 1. *Zero Downtime*: New service runs alongside existing Imgur integration 2. *Frontend Update*: Simply change upload endpoint from Imgur to `/api/upload-image` 3. *Backward Compatible*: Existing image URLs and database records remain unchanged 4. *Docker Ready*: Environment variables configured for seamless deployment ## Dependencies Uses only standard libraries plus existing dependencies: • Python standard library (`os`, `uuid`, `logging`, etc.) • Django (already present) • Pillow (already present) No additional third-party dependencies required. ## Testing Comprehensive test coverage includes: • Unit tests for EXIF extraction and GPS coordinate processing • Integration tests for full upload workflow • Error handling validation • Specification compliance verification • File format and security validation All tests pass and verify the implementation meets the complete specification requirements. --- :sparkles: Let Copilot coding agent <https://github.com/Disfactory/Disfactory/issues/new?title=%E2%9C%A8+Set+up+Copilot+instructions&amp;body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&amp;assignees=copilot|set things up for you> — coding agent works faster and does higher quality work when set up for your repo.
github2 23:08:32
This PR implements a local filesystem-based image upload service that replaces the Imgur API while maintaining full API compatibility and requiring minimal frontend/backend changes. ## Overview The new service provides a drop-in replacement for Imgur uploads with enhanced privacy and control over image storage. All images are processed locally, EXIF data is stripped for privacy while preserving GPS coordinates and datetime metadata, and files are stored with UUID-based filenames for security. ## Key Features ### :wrench: *New Upload Endpoint* • *POST `/api/upload-image`* - Accepts multipart form data with `image` field • Returns Imgur-compatible JSON responses with `link`, `deletehash`, and extracted EXIF data • Comprehensive error handling for invalid formats, file size limits, and processing errors ### :shield: *Security &amp; Privacy* • File type validation (JPEG, PNG, WEBP only) • 10MB file size limit • UUID-based filenames prevent directory traversal attacks • EXIF metadata stripped for privacy while preserving GPS/datetime • No executable file uploads allowed ### :camera_with_flash: *Image Processing* • Automatic EXIF extraction for GPS coordinates and datetime before stripping • Format standardization (all images converted to JPEG) • Quality optimization while maintaining visual fidelity • Robust error handling for corrupted or invalid images ### :gear: *Configuration* • `DISFACTORY_BACKEND_MEDIA_ROOT` - Configurable storage path for Docker volume mounting • `DISFACTORY_BACKEND_DOMAIN` - Domain for constructing image URLs • Automatic directory creation and proper file permissions ## Implementation Details ### Files Added • `api/services/image_upload.py` - Core image processing service • `api/views/upload_image.py` - Django view with Swagger documentation • `api/services/README.md` - Comprehensive documentation • `api/views/tests/test_upload_image.py` - Test suite ### API Response Format { "data": { "link": "<https://api.disfactory.tw/media/550e8400-e29b-41d4-a716-446655440000.jpg>", "deletehash": "delete_550e8400e29b41d4a716446655440000", "Latitude": 23.8103, "Longitude": 121.5598, "DateTimeOriginal": "2023:08:27 15:30:45" }, "success": true, "status": 200 } ## Migration Strategy 1. *Zero Downtime*: New service runs alongside existing Imgur integration 2. *Frontend Update*: Simply change upload endpoint from Imgur to `/api/upload-image` 3. *Backward Compatible*: Existing image URLs and database records remain unchanged 4. *Docker Ready*: Environment variables configured for seamless deployment ## Dependencies Uses only standard libraries plus existing dependencies: • Python standard library (`os`, `uuid`, `logging`, etc.) • Django (already present) • Pillow (already present) No additional third-party dependencies required. ## Testing Comprehensive test coverage includes: • Unit tests for EXIF extraction and GPS coordinate processing • Integration tests for full upload workflow • Error handling validation • Specification compliance verification • File format and security validation All tests pass and verify the implementation meets the complete specification requirements. --- :sparkles: Let Copilot coding agent <https://github.com/Disfactory/Disfactory/issues/new?title=%E2%9C%A8+Set+up+Copilot+instructions&amp;body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&amp;assignees=copilot|set things up for you> — coding agent works faster and does higher quality work when set up for your repo.
2025-12-06
github2 00:58:32
`<https://github.com/Disfactory/frontend/commit/0fc0e22ade87f47a964fbf06845dcc90f39677e3|0fc0e22a>` - feat: support backend image upload provider `<https://github.com/Disfactory/frontend/commit/35be91054a9c846d30c466fafe79d4ae71b3cf01|35be9105>` - chore: add ci config about image upload endpoint `<https://github.com/Disfactory/frontend/commit/40de106e9488c6d4a89ed8f3ce205006a217a9ae|40de106e>` - feat: bring back image upload functionaility `<https://github.com/Disfactory/frontend/commit/6a441fc81b3188fa20dd04a3346ab286ec207246|6a441fc8>` - feat: support backend image upload provider (#198)
github2 00:58:32
`<https://github.com/Disfactory/frontend/commit/0fc0e22ade87f47a964fbf06845dcc90f39677e3|0fc0e22a>` - feat: support backend image upload provider `<https://github.com/Disfactory/frontend/commit/35be91054a9c846d30c466fafe79d4ae71b3cf01|35be9105>` - chore: add ci config about image upload endpoint `<https://github.com/Disfactory/frontend/commit/40de106e9488c6d4a89ed8f3ce205006a217a9ae|40de106e>` - feat: bring back image upload functionaility `<https://github.com/Disfactory/frontend/commit/6a441fc81b3188fa20dd04a3346ab286ec207246|6a441fc8>` - feat: support backend image upload provider (#198)
github2 00:59:14
`<https://github.com/Disfactory/frontend/commit/46c2e92ca16ad3e437399105f74591d054628094|46c2e92c>` - Merge pull request #168 from Disfactory/release/2.7.0 `<https://github.com/Disfactory/frontend/commit/a09559557b80d658b367f2922650fce227485657|a0955955>` - Merge branch 'master' into production `<https://github.com/Disfactory/frontend/commit/4f87093a91d9505a85f9e4f9153ba5fe94802b50|4f87093a>` - Merge branch 'production'
github2 00:59:14
`<https://github.com/Disfactory/frontend/commit/46c2e92ca16ad3e437399105f74591d054628094|46c2e92c>` - Merge pull request #168 from Disfactory/release/2.7.0 `<https://github.com/Disfactory/frontend/commit/a09559557b80d658b367f2922650fce227485657|a0955955>` - Merge branch 'master' into production `<https://github.com/Disfactory/frontend/commit/4f87093a91d9505a85f9e4f9153ba5fe94802b50|4f87093a>` - Merge branch 'production'
github2 01:03:50
github2 01:03:50
github2 01:09:07
`<https://github.com/Disfactory/disfactory.tw/commit/ff6faec51887fa72682ec6a4b1a3516578397665|ff6faec5>` - Deploy [ci skip]
github2 01:09:07
`<https://github.com/Disfactory/disfactory.tw/commit/ff6faec51887fa72682ec6a4b1a3516578397665|ff6faec5>` - Deploy [ci skip]
github2 01:09:36
github2 01:09:36