Web server
This commit is contained in:
@@ -68,11 +68,18 @@ func main() {
|
|||||||
|
|
||||||
if *http_port != -1 {
|
if *http_port != -1 {
|
||||||
http.HandleFunc("/switch", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/switch", func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintf(w, "%q", r.URL.Query())
|
fmt.Fprintf(w, "%q\n", r.URL.Query())
|
||||||
err := n.Switch(7)
|
q := r.URL.Query()
|
||||||
|
c, ok := q["c"]
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
fmt.Fprintf(w, "Channel param required\n")
|
||||||
|
} else {
|
||||||
|
err := n.Switch(c)
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(w, "%q", err)
|
fmt.Fprintf(w, "%q\n", err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user