@@ -12,7 +12,6 @@ import (
1212 "github.com/function61/gokit/io/bidipipe"
1313 "github.com/function61/gokit/net/http/httputils"
1414 "github.com/function61/holepunch-server/pkg/wsconnadapter"
15- "github.com/gorilla/mux"
1615 "github.com/gorilla/websocket"
1716)
1817
@@ -47,14 +46,14 @@ var ui, _ = template.New("_").Parse(`<!doctype html>
4746` )
4847
4948func newServerHandler (screens []* Screen , logger * slog.Logger ) http.Handler {
50- routes := mux . NewRouter ()
49+ routes := http . NewServeMux ()
5150
5251 // serves VNC client etc.
53- routes .PathPrefix ("/static/" ). Handler ( http .StripPrefix ("/static/" , http .FileServer (http .Dir ("./www" ))))
52+ routes .Handle ("/static/" , http .StripPrefix ("/static/" , http .FileServer (http .Dir ("./www" ))))
5453
5554 // websocket-to-VNC proxy
5655 routes .HandleFunc ("/api/screen/{id}/ws" , func (w http.ResponseWriter , r * http.Request ) {
57- id , err := strconv .Atoi (mux . Vars ( r )[ "id" ] )
56+ id , err := strconv .Atoi (r . PathValue ( "id" ) )
5857 if err != nil {
5958 httputils .Error (w , http .StatusBadRequest )
6059 return
@@ -98,7 +97,7 @@ func newServerHandler(screens []*Screen, logger *slog.Logger) http.Handler {
9897 })
9998
10099 routes .HandleFunc ("/api/screen/{id}/osd/notify" , func (w http.ResponseWriter , r * http.Request ) {
101- id , err := strconv .Atoi (mux . Vars ( r )[ "id" ] )
100+ id , err := strconv .Atoi (r . PathValue ( "id" ) )
102101 if err != nil {
103102 http .Error (w , err .Error (), http .StatusBadRequest )
104103 return
@@ -120,7 +119,7 @@ func newServerHandler(screens []*Screen, logger *slog.Logger) http.Handler {
120119 })
121120
122121 routes .HandleFunc ("/api/screen/{id}/screenshot" , func (w http.ResponseWriter , r * http.Request ) {
123- id , err := strconv .Atoi (mux . Vars ( r )[ "id" ] )
122+ id , err := strconv .Atoi (r . PathValue ( "id" ) )
124123 if err != nil {
125124 http .Error (w , err .Error (), http .StatusBadRequest )
126125 return
0 commit comments