nsfwapp/backend/server.go
2026-03-03 10:11:30 +01:00

53 lines
1.0 KiB
Go

// backend\server.go
package main
import (
"fmt"
"net/http"
"os"
)
// --- main ---
func main() {
loadSettings()
fixKeepRootFilesIntoModelSubdirs()
postWorkQ.StartWorkers(1)
startPostWorkStatusRefresher()
go startGeneratedGarbageCollector()
mux := http.NewServeMux()
// ✅ AuthManager erstellen (Beispiel)
// Du brauchst hier typischerweise:
// - ein Secret/Key (Cookie signen / Sessions)
// - Username+Pass Hash oder config
// - optional 2FA store
auth, err := NewAuthManager()
if err != nil {
fmt.Println("❌ auth init:", err)
os.Exit(1)
}
store := registerRoutes(mux, auth)
go startChaturbateOnlinePoller(store)
go startChaturbateAutoStartWorker(store)
go startMyFreeCamsAutoStartWorker(store)
go startDiskSpaceGuard()
if _, err := ensureCoversDir(); err != nil {
fmt.Println("⚠️ covers dir:", err)
}
fmt.Println("🌐 HTTP-API aktiv: http://localhost:9999")
handler := withCORS(mux)
if err := http.ListenAndServe(":9999", handler); err != nil {
fmt.Println("❌ HTTP-Server Fehler:", err)
os.Exit(1)
}
}