Skip to content

Commit

Permalink
Print the full url and use fprintf when showing the tip on the chan
Browse files Browse the repository at this point in the history
Signed-off-by: Chmouel Boudjnah <[email protected]>
  • Loading branch information
chmouel committed Oct 25, 2022
1 parent c33f6e3 commit dd2a983
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gosmee/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,10 @@ func serve(c *cli.Context) error {
router.Get("/{channel:[a-zA-Z0-9]{12,}}", func(w http.ResponseWriter, r *http.Request) {
channel := chi.URLParam(r, "channel")
accept := r.Header.Get("Accept")
fmt.Printf("accept: %v\n", accept)
if strings.Contains(accept, "text/html") {
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte(
fmt.Sprintf("Use the gosmee client to connect, eg: gosmee client %s https://yourlocalservice\n", publicURL)))
fmt.Fprintf(w, "Use the gosmee client to connect, eg: gosmee client %s/%s http://yourlocalservice:port\n",
publicURL, channel)
return
}
newURL, err := r.URL.Parse(fmt.Sprintf("%s?stream=%s", r.URL.Path, channel))
Expand Down

0 comments on commit dd2a983

Please sign in to comment.