init - add project files

This commit is contained in:
2025-03-06 23:54:11 -05:00
commit e724ff1120
1363 changed files with 897467 additions and 0 deletions

18
middleware/cors.go Normal file
View File

@@ -0,0 +1,18 @@
package middleware
import (
"net/http"
"maxwarden/config"
)
func EnableCors(h http.HandlerFunc) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if config.DEBUG {
w.Header().Set("Access-Control-Allow-Origin", "*")
} else {
w.Header().Set("Access-Control-Allow-Origin", "https://"+config.GetConfig().Domain)
}
h.ServeHTTP(w, r)
})
}