Simplify development workflow and fix content editing conflicts

- Replace complex multi-server setup (live-server + API) with unified Go server
- Serve all sites at /sites/{site_id} endpoints, eliminating port conflicts
- Fix content-type middleware to serve proper MIME types for static files
- Prevent script injection duplication with future-proof CDN-compatible detection
- Remove auto page reload from enhance button to eliminate editing interruptions
- Enable seamless content editing workflow with manual enhancement control

Development now requires only 'just dev' instead of complex demo commands.
All sites immediately available at localhost:8080 without hot reload conflicts.
This commit is contained in:
2025-09-16 19:10:57 +02:00
parent eabb7b16e8
commit a3fc3089d2
6 changed files with 90 additions and 160 deletions

View File

@@ -57,8 +57,11 @@ func (rw *responseWriter) WriteHeader(code int) {
// ContentTypeMiddleware ensures JSON responses have proper content type
func ContentTypeMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Set default content type for API responses
if r.URL.Path != "/" && (r.Method == "GET" || r.Method == "POST" || r.Method == "PUT") {
// Set default content type for API responses only, not static sites
if r.URL.Path != "/" &&
!strings.HasPrefix(r.URL.Path, "/sites/") &&
!strings.HasPrefix(r.URL.Path, "/insertr.js") &&
(r.Method == "GET" || r.Method == "POST" || r.Method == "PUT") {
w.Header().Set("Content-Type", "application/json")
}