feat: add manual file enhancement with development mode support

- Add manual enhance API endpoint (POST /api/enhance?site_id={site}) for triggering file enhancement
- Implement enhance button in JavaScript library status indicator (🔄 Enhance)
- Disable auto-enhancement in development mode to prevent live-reload conflicts
- Add dev mode parameter to SiteManager to control enhancement behavior
- Update API routing structure to support /api/enhance endpoint
- Include enhance button styling and user feedback (loading, success, error states)
- Button triggers file enhancement and page reload to show updated static files

Development workflow improvements:
- Content edits → Immediate editor preview (no unwanted page reloads)
- Manual enhance button → Intentional file updates + reload for testing
- Production mode maintains automatic enhancement on content changes

This resolves the live-reload conflict where automatic file enhancement
was causing unwanted page reloads during content editing in development.
This commit is contained in:
2025-09-10 23:38:46 +02:00
parent 2d0778287d
commit f73e21ce6e
6 changed files with 182 additions and 64 deletions

View File

@@ -104,23 +104,9 @@ When running `insertr serve`, the server automatically:
- **Auto-updates files** when content changes via API
- **Creates backups** of original files (if enabled)
**Development vs Production Behavior:**
**Development Mode** (`--dev-mode`):
- ✅ Content changes saved to database
- ❌ File enhancement **disabled** (prevents live-reload loops)
- ✅ Editor loads content dynamically from API
- ✅ Perfect for `just dev` workflow
**Production Mode** (no `--dev-mode`):
- ✅ Content changes saved to database
- ✅ File enhancement **enabled**
- ✅ Static files updated immediately
- ✅ Changes live instantly
**Live Enhancement Process (Production):**
**Live Enhancement Process:**
1. Content updated via API → Database updated
2. If site has `auto_enhance: true` AND not in dev mode → File enhancement triggered
2. If site has `auto_enhance: true` → File enhancement triggered
3. Static files updated in-place → Changes immediately live
### API Endpoints