Compare commits

..

83 Commits

Author SHA1 Message Date
paul bf705674d5 fix: multiple improvements and CI/CD updates
Frontend fixes:
- Add missing translations for chunk upload (upload.uploadingChunks, common.chunk)
- Fix photo deletion visual bug by tracking deletion state per photo
- Prevent UI confusion when deleting photos in admin grid

Backend fixes:
- Add file existence checks before deleting thumbnails
- Prevent ENOENT errors for missing thumbnail files
- Improve error handling in photo deletion

CI/CD updates:
- Remove Gitea release creation from Drone pipeline
- Simplify GitHub mirror workflow (remove history rewriting, keep file removal)
- Add clean-git-history.sh script for manual history cleanup

These changes improve the admin photo management experience and streamline
the CI/CD process for better maintainability.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot fee369a503 chore: bump version to 1.0.93 (backend + frontend) 2025-07-24 16:57:08 +02:00
paul ad75818566 fix: resolve multiple feedback management issues
- Hide "Manage Feedback" button when feedback is disabled for an event
- Fix 500 error on feedback API endpoint by adding null-safe operators
- Fix TypeError on analytics page by calculating average_rating in backend
- Fix password validation for event creation by properly awaiting async validation
- Add proper null checks and fallbacks for feedback statistics

These fixes ensure:
- Date passwords like "19.07.2025" work with simple password complexity settings
- Feedback management page loads without errors
- Analytics display correctly even with no feedback data

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 65f2c8610d chore: bump frontend version to 1.0.92 2025-07-24 16:57:08 +02:00
paul 517128fd99 fix: add missing route for feedback management page
- Added /admin/events/:id/feedback route to App.tsx
- This fixes the empty page issue when navigating to feedback management
- EventFeedbackPage component was already implemented but route was missing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 55c8384a25 chore: bump frontend version to 1.0.91 2025-07-24 16:57:08 +02:00
paul 0064122eff feat: add feedback management enhancements
- Add German translations for event dropdown menu actions
- Add feedback settings to event edit form
- Hide comment button in gallery when feedback is disabled
- Add feedback moderation panel to event details page

Implements:
1. German translation for three dots menu actions (viewDetails, archiveEventAction, etc.)
2. Feedback enable option now visible when editing existing events
3. Comment button in photo lightbox only shows when feedback is enabled
4. Inline comment moderation in admin event detail view

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 0c783c66d0 fix: use plugins/gitea-release for Drone CI/CD
- Replace plugins/github-release with plugins/gitea-release
- Fix API endpoint compatibility issue (was using GitHub API v3)
- Update base_url to gitea.local.nothaft.cloud
- Change secret from GITHUB_TOKEN to GITEA_TOKEN
- Update release notes to reference local Gitea URLs

This fixes the 401 authentication error when creating releases
on Gitea instances.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 47e2351dab chore: bump frontend version to 1.0.90 2025-07-24 16:57:08 +02:00
paul e1aca6b00c fix: auto-convert old date formats to new date-fns syntax
- Add convertDateFormat function to automatically fix DD->dd, YYYY->yyyy
- Handles existing database values with old format strings
- Prevents RangeError when using old formats stored in settings
- Ensures backward compatibility without requiring database updates

This fix converts formats on-the-fly so existing production data
with old formats like 'DD.MM.YYYY' will work correctly.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 2cb6577f26 chore: bump frontend version to 1.0.89 2025-07-24 16:57:08 +02:00
paul c51d756503 fix: resolve date formatting error in event creation
- Fix TypeError "e.match is not a function" when creating events
- Update useLocalizedDate hook to handle both string and object date formats
- Add type safety for date format configuration
- Fix date format strings to use correct date-fns format (lowercase)
- Ensure backward compatibility with existing date settings

The issue was caused by SettingsPage saving date formats as objects
while useLocalizedDate expected strings. This fix handles both formats
gracefully and prevents the error page redirect.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot c48b9780df chore: bump frontend version to 1.0.88 2025-07-24 16:57:08 +02:00
paul 618e2695fd fix: complete restore page translations and fix structure
- Fix restoreTypes translation structure (was under options.types)
- Add missing restore.messages.restoreStarted translation
- Ensure all restore wizard strings use translations
- Add corresponding German translations for restore section
- Fix translation key structure to match component expectations

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot a289f97a31 chore: bump frontend version to 1.0.87 2025-07-24 16:57:08 +02:00
paul 7387a5e9f9 fix: complete backup page translations and improve UI
- Fix '0 files' hardcoded string to use translation
- Fix 'local' destination type to show translated name
- Add missing field placeholders for rsync and S3 configurations
- Add missing backup.history.columns.* translations
- Add missing backup.history.filter.* translations
- Add missing backup.history.details.* translations
- Fix backup destination display to use proper translation key
- Replace TestTube icon with Wifi icon for connection testing
- Add all corresponding German translations
- Ensure Backup Health and Coverage titles use translations

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 4615a5d795 docs: add minimum system requirements section to README
- Add CPU, RAM, and storage requirements
- Include OS and software dependencies
- Add Docker requirements for containerized deployment
- Keep it concise and focused on minimum requirements only

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul f926cd3adf fix: use plugins/github-release for Drone CI/CD
- Replace manual curl approach with plugins/github-release
- Fixes shell parsing issues with multiline strings
- Properly passes GITHUB_TOKEN via api_key setting
- Uses YAML multiline string (|) for release notes
- Cleaner and more reliable approach

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 96b05b5e0c chore: bump frontend version to 1.0.86 2025-07-24 16:57:08 +02:00
paul 99e47785e4 fix: add missing translations and fix BackupHistory useTranslation error
- Add missing useTranslation hook in BackupHistory.jsx
- Add missing translation keys:
  - backup.dashboard.health.title
  - backup.dashboard.coverage.title
  - backup.dashboard.stats.noBackupsYet
  - backup.configuration.enableBackupHelp
  - backup.configuration.schedule.options.*
  - backup.configuration.messages.*
  - backup.dashboard.noDestinationSet
  - Fix health message keys to match component usage
- Update German translations with same missing keys
- Fix runtime error preventing access to backup history page

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 94f10e1645 fix: simplify Drone github-release step to avoid shell parsing issues
- Use echo with single JSON string instead of heredoc
- Use > for folded scalar to avoid newline issues
- Properly escape quotes in JSON body
- Ensure GITHUB_TOKEN is properly passed

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot fe4a476e41 chore: bump frontend version to 1.0.85 2025-07-24 16:57:08 +02:00
paul e9f92e66d0 feat: add complete translation support for backup admin page
- Add comprehensive backup translation keys to en.json and de.json
- Update all backup components to use i18next translations:
  - BackupManagement.jsx: main page with tab navigation
  - BackupDashboard.jsx: health status and statistics
  - BackupConfiguration.jsx: settings and destination configuration
  - BackupHistory.jsx: backup history table and details
  - RestoreWizard.jsx: multi-step restore process
- Replace all hardcoded strings with translation keys
- Support dynamic values with interpolation
- Fix Drone CI/CD github-release step:
  - Write release.json to /tmp to avoid permission issues
  - Use quoted heredoc to prevent shell interpretation errors
  - Replace placeholders with actual tag values using sed

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 58f4217756 chore: bump version to 1.0.84 (backend + frontend) 2025-07-24 16:57:08 +02:00
paul 76a466c077 fix: replace github-release plugin with direct curl API call
The github-release plugin was incorrectly detecting and using the
Gitea API instead of GitHub's API. Replaced with direct curl command
that explicitly calls GitHub API to create releases.

This approach:
- Uses curlimages/curl image for lightweight execution
- Directly calls GitHub API v3 with proper authentication
- Avoids any auto-detection issues from the plugin
- Creates releases with full markdown formatting

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 9dc3777985 CRITICAL FIX: prevent gallery pages redirecting to admin login
Users were being redirected from gallery pages to admin login due to
useLocalizedDate hook trying to fetch admin settings. Fixed by:

1. Added general_date_format to public settings endpoint
2. Created publicSettingsService for unauthenticated access
3. Updated useLocalizedDate to use public settings instead of admin
4. Fixed API interceptor to not redirect on public endpoint 401s
5. Added backups/ and test-archiver/ to .gitignore

This restores gallery access for all users.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot e006d73831 chore: bump backend version to 1.0.83 2025-07-24 16:57:08 +02:00
paul 63e88c8324 CRITICAL FIX: correct email_templates column names in migration 032
Production failing because email_templates table has different columns.
Fixed column names:
- name → template_key
- subject → subject_en, subject_de
- body → body_html_en, body_html_de, body_text_en, body_text_de
- Added missing 'variables' field
- Removed language and is_active fields (not in schema)

Also fixed the down() function to use template_key instead of name.

URGENT: Production is still down.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 105167fb57 chore: bump backend version to 1.0.82 2025-07-24 16:57:08 +02:00
paul 22cc40617f fix: remove description field from migration 035 app_settings inserts
The app_settings table doesn't have a description column.
Removed all description fields to prevent migration failures.

This completes the fix for all app_settings inserts across migrations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 7f28917795 CRITICAL FIX: remove description field from app_settings inserts
Production failing with "column description does not exist" error.
The app_settings table only has: id, setting_key, setting_value, setting_type, updated_at
Removed all description fields from migration 032.

URGENT: Production is down - this is blocking the backend from starting.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 77af2a8415 chore: bump backend version to 1.0.81 2025-07-24 16:57:08 +02:00
paul 4c42b4c601 fix: remove updated_at from app_settings inserts in multiple migrations
The app_settings table in production doesn't have created_at/updated_at columns.
Fixed inconsistent usage across migrations:
- Migration 014: removed updated_at: new Date()
- Migration 027: removed updated_at: knex.fn.now()
- Migration 033: removed updated_at: new Date()

This ensures all migrations are consistent and won't fail in production.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 856cdc214c CRITICAL FIX: remove created_at/updated_at from migration 032 inserts
Production was failing because app_settings and email_templates
tables don't have created_at/updated_at columns. Removed these
fields from all insert statements to restore service.

This is a critical production fix - system was down.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 15b244292f chore: bump backend version to 1.0.80 2025-07-24 16:57:08 +02:00
paul 558a966f85 fix: force github-release plugin to use GitHub API instead of Gitea
The plugin was auto-detecting the Gitea instance and using its API
instead of GitHub's. Fixed by:
- Adding explicit environment variables to override detection
- Removing deprecated github_url/github_upload_url parameters
- Setting DRONE_REMOTE_URL to point to GitHub

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 1238db58c2 fix: remove unused formatBoolean import from migration 033
Removed unnecessary import that could cause issues if helpers.js
doesn't define formatBoolean. Migration already uses correct
boolean syntax without the helper.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 0502ed34c9 fix: remove formatBoolean calls from migration 032 - critical production fix
Migration was failing with "formatBoolean is not a function" error,
preventing backend startup. Fixed by:
- Removing formatBoolean import
- Using direct boolean values for column defaults
- Using JSON.stringify for setting values

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 1f417c7e30 chore: bump backend version to 1.0.79 2025-07-24 16:57:08 +02:00
paul a401fbdc54 fix: resolve migration conflicts and duplicate numbering
- Rename conflicting migrations to sequential numbers
- Update 035_enhance_backup_system.js to check for existing columns
- Prevent 'column already exists' errors during migration
- Add proper column existence checks before alterations
2025-07-24 16:57:08 +02:00
paul 247e154afe fix: correct GitHub repository path in Drone CI release config
- Remove deprecated base_url and upload_url parameters
- Use correct GitHub repository: the-luap/picpeak
- This should resolve the 404 error when creating releases
2025-07-24 16:57:08 +02:00
Gitea Actions Bot cbfd84ddea chore: bump version to 1.0.78 (backend + frontend) 2025-07-24 16:57:08 +02:00
paul dc1419c051 feat: implement gallery feedback system with version tracking for backups
Gallery Feedback Features:
- Add feedback system allowing ratings, likes, comments, and favorites on photos
- Implement admin controls for enabling/disabling feedback per event
- Add content moderation with word filters and spam detection
- Implement rate limiting to prevent abuse (10 requests/15min per type)
- Create comprehensive admin interface for feedback management
- Add analytics dashboard for feedback insights
- Export feedback data when archiving events

Frontend Components:
- PhotoRating: 5-star rating system with optimistic updates
- PhotoLikes: Like/unlike with animation
- PhotoComments: Threaded comments with moderation
- PhotoFavorites: Bookmark functionality
- FeedbackSettings: Admin configuration panel
- EventFeedbackPage: Complete management interface

Backend Implementation:
- Database migration 033: 4 new tables for feedback system
- RESTful API with proper authorization
- Guest identification via SHA256(IP+UserAgent)
- Automatic backup integration
- Email notification support

Backup Version Tracking:
- Migration 034: Add version columns to backup tables
- Track app version, Node.js version, and DB schema version
- Create restore_history table for tracking restore attempts
- Add version compatibility checking for safe restores
- Configurable version matching requirements

Security & Performance:
- Input validation and sanitization
- Rate limiting per feedback type
- Content moderation system
- Optimistic UI updates
- Efficient database queries with proper indexes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 2624ea6130 fix: configure github-release plugin to use GitHub API instead of Gitea
- Add base_url and upload_url pointing to GitHub API
- Explicitly set repo and owner for GitHub repository
- Fixes 401 authentication error in release pipeline
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 08eeac66eb chore: bump version to 1.0.77 (backend + frontend) 2025-07-24 16:57:08 +02:00
paul 11769219e4 chore: upgrade npm packages for security and stability
Backend upgrades:
- i18next: 25.3.1 → 25.3.2 (patch)
- bcrypt: 5.1.1 → 6.0.0 (maintains compatibility)
- nodemailer: 6.10.1 → 7.0.5 (no AWS SES impact)
- sharp: 0.32.6 → 0.34.3 (image processing)
- chokidar: 3.6.0 → 4.0.3 (file watching)

Frontend upgrades:
- date-fns: 2.30.0 → 4.1.0 (date utilities)
- lucide-react: 0.292.0 → 0.525.0 (icons)
- react-toastify: 9.1.3 → 11.0.5 (notifications)

All upgrades tested, 0 npm audit vulnerabilities maintained.
Deferred high-risk upgrades (archiver, React 19, Express 5).

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 7750170832 fix: update form-data and multer to address security vulnerabilities
- Update form-data from 4.0.3 to 4.0.4 (fixes CVE GHSA-fjxv-7rqg-78g4)
- Update multer from 2.0.1 to 2.0.2 (fixes CVE GHSA-fjgf-rc76-4x9p)
- Both backend and frontend now have 0 vulnerabilities
- Tested upload functionality - all working correctly

These are patch updates with no breaking changes. The updates address:
- form-data: Critical vulnerability - unsafe random function for boundary
- multer: High vulnerability - DoS via unhandled exception

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
paul 833591681a fix: remove file requirement from GitHub release in Drone CI
- Remove files parameter that was looking for non-existent CHANGELOG.md
- Update release notes to include Docker image pull commands
- Add proper formatting and quick start instructions
- Fix 'validation failed: failed to find any file to release' error

The GitHub release will now create without requiring file attachments.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot b77e60c37c chore: bump frontend version to 1.0.76 2025-07-24 16:57:08 +02:00
paul 30f6780484 fix: correct import statements for api in backup JSX files
- Change default import to named import for api from config/api.ts
- Fixes build error: 'default' is not exported by src/config/api.ts
- Affected files: BackupHistory.jsx, RestoreWizard.jsx, BackupManagement.jsx

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot aa39e132aa chore: bump version to 1.0.75 (backend + frontend) 2025-07-24 16:57:08 +02:00
paul f6a79c815e feat: implement comprehensive backup and restore system with S3 support
- Add S3/MinIO storage adapter with multipart upload support
- Implement database backup service for SQLite and PostgreSQL
- Create backup manifest generator for tracking backup contents
- Enhance backup service with S3 integration and incremental backups
- Add restore service with safety measures and rollback capability
- Create comprehensive test suite for all backup functionality
- Add admin API endpoints for backup/restore management
- Implement frontend UI with dashboard, configuration, and restore wizard
- Add roadmap section to README with implemented backup feature

This implementation provides:
- Multiple backup destinations (local, rsync, S3/MinIO)
- Intelligent change detection to minimize backup frequency
- Full database backups with compression
- Manifest-based restore with integrity validation
- Pre-restore safety backups with rollback
- Comprehensive error handling and monitoring
- User-friendly admin interface

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:08 +02:00
Gitea Actions Bot 3c6837bd90 chore: bump version to 1.0.74 (backend + frontend) 2025-07-24 16:57:08 +02:00
paul 62dcaf8555 ci: publish images to GHCR and create GitHub release via Drone 2025-07-24 16:57:07 +02:00
paul 4ed35f1b16 chore: consolidate and update deployment documentation
- Remove completed PRODUCTION_TODO_LIST.md
- Consolidate deployment guides: keep comprehensive PRODUCTION_DEPLOYMENT_GUIDE.md, remove redundant PRODUCTION_DEPLOYMENT.md
- Update all .env.example files to reflect current system:
  - Remove deprecated ADMIN_EMAIL/ADMIN_PASSWORD (now auto-generated)
  - Add proper documentation for all environment variables
  - Clarify that Umami config is optional (primary via Admin UI)
  - Add realistic examples for SMTP providers
  - Update ports to match actual defaults (3001)
- Update PRODUCTION_DEPLOYMENT_GUIDE.md:
  - Document auto-generated admin credentials process
  - Add Traefik configuration section
  - Update security checklist with current features
  - Fix outdated environment variables
  - Add nginx proxy configuration details

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
Gitea Actions Bot 5eff7dd4a6 chore: bump frontend version to 1.0.73 2025-07-24 16:57:07 +02:00
paul abbcdb1113 feat: exclude Claude contributor from GitHub mirror workflow 2025-07-24 16:57:07 +02:00
Gitea Actions Bot 17fc40e65d chore: bump frontend version to 1.0.72 2025-07-24 16:57:07 +02:00
paul a54a2c0fda fix: use admin API for Umami config in analytics page
- Changed from public settings endpoint to admin settings endpoint
- Fixed "Unexpected token '<'" JSON parse error
- Properly transforms settings array to key-value map
- Uses correct setting keys (analytics_umami_*)
- Maintains fallback to environment variables

The analytics page now correctly fetches Umami configuration using
the authenticated admin API instead of the public endpoint, which
was returning errors and causing JSON parse failures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
paul febacb79ad feat: completely rewrite GitHub mirror to create new history from target commit
BREAKING: This completely replaces the previous approach and will DELETE
all existing history on GitHub, creating entirely new commit SHAs.

Key changes:
- Use orphan branch instead of cherry-pick to break history connection
- Create initial commit from target commit tree using git read-tree
- Apply subsequent changes as completely new commits with new SHAs
- Force push will COMPLETELY REPLACE GitHub history
- No trace of commits before 7aca927937 will remain on GitHub

This ensures GitHub shows only history from the target commit onwards
with no connection to previous commits or their metadata.
2025-07-24 16:57:07 +02:00
paul c7875102c5 fix: improve version bump workflow with better conflict resolution
- Added pre-fetch and check before committing to ensure we're up-to-date
- Improved retry logic with clearer output and better error handling
- Added explicit fetch before each retry attempt
- Use for-loop instead of while for clearer retry counting
- Better fallback from rebase to merge on conflicts
- Added set -e to fail fast on errors
- More verbose logging for debugging

This should resolve the persistent "non-fast-forward" errors by:
1. Checking if we're behind before even committing
2. Pulling changes if needed
3. Retrying with proper synchronization
4. Providing clear debug output

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
paul 3dc013d7b1 CRITICAL FIX: Remove 403 from auth redirect logic to restore login
BREAKING ISSUE FIXED:
- 403 errors were triggering redirects, preventing login page from loading
- Public endpoints returning 403 were causing redirect loops

Changes:
- Removed 403 status from automatic redirect logic
- Only 401 (Unauthorized) now triggers login redirect
- 403 (Forbidden) errors are passed through without redirect

This fixes the critical issue where users couldn't access the login page
because public API calls were returning 403 and triggering redirects.

403 errors should be handled differently than 401:
- 401 = Missing/invalid auth (redirect to login)
- 403 = Forbidden (could be rate limit, IP block, etc - don't redirect)

🚨 Emergency fix for production

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
paul b7c8953cb4 fix: resolve SIGPIPE error in GitHub mirror workflow file cleanup
- Replace problematic 'find | head -20' commands that caused exit code 141
- Use 'ls -la | head -10 || true' for safer file listing
- Add better progress logging during sensitive file removal
- Add error handling with '|| true' to prevent pipe failures

The find command was outputting more than head could handle, causing
SIGPIPE when head closed the pipe early. This fix uses ls which is
more predictable and adds proper error handling.
2025-07-24 16:57:07 +02:00
paul d6adde4e09 fix: resolve GitHub mirror workflow cherry-pick failure with merge commits
- Add --no-merges flag to exclude merge commits during cherry-pick
- Improve error handling for cherry-pick conflicts with auto-resolution
- Add reporting of skipped merge commits for transparency
- Enhance logging to show detailed progress during commit application

Fixes the workflow failure caused by trying to cherry-pick merge commits
which require special handling that was causing exit code 128.
2025-07-24 16:57:07 +02:00
paul 0bf4764a07 fix: resolve CI/CD version bump race condition
- Added pull before push to handle concurrent workflow executions
- Implemented retry logic with 3 attempts for push operations
- Added fallback from rebase to merge if conflicts occur
- Added proper error handling and logging for debugging

This fixes the "non-fast-forward" error that occurs when multiple
workflows run simultaneously and try to push version bumps.

The workflow now:
1. Pulls latest changes before pushing
2. Retries up to 3 times with 5-second delays
3. Falls back to merge if rebase fails
4. Provides clear error messages for debugging

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
paul 08da01f021 feat: update GitHub mirror workflow to start history from specific commit
- Start history from commit 7aca927937 instead of orphan branch
- Use cherry-pick to preserve meaningful commit history
- Automatically exclude files that only existed before target commit
- Add comprehensive error handling and logging
- Maintain clean linear history for GitHub repository
2025-07-24 16:57:07 +02:00
paul b4b09c1650 feat: enhance mirror-to-github workflow with commit-based history filtering
- Replace orphan branch approach with commit-based filtering from cfa29ad5cb
- Add automatic removal of sensitive files (env, logs, gitea configs)
- Implement robust git operations with fallback mechanisms
- Add comprehensive debugging and error handling
- Ensure same security exclusions as manual process
2025-07-24 16:57:07 +02:00
paul b2ae5f18ad fix: handle auth errors and JSON parsing in admin panel
- Added proper HTTP status check before JSON parsing in AnalyticsPage
  * Prevents "Unexpected token '<'" error when API returns HTML error pages
  * Throws proper error for non-OK responses

- Enhanced API error handling to treat 403 as auth failure
  * Both 401 and 403 now trigger redirect to login page
  * Clears expired admin tokens automatically
  * Prevents users from staying on admin pages with expired sessions

These fixes resolve:
1. JSON parse errors when fetching Umami config
2. 403 Forbidden errors not redirecting to login
3. Backend version display issues due to auth failures

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
Gitea Actions Bot 4a7a3bba07 chore: bump version to 1.0.71 (backend + frontend) 2025-07-24 16:57:07 +02:00
paul b3f240b2a5 chore: add production todo list and update CI/CD configs
- Added PRODUCTION_TODO_LIST.md with 9 completed production fixes
- Updated .gitea/workflows/mirror-to-github.yml
- Updated .gitignore

This commit includes all the production fixes implemented:
1. Password complexity settings
2. Gallery login security improvements
3. Analytics configuration fixes
4. Translation additions
5. UI/UX improvements
6. Date format consistency
7. Chrome compatibility fixes

All tasks have been completed and tested for production deployment.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
Gitea Actions Bot ba0bf11a1d chore: bump backend version to 1.0.70 2025-07-24 16:57:07 +02:00
paul d5790ad635 fix: resolve production UI and API issues
- Fixed backend version endpoint by adding retry logic import
- Gallery login page improvements:
  * Increased title size from text-xl to text-2xl (responsive scaling)
  * Title now uses event's custom primary color (var(--color-primary))
  * Removed event category badge from login page
- Fixed Umami analytics configuration check:
  * Added proper enabled state tracking
  * Warning now only shows when Umami is explicitly not configured
  * Checks both admin settings and environment variables properly

These changes improve user experience and fix false warnings in production.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
Gitea Actions Bot e6757bd51b chore: bump version to 1.0.69 (backend + frontend) 2025-07-24 16:57:07 +02:00
paul 8588133a4e fix: critical database connection pool exhaustion issues
- Disabled duplicate email service (emailService.js) that was creating redundant connections
- Increased connection pool size from 10 to 25 for production environment
- Extended session timeout cache from 5 to 30 minutes to reduce DB queries
- Added connection retry logic with exponential backoff for transient failures
- Fixed password validation to use retry wrapper and correct setting key
- Updated public settings and gallery middleware to handle connection failures gracefully

These changes address the "Connection terminated unexpectedly" errors in production by:
1. Reducing unnecessary database connections
2. Increasing available connection pool capacity
3. Implementing automatic retry for transient connection failures
4. Caching frequently accessed data for longer periods

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
Gitea Actions Bot 4b18077573 chore: bump version to 1.0.68 (backend + frontend) 2025-07-24 16:57:07 +02:00
paul c584369d5d fix: implement 9 production enhancements and security fixes
- Password Complexity: Added 4-level complexity selector (Simple/Moderate/Strong/Very Strong) in admin security settings with dynamic backend validation
- Gallery Security: Removed event date from login page (security risk), replaced with event type badge
- Analytics Config: Fixed "Not Configured" detection logic to check both admin settings and env variables
- Analytics Accuracy: Aligned calculation logic between dashboard and analytics endpoints, added totals verification
- Translations: Added missing activity keys (analytics_settings_updated, cms_page_updated, security_settings_updated, password_reset, admin_logout, system_activity)
- UI Fixes: Fixed German text overflow in CMS page selector with proper CSS truncation
- Date Format: Event creation now respects admin-configured date format instead of browser locale
- Chrome Compatibility: Replaced emoji flags with SVG components for Windows Chrome support

All changes maintain backward compatibility and production stability.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
paul 95939d57e6 fix: resolve database connection error for analytics settings
- Update publicSettings.js to handle missing analytics setting_type gracefully
- Add dedicated PUT /analytics endpoint for saving analytics settings
- Update frontend settings service to route to correct endpoints based on setting type
- Fix query to use WHERE clause that won't fail if analytics type doesn't exist

This fixes the "Connection terminated unexpectedly" error when fetching
public settings with analytics configuration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
Gitea Actions Bot be58146dc7 chore: bump version to 1.0.67 (backend + frontend) 2025-07-24 16:57:07 +02:00
paul 45ce98806d feat: fix analytics dashboard and implement complete Umami integration
- Fix backend analytics to include both 'download' and 'download_all' actions
- Add Analytics tab to Settings page for Umami configuration
- Update public settings endpoint to expose Umami config when enabled
- Implement dynamic Umami initialization from backend settings
- Fix frontend analytics calculations (remove hardcoded estimations)
- Add proper download counts and unique visitor tracking
- Update CLAUDE.md with production safety guidelines

The analytics dashboard now shows accurate data for all metrics, and Umami
can be configured through the admin panel instead of environment variables.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
Gitea Actions Bot 23b7a848ab chore: bump backend version to 1.0.66 2025-07-24 16:57:07 +02:00
paul 0fe6d738b2 fix: resolve duplicate logger declaration and syntax error in rate limit service
- Remove duplicate logger import in server.js (line 26)
- Fix missing closing bracket in rateLimitService.js headers object
- Ensure backend starts without syntax errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
Gitea Actions Bot 3f73d44c5a chore: bump version to 1.0.65 (backend + frontend) 2025-07-24 16:57:07 +02:00
paul 1773ed5f95 Initial commit - Project start (July 17, 2025)
Mirror to GitHub / mirror (push) Successful in 26s
Test and Lint / backend-test (push) Successful in 1m11s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m28s
Version and Release / version-bump (push) Successful in 32s
Version and Release / trigger-drone (push) Has been skipped
Original: feat: enhance security logging and ensure rate limit blocks are properly tracked

- Add comprehensive logging for rate limit blocks with full request details
  - IP address (with proper proxy detection), user agent, headers, timestamps
  - Rate limit info (current count, limit, remaining, reset time)
  - Separate tracking for auth vs general endpoints

- Enhance authentication failure logging
  - JWT validation failures with detailed error info
  - Admin auth attempts without token
  - Failed token validation with user context
  - All events include IP, path, method, user agent

- Improve Winston logger configuration for production
  - Add automatic log rotation (10MB errors, 50MB combined)
  - Create separate security.log for auth/rate limit events
  - Ensure logs directory exists automatically
  - Add structured JSON format for log aggregation
  - Support container logging with LOG_TO_CONSOLE env var

- Create comprehensive documentation
  - Security logging guide with examples
  - Monitoring recommendations
  - Configuration reference

- Add test script to verify logging functionality

All rate limit settings remain configurable via admin panel:
- Window duration, max requests, auth limits
- Skip authenticated requests option
- Public endpoints only option

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 16:57:07 +02:00
26 changed files with 785 additions and 229 deletions
-45
View File
@@ -108,51 +108,6 @@ steps:
- VERSION=${DRONE_TAG}
- VITE_API_URL=${VITE_API_URL:-/api}
# -------- NEW: Create GitHub Release --------
- name: github-release
image: plugins/github-release
when:
event: tag
settings:
api_key:
from_secret: GITHUB_TOKEN
files: []
title: PicPeak ${DRONE_TAG}
note: |
# PicPeak ${DRONE_TAG}
## 🐳 Docker Images
This release includes Docker images published to GitHub Container Registry:
```bash
# Backend
docker pull ghcr.io/the-luap/picpeak-backend:${DRONE_TAG}
docker pull ghcr.io/the-luap/picpeak-backend:latest
# Frontend
docker pull ghcr.io/the-luap/picpeak-frontend:${DRONE_TAG}
docker pull ghcr.io/the-luap/picpeak-frontend:latest
```
## 📦 What's New
See the [README](https://github.com/the-luap/picpeak#readme) for features and documentation.
## 🚀 Quick Start
```bash
# Clone and deploy
git clone https://github.com/the-luap/picpeak.git
cd picpeak
# Use the tagged version
docker-compose -f docker-compose.prod.yml up -d
```
---
For detailed deployment instructions, see the [Deployment Guide](https://github.com/the-luap/picpeak/blob/main/DEPLOYMENT.md).
trigger:
event:
+9 -130
View File
@@ -10,120 +10,18 @@ jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Checkout repository with full history
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history needed for finding the commit
fetch-depth: 0 # Full history for proper mirroring
- name: Setup Git
run: |
git config --global user.name "the-luap"
git config --global user.email "paul-nothaft@hotmail.de"
- name: Debug - Show current branch and status
run: |
echo "Current branch:"
git branch -a
echo "Git status:"
git status
echo "Remote info:"
git remote -v
echo "Checking target commit exists:"
git show --oneline 7aca927937 || echo "Target commit not found!"
- name: Create completely new history from specific commit
run: |
TARGET_COMMIT="7aca927937"
# Verify the target commit exists
if ! git cat-file -e $TARGET_COMMIT^{commit}; then
echo "ERROR: Target commit $TARGET_COMMIT does not exist!"
exit 1
fi
echo "✅ Target commit found: $(git log --oneline -1 $TARGET_COMMIT)"
# Clean up any existing github-mirror branch
git branch -D github-mirror || true
# Create a completely new orphan branch (no history)
git checkout --orphan github-mirror
# Clear the staging area completely
git rm -rf . || true
# Get the file tree from the target commit and create initial commit
echo "Creating new history starting from $TARGET_COMMIT..."
git read-tree $TARGET_COMMIT
git commit -m "Initial commit - imported from $(git log --oneline -1 $TARGET_COMMIT)"
echo "✅ Created new initial commit: $(git log --oneline -1)"
# Now get all commits after the target commit and apply their changes
COMMITS_AFTER_TARGET=$(git rev-list --reverse --no-merges $TARGET_COMMIT..main)
if [ -n "$COMMITS_AFTER_TARGET" ]; then
echo "📋 Applying changes from commits after $TARGET_COMMIT (excluding Claude commits):"
for commit in $COMMITS_AFTER_TARGET; do
# Get the commit author name
COMMIT_AUTHOR_NAME=$(git log --format="%an" -n 1 $commit)
# Skip commits by Claude
if [ "$COMMIT_AUTHOR_NAME" = "Claude" ]; then
echo "⚠️ Skipping commit by Claude: $(git log --oneline -1 $commit)"
continue
fi
echo "Processing: $(git log --oneline -1 $commit)"
# Get the commit message and author info
COMMIT_MSG=$(git log --format="%B" -n 1 $commit)
COMMIT_AUTHOR=$(git log --format="%an <%ae>" -n 1 $commit)
COMMIT_DATE=$(git log --format="%ad" -n 1 $commit)
# Apply the changes from this commit
if git diff-tree --no-commit-id --name-only -r $commit | xargs -I {} git show $commit:{} > /dev/null 2>&1; then
# Apply file changes
git checkout $commit -- . || true
# Stage all changes
git add -A
# Only commit if there are changes
if ! git diff --cached --quiet; then
# Create new commit with original metadata but new SHA
GIT_AUTHOR_NAME=$(echo "$COMMIT_AUTHOR" | cut -d'<' -f1 | xargs)
GIT_AUTHOR_EMAIL=$(echo "$COMMIT_AUTHOR" | cut -d'<' -f2 | cut -d'>' -f1)
GIT_AUTHOR_DATE="$COMMIT_DATE"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
git commit -m "$COMMIT_MSG"
echo "✅ Applied changes as new commit: $(git log --oneline -1)"
else
echo "⚠️ No changes to commit for $commit"
fi
else
echo "⚠️ Skipping problematic commit $commit"
fi
done
echo "✅ Finished creating new history"
else
echo "✅ No commits after target commit - history starts fresh"
fi
echo ""
echo "=== New History Summary ==="
echo "Total commits in new history: $(git rev-list --count github-mirror)"
echo "History starts with: $(git log --oneline --reverse | head -1)"
echo "Latest commit: $(git log --oneline -1)"
- name: Remove sensitive files and directories
run: |
# Switch to the github-mirror branch
git checkout github-mirror
echo "Current files before cleanup:"
ls -la | head -10 || true
echo "..."
@@ -164,18 +62,6 @@ jobs:
echo "Final file structure (top level):"
ls -la | head -10 || true
- name: Verify completely new history
run: |
git checkout github-mirror
echo "=== Final History Verification ==="
echo "Total commits in new github-mirror branch: $(git rev-list --count github-mirror)"
echo ""
echo "Complete commit history (should start from target commit content):"
git log --oneline --reverse
echo ""
echo "⚠️ Note: This is a completely NEW history with new commit SHAs"
echo "🔍 Original target commit content preserved but with new commit ID"
- name: Check GitHub token
env:
GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
@@ -187,13 +73,10 @@ jobs:
echo "GitHub token is available (length: ${#GITHUBTOKEN})"
fi
- name: Force push completely new history to GitHub
- name: Push to GitHub
env:
GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
run: |
# Switch to github-mirror branch
git checkout github-mirror
# Remove existing github remote if it exists
git remote remove github || true
@@ -204,17 +87,13 @@ jobs:
echo "GitHub remote added:"
git remote -v
# Force push the completely new history to GitHub main
echo "🔥 FORCE PUSHING completely new history to GitHub..."
echo "⚠️ This will COMPLETELY REPLACE all history on GitHub!"
git push github github-mirror:main --force
echo "✅ Force push completed - GitHub now has completely new history!"
# Push to GitHub main branch
echo "Pushing to GitHub..."
git push github main --force
echo "✅ Push to GitHub completed!"
- name: Workflow completed
run: |
echo "✅ Mirror to GitHub workflow completed successfully!"
echo "🔥 COMPLETE HISTORY REPLACEMENT: GitHub now has entirely new history"
echo "📊 History starts from commit content: 7aca927937"
echo "🔍 Check https://github.com/the-luap/picpeak to verify the new history"
echo "📈 Total commits pushed: $(git rev-list --count github-mirror)"
echo "🆕 All commit SHAs are NEW - no connection to previous history"
echo "📊 Repository mirrored to: https://github.com/the-luap/picpeak"
echo "🔒 Sensitive files have been removed from the mirror"
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "picpeak-backend",
"version": "1.0.84",
"version": "1.0.93",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "picpeak-backend",
"version": "1.0.84",
"version": "1.0.93",
"dependencies": {
"@aws-sdk/client-s3": "^3.850.0",
"@aws-sdk/lib-storage": "^3.850.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "picpeak-backend",
"version": "1.0.84",
"version": "1.0.93",
"description": "Backend for PicPeak event photo sharing platform",
"main": "server.js",
"scripts": {
+1 -1
View File
@@ -42,7 +42,7 @@ router.post('/', adminAuth, [
} = req.body;
// Validate password strength for gallery
const passwordValidation = validatePasswordInContext(password, 'gallery', {
const passwordValidation = await validatePasswordInContext(password, 'gallery', {
eventName: event_name
});
+1 -1
View File
@@ -53,7 +53,7 @@ router.post('/', adminAuth, [
} = req.body;
// Validate password strength
const passwordValidation = validatePasswordInContext(password, 'gallery', {
const passwordValidation = await validatePasswordInContext(password, 'gallery', {
eventName: event_name
});
+31 -3
View File
@@ -123,8 +123,8 @@ router.get('/events/:eventId/feedback',
pagination: {
page: parseInt(page),
limit: parseInt(limit),
total: totalCount.count || 0,
pages: Math.ceil((totalCount.count || 0) / limit)
total: totalCount?.count || 0,
pages: Math.ceil((totalCount?.count || 0) / limit)
}
});
} catch (error) {
@@ -182,7 +182,35 @@ router.get('/events/:eventId/feedback-analytics',
const { eventId } = req.params;
// Get summary statistics
const summary = await feedbackService.getEventFeedbackSummary(eventId);
const summaryData = await feedbackService.getEventFeedbackSummary(eventId);
// Calculate average rating and other summary stats
const avgRatingResult = await db('photo_feedback')
.where('event_id', eventId)
.where('feedback_type', 'rating')
.avg('rating as average_rating')
.first();
const pendingModeration = await db('photo_feedback')
.where('event_id', eventId)
.where('feedback_type', 'comment')
.where('is_approved', false)
.where('is_hidden', false)
.count('* as count')
.first();
const summary = {
average_rating: parseFloat(avgRatingResult?.average_rating || 0),
total_ratings: summaryData.stats?.total_ratings || 0,
total_likes: summaryData.stats?.total_likes || 0,
total_comments: summaryData.stats?.total_comments || 0,
total_favorites: summaryData.stats?.total_favorites || 0,
pending_moderation: pendingModeration?.count || 0,
total_feedback: (summaryData.stats?.total_ratings || 0) +
(summaryData.stats?.total_likes || 0) +
(summaryData.stats?.total_comments || 0) +
(summaryData.stats?.total_favorites || 0)
};
// Get top-rated photos
const topRated = await db('photos')
+12 -2
View File
@@ -447,9 +447,14 @@ router.delete('/:eventId/photos/:photoId', adminAuth, async (req, res) => {
if (photo.thumbnail_path) {
const thumbPath = path.join(storagePath, 'events/active', photo.thumbnail_path);
try {
// Check if file exists before attempting to delete
await fs.access(thumbPath);
await fs.unlink(thumbPath);
} catch (error) {
console.error('Error deleting thumbnail:', error);
// Only log if it's not a "file not found" error
if (error.code !== 'ENOENT') {
console.error('Error deleting thumbnail:', error);
}
}
}
@@ -534,9 +539,14 @@ router.post('/:eventId/photos/bulk-delete', adminAuth, async (req, res) => {
if (photo.thumbnail_path) {
const thumbPath = path.join(storagePath, photo.thumbnail_path);
try {
// Check if file exists before attempting to delete
await fs.access(thumbPath);
await fs.unlink(thumbPath);
} catch (error) {
console.error('Error deleting thumbnail:', error);
// Only log if it's not a "file not found" error
if (error.code !== 'ENOENT') {
console.error('Error deleting thumbnail:', error);
}
}
}
}
+163
View File
@@ -0,0 +1,163 @@
#!/bin/bash
# Script to clean git history - removes all commits before July 17, 2025
# Safe version: Moves current main to main-old and creates new clean main
# WARNING: This will rewrite history!
set -e
echo "⚠️ WARNING: This script will rewrite git history!"
echo "⚠️ All commits before July 17, 2025 will be removed."
echo "⚠️ Current main branch will be preserved as main-old"
echo ""
read -p "Are you sure you want to continue? (type 'yes' to proceed): " confirmation
if [ "$confirmation" != "yes" ]; then
echo "Operation cancelled."
exit 1
fi
# Check current state
CURRENT_BRANCH=$(git branch --show-current)
echo "Current branch: $CURRENT_BRANCH"
# Check if we're in the middle of a cherry-pick or rebase
if [ -d ".git/CHERRY_PICK_HEAD" ] || [ -d ".git/rebase-merge" ] || [ -d ".git/rebase-apply" ]; then
echo "ERROR: You're in the middle of a cherry-pick or rebase. Please resolve or abort it first."
echo "To abort cherry-pick: git cherry-pick --abort"
echo "To abort rebase: git rebase --abort"
exit 1
fi
# Clean any previous attempts
echo "Cleaning up any previous attempts..."
git cherry-pick --abort 2>/dev/null || true
git rebase --abort 2>/dev/null || true
# Check if main-old already exists
if git show-ref --verify --quiet refs/heads/main-old; then
echo ""
echo "⚠️ Branch 'main-old' already exists!"
echo "Options:"
echo "1. Delete it and continue (previous backup will be lost)"
echo "2. Rename it with timestamp and continue"
echo "3. Cancel operation"
read -p "Choose option (1/2/3): " option
case $option in
1)
echo "Deleting existing main-old branch..."
git branch -D main-old
;;
2)
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
NEW_NAME="main-old-${TIMESTAMP}"
echo "Renaming existing main-old to ${NEW_NAME}..."
git branch -m main-old "${NEW_NAME}"
;;
3)
echo "Operation cancelled."
exit 1
;;
*)
echo "Invalid option. Operation cancelled."
exit 1
;;
esac
fi
# Make sure we're on main branch
if [ "$CURRENT_BRANCH" != "main" ]; then
echo "Switching to main branch..."
git checkout main
fi
# Move current main to main-old
echo "Moving current main branch to main-old..."
git branch -m main main-old
# Find the first commit on or after July 17, 2025
echo "Finding first commit after July 17, 2025..."
FIRST_COMMIT=$(git log --since="2025-07-17" --reverse --format="%H" | head -1)
if [ -z "$FIRST_COMMIT" ]; then
echo "ERROR: No commits found after July 17, 2025"
# Restore main branch
git branch -m main-old main
exit 1
fi
echo "First commit to keep: $FIRST_COMMIT"
echo "Commit details: $(git log --oneline -1 $FIRST_COMMIT)"
# Count total commits to process
TOTAL_COMMITS=$(git log --since="2025-07-17" --oneline | wc -l)
echo "Total commits to preserve: $TOTAL_COMMITS"
# Create new orphan branch for clean main
echo "Creating new clean main branch..."
git checkout --orphan main
# Clean the working directory
git rm -rf . || true
# Get the tree from the first commit
git checkout $FIRST_COMMIT -- .
# Create new initial commit with same content
ORIGINAL_MESSAGE=$(git log --format="%B" -1 $FIRST_COMMIT)
ORIGINAL_AUTHOR=$(git log --format="%an <%ae>" -1 $FIRST_COMMIT)
ORIGINAL_DATE=$(git log --format="%ad" -1 $FIRST_COMMIT)
GIT_AUTHOR_NAME=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f1 | xargs)
GIT_AUTHOR_EMAIL=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f2 | cut -d'>' -f1)
GIT_AUTHOR_DATE="$ORIGINAL_DATE"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
git add -A
git commit -m "Initial commit - Project start (July 17, 2025)
Original: $ORIGINAL_MESSAGE"
# Now rebase the rest of the history onto the new main
echo "Rebasing remaining commits..."
echo "This will linearize the history (merge commits will be flattened)..."
# Use rebase to apply all commits
git rebase --onto main $FIRST_COMMIT main-old || {
echo ""
echo "⚠️ Rebase encountered conflicts!"
echo ""
echo "To resolve:"
echo "1. Fix the conflicts in the listed files"
echo "2. Stage the resolved files: git add <files>"
echo "3. Continue rebase: git rebase --continue"
echo "4. If you want to abort and restore: git rebase --abort && git branch -D main && git branch -m main-old main"
echo ""
echo "After successful rebase, your main branch will have the clean history."
echo "The old history is preserved in main-old branch."
exit 1
}
# If we get here, rebase was successful
echo ""
echo "✅ New clean history created successfully!"
echo "Total commits in new history: $(git rev-list --count HEAD)"
echo ""
echo "Branch status:"
echo " - main: Clean history starting from July 17, 2025"
echo " - main-old: Original history with all commits"
echo ""
echo "To push the new history to remote, run:"
echo " git push origin main --force"
echo ""
echo "To also push the old history backup:"
echo " git push origin main-old"
echo ""
echo "⚠️ WARNING: Force pushing will overwrite the remote repository!"
echo "⚠️ Make sure all team members are aware before pushing!"
echo ""
echo "If you need to restore the original history:"
echo " git checkout main-old"
echo " git branch -D main"
echo " git branch -m main"
+123
View File
@@ -0,0 +1,123 @@
#!/bin/bash
# Script to clean git history - removes all commits before July 17, 2025
# Version 2: Handles merge commits properly
# WARNING: This is destructive and will rewrite history!
set -e
echo "⚠️ WARNING: This script will permanently rewrite git history!"
echo "⚠️ All commits before July 17, 2025 will be removed."
echo "⚠️ This action cannot be undone!"
echo ""
read -p "Are you sure you want to continue? (type 'yes' to proceed): " confirmation
if [ "$confirmation" != "yes" ]; then
echo "Operation cancelled."
exit 1
fi
# Check current state
CURRENT_BRANCH=$(git branch --show-current)
echo "Current branch: $CURRENT_BRANCH"
# Check if we're in the middle of a cherry-pick
if [ -d ".git/CHERRY_PICK_HEAD" ]; then
echo "ERROR: You're in the middle of a cherry-pick. Please resolve or abort it first."
echo "To abort: git cherry-pick --abort"
echo "To continue: git cherry-pick --continue"
exit 1
fi
# Clean any previous attempts
echo "Cleaning up any previous attempts..."
git cherry-pick --abort 2>/dev/null || true
git checkout main 2>/dev/null || true
git branch -D new-main 2>/dev/null || true
# Create backup branch
echo "Creating backup branch..."
BACKUP_BRANCH="backup-before-cleanup-$(date +%Y%m%d-%H%M%S)"
git checkout -b "$BACKUP_BRANCH"
git checkout main
# Find the first commit on or after July 17, 2025
echo "Finding first commit after July 17, 2025..."
FIRST_COMMIT=$(git log --since="2025-07-17" --reverse --format="%H" | head -1)
if [ -z "$FIRST_COMMIT" ]; then
echo "ERROR: No commits found after July 17, 2025"
exit 1
fi
echo "First commit to keep: $FIRST_COMMIT"
echo "Commit details: $(git log --oneline -1 $FIRST_COMMIT)"
# Count total commits to process
TOTAL_COMMITS=$(git log --since="2025-07-17" --oneline | wc -l)
echo "Total commits to preserve: $TOTAL_COMMITS"
# Create new orphan branch
echo "Creating new clean history..."
git checkout --orphan new-main
# Clean the working directory
git rm -rf . || true
# Get the tree from the first commit
git checkout $FIRST_COMMIT -- .
# Create new initial commit with same content
ORIGINAL_MESSAGE=$(git log --format="%B" -1 $FIRST_COMMIT)
ORIGINAL_AUTHOR=$(git log --format="%an <%ae>" -1 $FIRST_COMMIT)
ORIGINAL_DATE=$(git log --format="%ad" -1 $FIRST_COMMIT)
GIT_AUTHOR_NAME=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f1 | xargs)
GIT_AUTHOR_EMAIL=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f2 | cut -d'>' -f1)
GIT_AUTHOR_DATE="$ORIGINAL_DATE"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
git add -A
git commit -m "Initial commit - Project start (July 17, 2025)
Original: $ORIGINAL_MESSAGE"
# Now we'll use git rebase instead of cherry-pick to handle merges better
echo "Rebasing remaining commits..."
echo "This will linearize the history (merge commits will be flattened)..."
# Get the commit range
LAST_COMMIT=$(git rev-parse main)
# Use rebase to apply all commits
git rebase --onto new-main $FIRST_COMMIT main || {
echo ""
echo "⚠️ Rebase encountered conflicts!"
echo ""
echo "To resolve:"
echo "1. Fix the conflicts in the listed files"
echo "2. Stage the resolved files: git add <files>"
echo "3. Continue rebase: git rebase --continue"
echo "4. If you want to abort: git rebase --abort"
echo ""
echo "After successful rebase, run:"
echo " git branch -D main"
echo " git branch -m main"
echo " git push origin main --force"
exit 1
}
# If we get here, rebase was successful
echo ""
echo "✅ New history created successfully!"
echo "Total commits in new history: $(git rev-list --count HEAD)"
echo ""
echo "Your backup branch is: $BACKUP_BRANCH"
echo ""
echo "To finalize the cleanup, run these commands:"
echo " git branch -D main"
echo " git branch -m main"
echo " git push origin main --force"
echo ""
echo "⚠️ WARNING: Force pushing will overwrite the remote repository!"
echo "⚠️ Make sure you have a backup and all team members are aware!"
+91
View File
@@ -0,0 +1,91 @@
#!/bin/bash
# Script to clean git history - removes all commits before July 17, 2025
# WARNING: This is destructive and will rewrite history!
set -e
echo "⚠️ WARNING: This script will permanently rewrite git history!"
echo "⚠️ All commits before July 17, 2025 will be removed."
echo "⚠️ This action cannot be undone!"
echo ""
read -p "Are you sure you want to continue? (type 'yes' to proceed): " confirmation
if [ "$confirmation" != "yes" ]; then
echo "Operation cancelled."
exit 1
fi
# Create backup branch
echo "Creating backup branch..."
git checkout -b backup-before-cleanup-$(date +%Y%m%d-%H%M%S)
git checkout main
# Find the first commit on or after July 17, 2025
echo "Finding first commit after July 17, 2025..."
FIRST_COMMIT=$(git log --since="2025-07-17" --reverse --format="%H" | head -1)
if [ -z "$FIRST_COMMIT" ]; then
echo "ERROR: No commits found after July 17, 2025"
exit 1
fi
echo "First commit to keep: $FIRST_COMMIT"
echo "Commit details: $(git log --oneline -1 $FIRST_COMMIT)"
# Get all commits we want to keep
COMMITS_TO_KEEP=$(git log --since="2025-07-17" --reverse --format="%H")
COMMIT_COUNT=$(echo "$COMMITS_TO_KEEP" | wc -l)
echo "Total commits to preserve: $COMMIT_COUNT"
# Create new orphan branch
echo "Creating new clean history..."
git checkout --orphan new-main
# Clean the working directory
git rm -rf . || true
# Get the tree from the first commit
git checkout $FIRST_COMMIT -- .
# Create new initial commit with same content but new message
ORIGINAL_MESSAGE=$(git log --format="%B" -1 $FIRST_COMMIT)
ORIGINAL_AUTHOR=$(git log --format="%an <%ae>" -1 $FIRST_COMMIT)
ORIGINAL_DATE=$(git log --format="%ad" -1 $FIRST_COMMIT)
GIT_AUTHOR_NAME=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f1 | xargs)
GIT_AUTHOR_EMAIL=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f2 | cut -d'>' -f1)
GIT_AUTHOR_DATE="$ORIGINAL_DATE"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
git add -A
git commit -m "Initial commit - Project start (July 17, 2025)
Original: $ORIGINAL_MESSAGE"
# Cherry-pick remaining commits
echo "Applying remaining commits..."
REMAINING_COMMITS=$(git log --since="2025-07-17" --reverse --format="%H" $FIRST_COMMIT..main)
if [ -n "$REMAINING_COMMITS" ]; then
for commit in $REMAINING_COMMITS; do
echo "Applying: $(git log --oneline -1 $commit)"
git cherry-pick $commit || {
echo "ERROR: Failed to cherry-pick $commit"
echo "You may need to resolve conflicts and continue manually"
exit 1
}
done
fi
echo ""
echo "✅ New history created successfully!"
echo "Total commits in new history: $(git rev-list --count HEAD)"
echo ""
echo "To finalize the cleanup, run these commands:"
echo " git branch -D main"
echo " git branch -m main"
echo " git push origin main --force"
echo ""
echo "⚠️ WARNING: Force pushing will overwrite the remote repository!"
echo "⚠️ Make sure you have a backup and all team members are aware!"
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "picpeak-frontend",
"version": "1.0.90",
"version": "1.0.93",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "picpeak-frontend",
"version": "1.0.90",
"version": "1.0.93",
"dependencies": {
"@tanstack/react-query": "^5.0.0",
"@tiptap/extension-character-count": "^2.26.1",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "picpeak-frontend",
"private": true,
"version": "1.0.90",
"version": "1.0.93",
"type": "module",
"scripts": {
"dev": "vite",
+2
View File
@@ -16,6 +16,7 @@ import {
EventsListPage,
CreateEventPageEnhanced as CreateEventPage,
EventDetailsPage,
EventFeedbackPage,
EmailConfigPage,
ArchivesPage,
AnalyticsPage,
@@ -120,6 +121,7 @@ function App() {
<Route path="events" element={<EventsListPage />} />
<Route path="events/new" element={<CreateEventPage />} />
<Route path="events/:id" element={<EventDetailsPage />} />
<Route path="events/:id/feedback" element={<EventFeedbackPage />} />
<Route path="archives" element={<ArchivesPage />} />
<Route path="email" element={<EmailConfigPage />} />
<Route path="analytics" element={<AnalyticsPage />} />
@@ -23,7 +23,7 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
const [selectedPhotos, setSelectedPhotos] = useState<Set<number>>(new Set());
const [isSelectionMode, setIsSelectionMode] = useState(false);
const [isDeleting, setIsDeleting] = useState(false);
const [deletingPhotoId, setDeletingPhotoId] = useState<number | null>(null);
const [deletingPhotos, setDeletingPhotos] = useState<Set<number>>(new Set());
const handlePhotoSelect = (photoId: number, e?: React.MouseEvent) => {
if (e) {
@@ -54,15 +54,18 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
return;
}
setDeletingPhotoId(photo.id);
setDeletingPhotos(prev => new Set(prev).add(photo.id));
try {
await photosService.deletePhoto(eventId, photo.id);
toast.success('Photo deleted successfully');
onPhotosDeleted();
} catch (error) {
toast.error('Failed to delete photo');
} finally {
setDeletingPhotoId(null);
setDeletingPhotos(prev => {
const newSet = new Set(prev);
newSet.delete(photo.id);
return newSet;
});
}
};
@@ -75,14 +78,18 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
}
setIsDeleting(true);
const selectedIds = Array.from(selectedPhotos);
setDeletingPhotos(new Set(selectedIds));
try {
await photosService.deletePhotos(eventId, Array.from(selectedPhotos));
await photosService.deletePhotos(eventId, selectedIds);
toast.success(`${count} photo${count > 1 ? 's' : ''} deleted successfully`);
setSelectedPhotos(new Set());
setIsSelectionMode(false);
onPhotosDeleted();
} catch (error) {
toast.error('Failed to delete photos');
setDeletingPhotos(new Set());
} finally {
setIsDeleting(false);
}
@@ -155,13 +162,15 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
{/* Photo Grid */}
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4">
{photos.map((photo, index) => (
<div
key={photo.id}
className={`relative group cursor-pointer rounded-lg overflow-hidden bg-neutral-100 ${
isSelectionMode ? 'ring-2 ring-offset-2 ' + (selectedPhotos.has(photo.id) ? 'ring-primary-500' : 'ring-transparent') : ''
}`}
onClick={() => isSelectionMode ? handlePhotoSelect(photo.id) : onPhotoClick(photo, index)}
{photos.map((photo, index) => {
const isDeleting = deletingPhotos.has(photo.id);
return (
<div
key={photo.id}
className={`relative group cursor-pointer rounded-lg overflow-hidden bg-neutral-100 transition-opacity ${
isSelectionMode ? 'ring-2 ring-offset-2 ' + (selectedPhotos.has(photo.id) ? 'ring-primary-500' : 'ring-transparent') : ''
} ${isDeleting ? 'opacity-50' : ''}`}
onClick={() => !isDeleting && (isSelectionMode ? handlePhotoSelect(photo.id) : onPhotoClick(photo, index))}
>
{/* Selection Checkbox */}
{isSelectionMode && (
@@ -219,8 +228,8 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
</button>
<button
onClick={(e) => handleDeleteSingle(photo, e)}
className="p-1 text-white hover:bg-white/20 rounded"
disabled={deletingPhotoId === photo.id}
className="p-1 text-white hover:bg-white/20 rounded disabled:opacity-50"
disabled={isDeleting}
>
<Trash2 className="w-3 h-3" />
</button>
@@ -238,7 +247,8 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
</div>
)}
</div>
))}
);
})}
</div>
{photos.length === 0 && (
@@ -0,0 +1,205 @@
import React, { useState } from 'react';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { useTranslation } from 'react-i18next';
import {
MessageSquare,
Eye,
EyeOff,
Trash2,
AlertCircle,
CheckCircle,
Clock,
User
} from 'lucide-react';
import { parseISO } from 'date-fns';
import { toast } from 'react-toastify';
import { Card, Loading, Button } from '../common';
import { feedbackService } from '../../services/feedback.service';
import { useLocalizedDate } from '../../hooks/useLocalizedDate';
interface FeedbackModerationPanelProps {
eventId: number;
className?: string;
compact?: boolean;
maxItems?: number;
}
export const FeedbackModerationPanel: React.FC<FeedbackModerationPanelProps> = ({
eventId,
className = '',
compact = false,
maxItems = 5
}) => {
const { t } = useTranslation();
const { format } = useLocalizedDate();
const queryClient = useQueryClient();
const [showAll, setShowAll] = useState(false);
// Fetch pending feedback
const { data: feedbackData, isLoading } = useQuery({
queryKey: ['event-feedback-moderation', eventId],
queryFn: () => feedbackService.getEventFeedback(eventId.toString(), {
type: 'comment',
status: 'pending',
limit: showAll ? 100 : maxItems
}),
refetchInterval: 30000 // Refresh every 30 seconds
});
// Moderation mutation
const moderateMutation = useMutation({
mutationFn: ({ feedbackId, action }: { feedbackId: string; action: 'approve' | 'hide' | 'reject' }) =>
feedbackService.moderateFeedback(feedbackId, action),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['event-feedback-moderation', eventId] });
toast.success(t('feedback.moderationSuccess'));
}
});
// Delete mutation
const deleteMutation = useMutation({
mutationFn: (feedbackId: string) => feedbackService.deleteFeedback(feedbackId),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['event-feedback-moderation', eventId] });
toast.success(t('feedback.deleted'));
}
});
if (isLoading) {
return (
<Card className={className}>
<div className="p-6">
<Loading />
</div>
</Card>
);
}
const pendingComments = feedbackData?.feedback || [];
const hasPending = pendingComments.length > 0;
return (
<Card className={className}>
<div className="p-6">
<div className="flex items-center justify-between mb-4">
<h2 className="text-lg font-semibold text-neutral-900">
{t('feedback.pendingModeration', 'Pending Moderation')}
</h2>
{hasPending && (
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
{pendingComments.length} {t('feedback.pending', 'pending')}
</span>
)}
</div>
{!hasPending ? (
<div className="text-center py-8">
<CheckCircle className="w-12 h-12 text-green-500 mx-auto mb-3" />
<p className="text-neutral-600">{t('feedback.noPendingComments', 'No comments pending moderation')}</p>
</div>
) : (
<div className="space-y-3">
{pendingComments.slice(0, showAll ? undefined : maxItems).map((item) => (
<div key={item.id} className="border border-neutral-200 rounded-lg p-4 hover:bg-neutral-50">
<div className="flex items-start gap-3">
<div className="flex-shrink-0">
<div className="w-10 h-10 bg-neutral-100 rounded-full flex items-center justify-center">
<User className="w-5 h-5 text-neutral-600" />
</div>
</div>
<div className="flex-1 min-w-0">
<div className="flex items-start justify-between gap-2">
<div className="flex-1">
<div className="flex items-center gap-2 text-sm">
<span className="font-medium text-neutral-900">
{item.guest_name || t('feedback.anonymous', 'Anonymous')}
</span>
<span className="text-neutral-500"></span>
<span className="text-neutral-500">
{format(parseISO(item.created_at), 'MMM d, h:mm a')}
</span>
</div>
<p className="mt-1 text-sm text-neutral-700">{item.comment}</p>
{item.photo_filename && (
<p className="mt-1 text-xs text-neutral-500">
{t('feedback.onPhoto', 'On photo')}: {item.photo_filename}
</p>
)}
</div>
</div>
{/* Actions */}
<div className="flex items-center gap-2 mt-3">
<Button
size="sm"
variant="ghost"
leftIcon={<CheckCircle className="w-4 h-4" />}
onClick={() => moderateMutation.mutate({
feedbackId: item.id.toString(),
action: 'approve'
})}
isLoading={moderateMutation.isPending}
>
{t('feedback.approve', 'Approve')}
</Button>
<Button
size="sm"
variant="ghost"
leftIcon={<EyeOff className="w-4 h-4" />}
onClick={() => moderateMutation.mutate({
feedbackId: item.id.toString(),
action: 'hide'
})}
isLoading={moderateMutation.isPending}
>
{t('feedback.hide', 'Hide')}
</Button>
<Button
size="sm"
variant="ghost"
leftIcon={<Trash2 className="w-4 h-4" />}
onClick={() => {
if (confirm(t('feedback.confirmDelete', 'Are you sure you want to delete this comment?'))) {
deleteMutation.mutate(item.id.toString());
}
}}
isLoading={deleteMutation.isPending}
className="text-red-600 hover:text-red-700 hover:bg-red-50"
>
{t('common.delete', 'Delete')}
</Button>
</div>
</div>
</div>
</div>
))}
{pendingComments.length > maxItems && !showAll && (
<button
onClick={() => setShowAll(true)}
className="w-full text-center py-2 text-sm text-primary-600 hover:text-primary-700 font-medium"
>
{t('feedback.showAll', 'Show all {{count}} pending comments', { count: pendingComments.length })}
</button>
)}
</div>
)}
{/* Quick link to full feedback page */}
<div className="mt-4 pt-4 border-t border-neutral-200">
<a
href={`/admin/events/${eventId}/feedback`}
className="text-sm text-primary-600 hover:text-primary-700 font-medium flex items-center gap-1"
>
<MessageSquare className="w-4 h-4" />
{t('feedback.viewAllFeedback', 'View all feedback & settings')}
</a>
</div>
</div>
</Card>
);
};
FeedbackModerationPanel.displayName = 'FeedbackModerationPanel';
@@ -256,7 +256,7 @@ export const PhotoUpload: React.FC<PhotoUploadProps> = ({ eventId, onUploadCompl
<div className="flex justify-between text-sm text-neutral-600 mb-1">
<span>
{t('upload.uploading')}
{totalChunks > 1 && ` (${t('common.chunk') || 'Chunk'} ${currentChunk}/${totalChunks})`}
{totalChunks > 1 && ` (${t('common.chunk')} ${currentChunk}/${totalChunks})`}
</span>
<span>{uploadProgress}%</span>
</div>
@@ -268,7 +268,7 @@ export const PhotoUpload: React.FC<PhotoUploadProps> = ({ eventId, onUploadCompl
</div>
{totalChunks > 1 && (
<p className="text-xs text-neutral-500 mt-1">
{t('upload.uploadingChunks') || `Uploading ${selectedFiles.length} files in ${totalChunks} batches...`}
{t('upload.uploadingChunks', { count: selectedFiles.length, total: totalChunks })}
</p>
)}
</div>
+2 -1
View File
@@ -27,4 +27,5 @@ export { BackupDashboard } from './BackupDashboard';
export { BackupConfiguration } from './BackupConfiguration';
export { BackupHistory } from './BackupHistory';
export { RestoreWizard } from './RestoreWizard';
export { FeedbackSettings } from './FeedbackSettings';
export { FeedbackSettings } from './FeedbackSettings';
export { FeedbackModerationPanel } from './FeedbackModerationPanel';
@@ -18,6 +18,7 @@ import { GALLERY_THEME_PRESETS } from '../../types/theme.types';
import { api } from '../../config/api';
import { Upload, Menu } from 'lucide-react';
import { galleryService } from '../../services/gallery.service';
import { feedbackService } from '../../services/feedback.service';
import { useWatermarkSettings } from '../../hooks/useWatermarkSettings';
interface GalleryViewProps {
@@ -48,6 +49,7 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
const [sidebarOpen, setSidebarOpen] = useState(false);
const [isSelectionMode, setIsSelectionMode] = useState(false);
const [selectedPhotos, setSelectedPhotos] = useState<Set<number>>(new Set());
const [feedbackEnabled, setFeedbackEnabled] = useState(false);
const [isMobile, setIsMobile] = useState(window.innerWidth < 768);
const { watermarkEnabled } = useWatermarkSettings();
@@ -76,6 +78,25 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
});
// Fetch feedback settings
const { data: feedbackSettings } = useQuery({
queryKey: ['gallery-feedback-settings', event.id],
queryFn: async () => {
try {
// Use public endpoint to get feedback settings
const response = await api.get(`/gallery/${slug}/feedback-settings`);
return response.data;
} catch (error) {
// If endpoint doesn't exist or returns error, default to disabled
return { feedback_enabled: false };
}
},
onSuccess: (data) => {
setFeedbackEnabled(data?.feedback_enabled || false);
},
enabled: !!event.id,
});
// Apply branding settings
useEffect(() => {
if (settingsData) {
@@ -429,6 +450,7 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
photos={filteredPhotos}
slug={slug}
categoryId={selectedCategoryId}
feedbackEnabled={feedbackEnabled}
isSelectionMode={isSelectionMode}
selectedPhotos={selectedPhotos}
onSelectionChange={setSelectedPhotos}
@@ -15,9 +15,10 @@ interface PhotoGridProps {
photos: Photo[];
slug: string;
categoryId?: number | null;
feedbackEnabled?: boolean;
}
export const PhotoGrid: React.FC<PhotoGridProps> = ({ photos, slug, categoryId }) => {
export const PhotoGrid: React.FC<PhotoGridProps> = ({ photos, slug, categoryId, feedbackEnabled = false }) => {
const { t } = useTranslation();
const [selectedPhotoIndex, setSelectedPhotoIndex] = useState<number | null>(null);
const [selectedPhotos, setSelectedPhotos] = useState<Set<number>>(new Set());
@@ -204,6 +205,7 @@ export const PhotoGrid: React.FC<PhotoGridProps> = ({ photos, slug, categoryId }
initialIndex={selectedPhotoIndex}
onClose={() => setSelectedPhotoIndex(null)}
slug={slug}
feedbackEnabled={feedbackEnabled}
/>
)}
</>
@@ -34,6 +34,7 @@ interface PhotoGridWithLayoutsProps {
eventLogo?: string | null;
eventDate?: string;
expiresAt?: string;
feedbackEnabled?: boolean;
}
export const PhotoGridWithLayouts: React.FC<PhotoGridWithLayoutsProps> = ({
@@ -42,6 +43,7 @@ export const PhotoGridWithLayouts: React.FC<PhotoGridWithLayoutsProps> = ({
categoryId,
isSelectionMode: parentSelectionMode,
selectedPhotos: parentSelectedPhotos,
feedbackEnabled,
onSelectionChange,
onToggleSelectionMode: parentToggleSelectionMode,
showSelectionControls = true,
@@ -259,6 +261,7 @@ export const PhotoGridWithLayouts: React.FC<PhotoGridWithLayoutsProps> = ({
initialIndex={selectedPhotoIndex}
onClose={() => setSelectedPhotoIndex(null)}
slug={slug}
feedbackEnabled={feedbackEnabled || false}
/>
)}
</>
@@ -10,6 +10,7 @@ interface PhotoLightboxProps {
initialIndex: number;
onClose: () => void;
slug: string;
feedbackEnabled?: boolean;
}
export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
@@ -17,6 +18,7 @@ export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
initialIndex,
onClose,
slug,
feedbackEnabled = false,
}) => {
const [currentIndex, setCurrentIndex] = useState(initialIndex);
const [zoom, setZoom] = useState(1);
@@ -227,13 +229,15 @@ export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
<Download className="w-5 h-5 text-white" />
</button>
<button
onClick={() => setShowFeedback(!showFeedback)}
className="p-2 bg-white/10 hover:bg-white/20 rounded-full transition-colors"
aria-label="Toggle feedback"
>
<MessageSquare className="w-5 h-5 text-white" />
</button>
{feedbackEnabled && (
<button
onClick={() => setShowFeedback(!showFeedback)}
className="p-2 bg-white/10 hover:bg-white/20 rounded-full transition-colors"
aria-label="Toggle feedback"
>
<MessageSquare className="w-5 h-5 text-white" />
</button>
)}
</div>
</div>
</div>
+9 -2
View File
@@ -35,7 +35,8 @@
"days": "Tage",
"customize": "Anpassen",
"hide": "Ausblenden",
"unknown": "Unbekannt"
"unknown": "Unbekannt",
"chunk": "Teil"
},
"upload": {
"photoCategory": "Fotokategorie",
@@ -51,7 +52,8 @@
"uploadPhotos": "Fotos hochladen",
"maxFilesReached": "Maximal 500 Dateien erlaubt",
"someFilesSkipped": "Einige Dateien wurden übersprungen (500 Dateien Limit)",
"tooManyFiles": "Maximal 500 Dateien können gleichzeitig hochgeladen werden"
"tooManyFiles": "Maximal 500 Dateien können gleichzeitig hochgeladen werden",
"uploadingChunks": "Lade {{count}} Dateien in {{total}} Teilen hoch..."
},
"navigation": {
"dashboard": "Dashboard",
@@ -367,6 +369,11 @@
"noEventsDescription": "Erstellen Sie Ihre erste Veranstaltung, um zu beginnen.",
"eventsSelected": "{{count}} Veranstaltung ausgewählt",
"eventsSelected_plural": "{{count}} Veranstaltungen ausgewählt",
"viewDetails": "Details anzeigen",
"archiveEventAction": "Veranstaltung archivieren",
"downloadArchiveAction": "Archiv herunterladen",
"deleteEvent": "Veranstaltung löschen",
"deleteEventConfirm": "Sind Sie sicher, dass Sie diese Veranstaltung löschen möchten?",
"bulkArchive": "Archivieren",
"confirmBulkArchive": "Sind Sie sicher, dass Sie {{count}} Veranstaltung(en) archivieren möchten?",
"confirmBulkArchiveDescription": "Diese Aktion kann nicht rückgängig gemacht werden. Archivierte Veranstaltungen sind nicht mehr öffentlich zugänglich.",
+4 -2
View File
@@ -35,7 +35,8 @@
"days": "days",
"customize": "Customize",
"hide": "Hide",
"unknown": "Unknown"
"unknown": "Unknown",
"chunk": "Chunk"
},
"upload": {
"photoCategory": "Photo Category",
@@ -51,7 +52,8 @@
"uploadPhotos": "Upload Photos",
"maxFilesReached": "Maximum 500 files allowed",
"someFilesSkipped": "Some files were skipped (500 file limit)",
"tooManyFiles": "Maximum 500 files can be uploaded at once"
"tooManyFiles": "Maximum 500 files can be uploaded at once",
"uploadingChunks": "Uploading {{count}} files in {{total}} batches..."
},
"navigation": {
"dashboard": "Dashboard",
+59 -10
View File
@@ -24,11 +24,12 @@ import { toast } from 'react-toastify';
import { useLocalizedDate } from '../../hooks/useLocalizedDate';
import { Button, Input, Card, Loading } from '../../components/common';
import { EventCategoryManager, AdminPhotoGrid, AdminPhotoViewer, PhotoFilters, PasswordResetModal, ThemeCustomizerEnhanced, ThemeDisplay, HeroPhotoSelector, PhotoUploadModal } from '../../components/admin';
import { EventCategoryManager, AdminPhotoGrid, AdminPhotoViewer, PhotoFilters, PasswordResetModal, ThemeCustomizerEnhanced, ThemeDisplay, HeroPhotoSelector, PhotoUploadModal, FeedbackSettings, FeedbackModerationPanel } from '../../components/admin';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { eventsService } from '../../services/events.service';
import { archiveService } from '../../services/archive.service';
import { photosService, AdminPhoto } from '../../services/photos.service';
import { feedbackService, FeedbackSettings as FeedbackSettingsType } from '../../services/feedback.service';
import { ThemeConfig, GALLERY_THEME_PRESETS } from '../../types/theme.types';
export const EventDetailsPage: React.FC = () => {
@@ -55,6 +56,15 @@ export const EventDetailsPage: React.FC = () => {
hero_photo_id: null as number | null,
host_name: '',
});
const [feedbackSettings, setFeedbackSettings] = useState<FeedbackSettingsType>({
feedback_enabled: false,
allow_ratings: true,
allow_likes: true,
allow_comments: true,
allow_favorites: true,
require_moderation: true,
show_public_stats: false
});
const [copiedLink, setCopiedLink] = useState(false);
const [showPhotoUpload, setShowPhotoUpload] = useState(false);
const [activeTab, setActiveTab] = useState<'overview' | 'photos' | 'categories'>('overview');
@@ -78,6 +88,16 @@ export const EventDetailsPage: React.FC = () => {
enabled: !!id,
});
// Fetch feedback settings
const { data: eventFeedbackSettings } = useQuery({
queryKey: ['admin-event-feedback-settings', id],
queryFn: () => feedbackService.getEventFeedbackSettings(id!),
enabled: !!id,
onSuccess: (data) => {
setFeedbackSettings(data);
}
});
// Statistics are now fetched with the event details from the admin API
// Fetch photos (needed for both photos tab and hero photo selector)
@@ -198,7 +218,7 @@ export const EventDetailsPage: React.FC = () => {
setIsEditing(true);
};
const handleSaveEdit = () => {
const handleSaveEdit = async () => {
// Prepare color_theme - if we have a custom theme, serialize it
let themeToSave = editForm.color_theme;
if (currentTheme && currentPresetName === 'custom') {
@@ -240,7 +260,16 @@ export const EventDetailsPage: React.FC = () => {
console.log('Updating event with data:', updateData);
console.log('Theme length:', updateData.color_theme ? updateData.color_theme.length : 0);
// Update event details
updateMutation.mutate(updateData);
// Update feedback settings separately
try {
await feedbackService.updateEventFeedbackSettings(id!, feedbackSettings);
} catch (error) {
console.error('Failed to update feedback settings:', error);
}
};
const handleCopyLink = async () => {
@@ -320,14 +349,16 @@ export const EventDetailsPage: React.FC = () => {
{t('common.edit')}
</Button>
)}
<Button
variant="outline"
size="sm"
leftIcon={<MessageSquare className="w-4 h-4" />}
onClick={() => navigate(`/admin/events/${id}/feedback`)}
>
{t('feedback.manage', 'Manage Feedback')}
</Button>
{feedbackSettings?.feedback_enabled && (
<Button
variant="outline"
size="sm"
leftIcon={<MessageSquare className="w-4 h-4" />}
onClick={() => navigate(`/admin/events/${id}/feedback`)}
>
{t('feedback.manage', 'Manage Feedback')}
</Button>
)}
</>
)}
{event.share_link && (
@@ -518,6 +549,15 @@ export const EventDetailsPage: React.FC = () => {
</p>
</div>
)}
{/* Feedback Settings */}
<div className="mt-4 pt-4 border-t border-neutral-200">
<h3 className="text-sm font-semibold text-neutral-900 mb-3">{t('feedback.settings', 'Feedback Settings')}</h3>
<FeedbackSettings
settings={feedbackSettings}
onChange={setFeedbackSettings}
/>
</div>
</div>
) : (
<dl className="space-y-4">
@@ -788,6 +828,15 @@ export const EventDetailsPage: React.FC = () => {
</Card>
)}
{/* Feedback Moderation Panel */}
{!event.is_archived && feedbackSettings?.feedback_enabled && (
<FeedbackModerationPanel
eventId={parseInt(id!)}
compact={true}
maxItems={3}
/>
)}
{/* Archive Status */}
{event.is_archived ? (
<Card padding="md">
@@ -392,7 +392,7 @@ export const EventFeedbackPage: React.FC = () => {
<div className="flex items-center gap-3 mb-2">
<Star className="w-8 h-8 text-yellow-500" />
<div>
<p className="text-2xl font-bold">{analytics.summary.average_rating.toFixed(1)}</p>
<p className="text-2xl font-bold">{(analytics.summary.average_rating || 0).toFixed(1)}</p>
<p className="text-sm text-neutral-600">{t('feedback.avgRating', 'Average Rating')}</p>
</div>
</div>