Commit graph

16 commits

Author SHA1 Message Date
Vadym Samoilenko
ad56b35835 Configure APPLICATION_ROOT for /hm-ems-report prefix
Flask now knows it's mounted at /hm-ems-report and builds correct URLs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 22:01:11 +00:00
Vadym Samoilenko
7ec1361a95 Fix redirects to use relative paths
Use relative paths for redirects so they work correctly behind Apache proxy.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 22:00:10 +00:00
Vadym Samoilenko
2c9a2e8443 Update Apache config to proxy all requests through Flask
Removed static file serving, everything now goes through Flask for authentication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:58:56 +00:00
Vadym Samoilenko
c7982183df Add ProxyFix middleware for Apache reverse proxy
Flask now works correctly behind Apache proxy with URL prefix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:58:41 +00:00
Vadym Samoilenko
36b12888b2 Add better error handling in init function
Check that response is ok and files is an array before processing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:55:08 +00:00
Vadym Samoilenko
e7f8b1785a Return JSON for 401 errors instead of HTML
Flask abort(401) was returning HTML error page. Now returns JSON for API endpoints.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:54:18 +00:00
Vadym Samoilenko
0a946ba2ac Add 401 redirect handling in frontend
JavaScript now checks for 401 status and redirects to login page when session expires.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:53:18 +00:00
Vadym Samoilenko
a6d1901fe5 Fix authentication for AJAX requests
API endpoints now return 401 Unauthorized instead of redirecting to login page when session is invalid. JavaScript detects 401 and redirects the browser to login.

This fixes the 'Unexpected token DOCTYPE' error when session expires.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:52:57 +00:00
Vadym Samoilenko
2aeb8299ac Add simple login authentication
Added session-based login system to protect the application.

Features:
- Login page with credentials: admin3_M / Pa$$w0rd2026_!
- Session-based authentication using Flask sessions
- All routes protected with @login_required decorator
- Logout functionality with button in header
- Clean login UI matching H&M branding

Security:
- Secret key for session encryption (should be set via env var)
- Password stored in code (consider hashing for production)

Files:
- server.py: Added login/logout routes and auth decorator
- static/index.html: Added logout button in header
- static/logout.html: Logout redirect page
- .env.example: Added SECRET_KEY configuration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:52:04 +00:00
Vadym Samoilenko
1ab758b521 Fix image URL paths - add missing Automation_LR directory
Images were returning 404 because URL path was missing the Automation_LR directory segment.

Fixed: /hm-ems-report/images/{year}/{campaign}/{img}
To: /hm-ems-report/images/{year}/{campaign}/Automation_LR/{img}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:48:30 +00:00
Vadym Samoilenko
4f7079c90c Fix deploy script git access issue
Remove git fetch/reset from deploy script to avoid SSH key permission issues when running with sudo. Users should run 'git pull' manually before './deploy.sh'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:36:08 +00:00
Vadym Samoilenko
75d5519215 Update paths for production domain and HTTPS
Changed application path from /hm-ems/ to /hm-ems-report/ to match production URL structure. Updated all references to use HTTPS and correct domain.

Changes:
- Path prefix: /hm-ems/ → /hm-ems-report/
- Production URL: https://ai-sandbox.oliver.solutions/hm-ems-report/
- Created apache/hm-ems-report.conf with full Apache configuration
- Updated all API and image paths in frontend and backend
- Updated documentation with correct URLs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:33:46 +00:00
Vadym Samoilenko
ccee0b7202 Update deployment to use vadym.samoilenko user
Changed deployment user from www-data to vadym.samoilenko across all configuration files. Added permission checks and automatic chmod/chown in deploy script.

Changes:
- deploy.sh: Check user exists, set ownership to vadym.samoilenko, add chmod
- systemd service: Run as vadym.samoilenko
- DEPLOY.md: Updated all references to vadym.samoilenko
- .env.example: Updated default user

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:31:26 +00:00
Vadym Samoilenko
14d67b5f2b Add production deployment setup for Ubuntu with Apache
Configured application for deployment with Apache reverse proxy and systemd service. The app runs without Docker, using Python venv and Gunicorn.

Key changes:
- deploy.sh: Idempotent deployment script with backup, health checks
- systemd/hm-ems.service: Systemd unit for auto-start/restart
- DEPLOY.md: Complete deployment and troubleshooting guide
- .env.example: Configuration template
- Updated API paths: /api/* → /hm-ems/api/* for Apache routing
- Updated image URLs: /images/* → /hm-ems/images/* for Apache alias
- Updated CLAUDE.md: Added production deployment section

Architecture:
- Flask/Gunicorn on localhost:5000 (systemd service)
- Apache reverse proxy for /hm-ems/api/*
- Apache serves static files from /var/www/html/hm-ems-report/
- Apache serves images from /opt/hm-ems-data/campaign_images/
- Data persistence in /opt/hm-ems-data/ (JSON + images)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:30:54 +00:00
Vadym Samoilenko
5904326d0c Add H&M EMS Product Review Tool with complete project structure
Added Flask-based web application for reviewing and editing H&M product data across multiple languages. Includes inline editing, approval workflow, change logging, and multi-image support.

Key components:
- server.py: Flask API with thread-safe JSON read/write
- html_generator.py: Standalone HTML generator with language utilities
- static/index.html: Interactive review UI with dynamic column management
- CLAUDE.md: Comprehensive development guide
- Sample campaign data (1022A, 2023) with images
- Updated .gitignore for Python projects

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:05:03 +00:00
Vadym Samoilenko
22c125d3ee Initial commit 2026-03-11 21:00:20 +00:00