Clean up rogueserver.go

pull/11/head
maru 8 months ago
parent 633142eb29
commit 8a32efeaa3
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D

@ -101,11 +101,11 @@ func createListener(proto, addr string) (net.Listener, error) {
return listener, nil return listener, nil
} }
func debugHandler(router *http.ServeMux) http.Handler { func prodHandler(router *http.ServeMux) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Headers", "*") w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type")
w.Header().Set("Access-Control-Allow-Methods", "*") w.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, POST")
w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Origin", "https://pokerogue.net")
if r.Method == "OPTIONS" { if r.Method == "OPTIONS" {
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
@ -116,12 +116,11 @@ func debugHandler(router *http.ServeMux) http.Handler {
}) })
} }
func debugHandler(router *http.ServeMux) http.Handler {
func prodHandler(router *http.ServeMux) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type") w.Header().Set("Access-Control-Allow-Headers", "*")
w.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, POST") w.Header().Set("Access-Control-Allow-Methods", "*")
w.Header().Set("Access-Control-Allow-Origin", "https://pokerogue.net") w.Header().Set("Access-Control-Allow-Origin", "*")
if r.Method == "OPTIONS" { if r.Method == "OPTIONS" {
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
@ -131,3 +130,4 @@ func prodHandler(router *http.ServeMux) http.Handler {
router.ServeHTTP(w, r) router.ServeHTTP(w, r)
}) })
} }

Loading…
Cancel
Save