mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-11-22 08:37:13 +00:00
skip origin check
This commit is contained in:
parent
27efacc2e4
commit
62fac57c6f
23
main.go
23
main.go
@ -70,15 +70,20 @@ func startServer(config *configTypes.ServerConfig, mux *http.ServeMux) {
|
|||||||
fmt.Println("Error starting server:", err)
|
fmt.Println("Error starting server:", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var wsServer = &websocket.Server{
|
||||||
|
Handshake: func(config *websocket.Config, r *http.Request) error {
|
||||||
|
// Skip origin check
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
Handler: websocket.Handler(relay.WebSocketHandler),
|
||||||
|
}
|
||||||
|
|
||||||
func ListenAndServe(w http.ResponseWriter, r *http.Request) {
|
func ListenAndServe(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Header.Get("Upgrade") == "websocket" {
|
if r.Header.Get("Upgrade") == "websocket" {
|
||||||
websocket.Handler(func(ws *websocket.Conn) {
|
wsServer.ServeHTTP(w, r)
|
||||||
relay.WebSocketHandler(ws)
|
} else if r.Header.Get("Accept") == "application/nostr+json" {
|
||||||
}).ServeHTTP(w, r)
|
nip.RelayInfoHandler(w, r)
|
||||||
} else if r.Header.Get("Accept") == "application/nostr+json" {
|
} else {
|
||||||
nip.RelayInfoHandler(w, r)
|
app.RootHandler(w, r)
|
||||||
} else {
|
}
|
||||||
app.RootHandler(w, r)
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user