feat: implement auto-injection of insertr.js with site-specific configuration

• Add /insertr.js endpoint to serve JavaScript library from API server
• Implement demo gate auto-injection for sites without existing gates
• Add dynamic site ID injection using per-demo configuration files
• Fix CORS middleware to support localhost origins on any port
• Update demo commands to use individual insertr.yaml configs
• Resolve content persistence issues by matching site IDs between injection and enhancement
• Enable complete edit/save workflow for demo sites with proper namespace isolation
This commit is contained in:
2025-09-11 20:58:21 +02:00
parent cf3d304fdc
commit 33ba53fb50
8 changed files with 316 additions and 34 deletions

View File

@@ -141,6 +141,9 @@ func runServe(cmd *cobra.Command, args []string) {
// Site enhancement endpoint
apiRouter.HandleFunc("/enhance", contentHandler.EnhanceSite).Methods("POST")
// Static library serving (for demo sites)
router.HandleFunc("/insertr.js", contentHandler.ServeInsertrJS).Methods("GET")
// Handle CORS preflight requests explicitly
contentRouter.HandleFunc("/{id}", api.CORSPreflightHandler).Methods("OPTIONS")
contentRouter.HandleFunc("", api.CORSPreflightHandler).Methods("OPTIONS")