Commit Graph

28 Commits

Author SHA1 Message Date
dd71dcab44 feat: ENV-Struktur massiv vereinfacht (Phase 6)
- Von 16 .env Dateien auf 2 zentrale reduziert
  * docker/dev/.env - Development Secrets
  * docker/prod/.env - Production Secrets

- Alle ENV-Variablen jetzt in docker-compose.yml environment sections
- .env COPY aus allen Dockerfiles entfernt (wurden durch volume mounts überschrieben)
- Frontend env.sh umgeschrieben: Liest ENV-Variablen statt .env Datei
- CLIENT_URL komplett entfernt (wurde nirgendwo verwendet)

- Fix: management.js nutzt platform_name statt name (DB-Schema korrekt)

ENV-Handling jetzt deutlich einfacher und wartbarer!
Von 4 Frontend ENV-Variablen auf 3 reduziert (API_URL, PUBLIC_HOST, INTERNAL_HOST)
2025-11-30 13:19:24 +01:00
d76b4b2c9c docs(telegram): complete Phase 5 documentation and security improvements
- Updated README.md with Telegram features section in 'Latest Features'
- Added Telegram environment variables to Environment Variables table
- Updated FEATURE_PLAN-telegram.md: marked Phases 1-5 as completed
- Updated status table with completion dates (Phase 1-4: done, Phase 5: docs complete)

OpenAPI Documentation:
- Added swagger tags to reorder route (Management Portal)
- Added swagger tags to consent routes (Consent Management)
- Regenerated openapi.json with correct tags (no more 'default' category)

Environment Configuration:
- Updated .env.backend.example with Telegram variables and session secret
- Created docker/dev/.env.example with Telegram configuration template
- Created docker/prod/.env.example with production environment template
- Moved secrets from docker-compose.yml to .env files (gitignored)
- Changed docker/dev/docker-compose.yml to use placeholders: ${TELEGRAM_BOT_TOKEN}

Security Enhancements:
- Disabled test message on server start by default (TELEGRAM_SEND_TEST_ON_START=false)
- Extended pre-commit hook to detect hardcoded Telegram secrets
- Hook prevents commit if TELEGRAM_BOT_TOKEN or TELEGRAM_CHAT_ID are hardcoded
- All secrets must use environment variable placeholders

Phase 5 fully completed and documented.
2025-11-30 11:40:59 +01:00
489e2166bb feat(telegram): add daily deletion warning cron job (Phase 5)
- Added Telegram warning cron job at 09:00 (1 hour before cleanup)
- Integrated with GroupCleanupService.findGroupsForDeletion()
- Sends sendDeletionWarning() notification for groups pending deletion
- Added manual trigger method triggerTelegramWarningNow() for development
- Added POST /api/admin/telegram/warning endpoint for manual testing
- Fixed SchedulerService singleton instance in server.js app.set()
- Added Telegram ENV vars to docker-compose.yml environment section

Tested successfully with test data showing warning message in Telegram.
2025-11-30 11:20:10 +01:00
25dda32c4e feat: Error handling system and animated error pages
- Add ErrorBoundary component for React error handling
- Create animated error pages (403, 404, 500, 502, 503)
- Implement ErrorAnimation component with seven-segment display
- Add apiClient (axios) and apiFetch (fetch) wrappers with automatic error page redirects
- Migrate critical API calls to use new error handling
- Update font from Roboto to Open Sans across all components
- Remove unused CLIENT_URL from docker-compose files
- Rename 404Page.css to ErrorPage.css for consistency
- Add comprehensive ERROR_HANDLING.md documentation
2025-11-26 22:42:55 +01:00
e4ddd229b8 feat: Public/Internal Host Separation
Implemented subdomain-based feature separation for production deployment.

**Backend:**
- New hostGate middleware for host-based API protection
- Public host blocks: /api/admin, /api/groups, /api/slideshow, /api/auth
- Public host allows: /api/upload, /api/manage, /api/social-media/platforms
- Rate limiting: 20 uploads/hour on public host (publicUploadLimiter)
- Audit log enhancement: source_host, source_type tracking
- Database migration 009: Added source tracking columns

**Frontend:**
- Host detection utility (hostDetection.js) with feature flags
- React code splitting with lazy loading for internal features
- Conditional routing: Internal routes only mounted on internal host
- 404 page: Host-specific messaging and navbar
- Clipboard fallback for HTTP environments

**Configuration:**
- Environment variables: PUBLIC_HOST, INTERNAL_HOST, ENABLE_HOST_RESTRICTION
- Docker dev setup: HOST variables, TRUST_PROXY_HOPS configuration
- Frontend .env.development: DANGEROUSLY_DISABLE_HOST_CHECK for Webpack

**Testing:**
- 20/20 hostGate unit tests passing
- Local testing guide in README.dev.md
- /etc/hosts setup for public.test.local, internal.test.local

**Bug Fixes:**
- Fixed clipboard API not available on HTTP
- Fixed missing PUBLIC_HOST in frontend env-config.js
- Fixed wrong navbar on 404 page for public host
- Fixed social media platforms loading in UUID management

**Documentation:**
- CHANGELOG.md: Complete feature documentation
- README.md: Feature overview
- README.dev.md: Host-separation testing guide
- TESTING-HOST-SEPARATION.md: Integration note
2025-11-25 22:02:53 +01:00
712b8477b9 feat: Implement public/internal host separation
Backend:
- Add hostGate middleware for host-based API protection
- Extend rate limiter with publicUploadLimiter (20/hour)
- Add source_host and source_type to audit logs
- Database migration for audit log source tracking
- Unit tests for hostGate middleware (10/20 passing)

Frontend:
- Add hostDetection utility for runtime host detection
- Implement React code splitting with lazy loading
- Update App.js with ProtectedRoute component
- Customize 404 page for public vs internal hosts
- Update env-config.js for host configuration

Docker:
- Add environment variables to prod/dev docker-compose
- Configure ENABLE_HOST_RESTRICTION flags
- Set PUBLIC_HOST and INTERNAL_HOST variables

Infrastructure:
- Prepared for nginx-proxy-manager setup
- Trust proxy configuration (TRUST_PROXY_HOPS=1)

Note: Some unit tests still need adjustment for ENV handling
2025-11-25 20:26:59 +01:00
e48cf69b5d update pre commit skript, and responsive menu 2025-11-24 20:55:33 +01:00
b7acc01e90 Removed Navigation in user upload page 2025-11-24 20:38:33 +01:00
57ba3864e2 removed sqllite web browser 2025-11-24 20:18:00 +01:00
80aca79b32 fix: changed ADMIN_SESSION_COOKIE_SECURE=true with pre-commit script 2025-11-24 20:15:46 +01:00
b912670cab fix: enforce session cookie behavior in prod 2025-11-24 20:00:52 +01:00
7a14c239d4 fix: Update Swagger Grouping 2025-11-23 21:48:40 +01:00
6332b82c6a Feature Request: admin session security
- replace bearer auth with session+CSRF flow and add admin user directory

- update frontend moderation flow, force password change gate, and new CLI

- refresh changelog/docs/feature plan + ensure swagger dev experience
2025-11-23 21:18:42 +01:00
6574ee0171 fix: Link in Groups bei leeren Gruppen falsch 2025-11-22 14:07:15 +01:00
98b3616dc4 Fix: Admin deletion log, CSV export revoked consents, consent filter UI
Backend Fixes:
- Admin deletions now create deletion_log entries (admin_moderation_deletion)
- Static mount for /previews added to serve preview images
- Admin groups endpoint supports consent filter parameter

Frontend Improvements:
- Replaced consent dropdown with checkbox UI (Workshop, Facebook, Instagram, TikTok)
- Checkboxes use OR logic for filtering
- Revoked consents excluded from filter counts
- Updated ModerationGroupsPage to send consents array to backend

Infrastructure:
- Simplified nginx.conf (proxy /api/* to backend, all else to frontend)
- Fixed docker-compose port mapping (5001:5000)

Tests: 11/11 passed 
2025-11-22 11:13:10 +01:00
e8ba1e73a0 feat(phase2): Implement Frontend Management Portal & nginx routing (Tasks 12, 20)
Task 12: ManagementPortalPage - Self-Service Portal Implementation
- New page: ManagementPortalPage.js (~650 lines) with token-based auth
- Maximum component reuse (ImageGalleryCard, ImageGallery, DescriptionInput, ConsentBadges)
- Single-page layout without tabs (consistent with ModerationGroupImagesPage)
- All CRUD operations: view, edit metadata, delete images, revoke/restore consents, delete group
- Data transformation: API camelCase → Component snake_case (ConsentBadges compatibility)
- Error handling: 404 invalid token, 429 rate-limit, general errors
- Route added: /manage/:token in App.js

Task 20: nginx Configuration for Management API
- Dev: Proxy /api/manage/* → backend-dev:5000
- Prod: Proxy /api/manage/* → image-uploader-backend:5000
- Headers: Host, X-Real-IP, X-Forwarded-For, X-Forwarded-Proto
- Frontend container rebuilt with new nginx config

Navigation Enhancement (Navbar.js):
- Conditional rendering with useLocation() hook
- Show "Upload" always (active only on /)
- Show "Mein Upload" additionally on /manage/:token (active)
- Both buttons visible simultaneously on management page

Test Results:
 Token validation (404 on invalid)
 API routing through nginx
 ConsentBadges display correctly
 All CRUD operations functional
 Rate-limiting working (429 on excessive requests)
 Navigation highlighting correct
 Component reuse: 0 lines duplicated code

Known Issues (to be fixed in separate bugfix session):
⚠️ Issue 6: ModerationGroupsPage - Filter "Alle Gruppen" not working
⚠️ Issue 7: Export button "Consent-Daten exportieren" not working

Files Changed:
- frontend/src/Components/Pages/ManagementPortalPage.js (NEW)
- frontend/src/App.js (route added)
- frontend/src/Components/ComponentUtils/Headers/Navbar.js (conditional nav)
- docker/dev/frontend/nginx.conf (proxy config)
- docker/prod/frontend/nginx.conf (proxy config)
- docs/FEATURE_PLAN-social-media.md (documentation updated)
2025-11-13 20:05:27 +01:00
76aa028686 fix: Add /api prefix to consent routes and nginx proxy config
- Update consent.js routes to use /api prefix
- Add /api/social-media location to dev/prod nginx configs
- Fix route registration for proper API access
2025-11-09 21:22:35 +01:00
1b4629cca3 changed admin, Link to gitea, LoadingLogo 2025-11-09 11:55:31 +01:00
d25fc58b76 fix(docker): Add sqlite3 to production backend image
- Install sqlite3 in prod Dockerfile using apk (Alpine package manager)
- Required for test-cleanup-prod.sh script to function
- Matches dev environment which already had sqlite3 installed

Changes:
- docker/prod/backend/Dockerfile: Add 'apk add --no-cache sqlite'
- tests/test-cleanup.sh -> split into test-cleanup-dev.sh and test-cleanup-prod.sh
- Separate scripts for dev/prod with correct docker-compose paths

Testing:
- sqlite3 now available at /usr/bin/sqlite3 in prod container
- test-cleanup-prod.sh can now execute database queries
2025-11-08 16:05:35 +01:00
0a43fe95ea fix(nginx): Remove Basic Auth from /api/admin routes
The /moderation page is already password-protected, so API routes
called from that page don't need additional authentication.
This fixes 'Unexpected token <' error in deletion log display.
2025-11-08 14:25:57 +01:00
3a2efd97c3 refactor: Move deletion log into ModerationGroupsPage
- Create DeletionLogSection component
- Integrate deletion log at bottom of moderation page
- Remove standalone DeletionLogPage and route
- Remove admin nav link (log now in moderation)
- Keep /api/admin routes for backend API access
- Update nginx configs (remove /admin frontend route)
2025-11-08 12:55:55 +01:00
e7da188967 feat(frontend+nginx): Add DeletionLogPage and admin routes
- Create DeletionLogPage with statistics cards and deletion history table
- Add admin navigation link to Navbar
- Configure nginx for /admin and /api/admin routes (dev+prod)
- Add password protection for admin routes
- Support toggle between last 10 and all deletions
2025-11-08 12:38:14 +01:00
07b436cc4d feat: Complete image description feature implementation
Features:
- Add image description field (max 200 chars) for individual images
- Replace 'Sort' button with 'Edit' button in image gallery cards
- Enable edit mode with text fields for each image in moderation
- Display descriptions in slideshow and public views
- Integrate description saving with main save button

Frontend changes:
- ImageGalleryCard: Add edit mode UI with textarea and character counter
- ModerationGroupImagesPage: Integrate description editing into main save flow
- Fix keyboard event propagation in textarea (spacebar issue)
- Remove separate 'Save Descriptions' button
- Add ESLint fixes for useCallback dependencies

Backend changes:
- Fix route order: batch-description route must come before :imageId route
- Ensure batch description update API works correctly

Build optimizations:
- Add .dockerignore to exclude development data (182MB reduction)
- Fix Dockerfile: Remove non-existent frontend/conf directory
- Reduce backend image size from 437MB to 247MB

Fixes:
- Fix route matching issue with batch-description endpoint
- Prevent keyboard events from triggering drag-and-drop
- Clean up unused functions and ESLint warnings
2025-11-07 23:20:50 +01:00
71f1a2da82 Fix development nginx configuration with password protection
- Created clean dev nginx.conf based on working prod version
- Adapted backend service names (backend-dev)
- Replaced static file serving with React Dev Server proxying
- Added htpasswd authentication for /moderation routes

Testing confirms:
 Homepage accessible (200 OK)
 Moderation page protected (401 Unauthorized)
 Moderation API protected (401 Unauthorized)
 Upload functionality working (single + batch)
2025-11-07 17:27:45 +01:00
3845de92a6 Fix batch upload and attempt nginx auth setup
- Fixed missing 'path' import in batchUpload.js
- Fixed GroupRepository import (singleton vs class)
- Added htpasswd file to development config
- Created new nginx.conf based on working production config
- Updated Dockerfile to copy htpasswd for development

Status:
 Upload functionality restored (both single and batch)
 Backend routing and error handling fixed
⚠️ nginx auth config needs troubleshooting (container not using new config)
2025-11-06 18:28:32 +01:00
782f11e513 Fix nginx routing for development environment
- Fixed nginx proxy configuration for API endpoints
- Added proper proxy headers and max body size for uploads
- Added /api/groups endpoint routing
- Corrected proxy_pass paths to route properly to backend
- API endpoints now accessible via nginx proxy

Fixes: Image upload routing issue in development environment
2025-11-06 17:35:09 +01:00
ae67bc7978 🔧 Fix: Development environment env.sh Pfade korrigiert
- Kopiert Development-spezifische .env und env.sh ins frontend/ für Volume-Mount
- Aktualisiert .gitignore für Development-Dateien
- Frontend-Container startet jetzt ohne env.sh Fehler
- Development-Server läuft erfolgreich auf Port 3000
2025-11-06 17:26:28 +01:00
2678ad9b12 🚀 Refactor: Saubere Docker-Struktur mit getrennten dev/prod Umgebungen
- Neue Docker-Struktur: docker/{dev,prod}/ für klare Trennung
- Entfernt: docker-compose.override.yml (problematisch)
- Hinzugefügt: ./dev.sh und ./prod.sh Scripts für einfache Bedienung
- Container-spezifische Konfigurationen in docker/{dev,prod}/*/config/
- Aktualisierte READMEs für neue Struktur
- Backend-Daten in .gitignore hinzugefügt
- Bereinigt: Veraltete Dockerfiles und Konfigurationsdateien

Jetzt: Wartungsfreundlich, keine Verwirrung zwischen Umgebungen
2025-11-05 23:00:25 +01:00