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

@@ -105,23 +105,12 @@ func (sm *SiteManager) GetAllSites() map[string]*SiteConfig {
}
// IsAutoEnhanceEnabled checks if a site has auto-enhancement enabled
// Returns false in development mode to prevent unwanted file modifications and live-reload loops
func (sm *SiteManager) IsAutoEnhanceEnabled(siteID string) bool {
sm.mutex.RLock()
defer sm.mutex.RUnlock()
// Disable auto-enhancement in development mode to prevent file modification conflicts with live-reload
// Never auto-enhance in development mode - use manual enhance button instead
if sm.devMode {
return false
}
site, exists := sm.sites[siteID]
return exists && site.AutoEnhance
}
// ForceEnhanceEnabled allows testing production behavior in development mode
// This method bypasses the dev_mode check for testing purposes
func (sm *SiteManager) ForceEnhanceEnabled(siteID string) bool {
sm.mutex.RLock()
defer sm.mutex.RUnlock()