Fix demo site auto-enhancement and content persistence

- Restructure demo directory from test-sites/ to demos/ with flattened layout
- Add auto-enhancement on server startup for all sites with auto_enhance: true
- Fix inconsistent content ID generation that prevented dan-eden-portfolio content persistence
- Update server configuration to enhance from source to separate output directories
- Remove manual enhancement from justfile in favor of automatic server enhancement
- Clean up legacy test files and unused restore command
- Update build system to use CDN endpoint instead of file copying
This commit is contained in:
2025-09-17 00:07:40 +02:00
parent 1fa607c47c
commit 71561316da
73 changed files with 190 additions and 4827 deletions

View File

@@ -73,7 +73,7 @@ func runServe(cmd *cobra.Command, args []string) {
contentClient := content.NewDatabaseClient(database)
// Initialize site manager
siteManager := content.NewSiteManager(contentClient, "./insertr-backups", devMode)
siteManager := content.NewSiteManager(contentClient, devMode)
// Load sites from configuration
if siteConfigs := viper.Get("server.sites"); siteConfigs != nil {
@@ -88,15 +88,15 @@ func runServe(cmd *cobra.Command, args []string) {
if path, ok := configMap["path"].(string); ok {
site.Path = path
}
if sourcePath, ok := configMap["source_path"].(string); ok {
site.SourcePath = sourcePath
}
if domain, ok := configMap["domain"].(string); ok {
site.Domain = domain
}
if autoEnhance, ok := configMap["auto_enhance"].(bool); ok {
site.AutoEnhance = autoEnhance
}
if backupOriginals, ok := configMap["backup_originals"].(bool); ok {
site.BackupOriginals = backupOriginals
}
if site.SiteID != "" && site.Path != "" {
sites = append(sites, site)
}
@@ -108,6 +108,14 @@ func runServe(cmd *cobra.Command, args []string) {
}
}
// Auto-enhance sites if enabled
if devMode {
log.Printf("🔄 Auto-enhancing sites in development mode...")
if err := siteManager.EnhanceAllSites(); err != nil {
log.Printf("⚠️ Some sites failed to enhance: %v", err)
}
}
// Initialize handlers
contentHandler := api.NewContentHandler(database, authService)
contentHandler.SetSiteManager(siteManager)