mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-11-22 00:27:14 +00:00
skip origin check
This commit is contained in:
parent
27efacc2e4
commit
62fac57c6f
11
main.go
11
main.go
@ -70,12 +70,17 @@ func startServer(config *configTypes.ServerConfig, mux *http.ServeMux) {
|
||||
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) {
|
||||
if r.Header.Get("Upgrade") == "websocket" {
|
||||
websocket.Handler(func(ws *websocket.Conn) {
|
||||
relay.WebSocketHandler(ws)
|
||||
}).ServeHTTP(w, r)
|
||||
wsServer.ServeHTTP(w, r)
|
||||
} else if r.Header.Get("Accept") == "application/nostr+json" {
|
||||
nip.RelayInfoHandler(w, r)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user