Denis V. Dedkov 9 years ago
parent
commit
6cf28b9902
1 changed files with 3 additions and 2 deletions
  1. 3 2
      noolite-cli.go

+ 3 - 2
noolite-cli.go

@@ -73,6 +73,7 @@ func parseParams(path string) (string, int, int, int, int, int) {
 		value, _ = strconv.Atoi(params[2])
 	}
 	if len(params) == 5 {
+		value = 0
 		r, _ = strconv.Atoi(params[2])
 		g, _ = strconv.Atoi(params[3])
 		b, _ = strconv.Atoi(params[4])
@@ -101,11 +102,11 @@ func main() {
 		}
 	} else {
 		http.HandleFunc("/noolite/", func(w http.ResponseWriter, r *http.Request) {
-			command, channel, _, _,_, _ := parseParams(r.URL.Path[1:])
+			command, channel, value, r, g, b := parseParams(r.URL.Path[1:])
 			fmt.Fprintf(w, "Command: %q\n", command)
 			fmt.Fprintf(w, "Channel: %d\n", channel)
 
-			err := sendCommand(command, channel, 0, 0, 0, 0)
+			err := sendCommand(command, channel, value, r, g, b)
 
 			if err != nil {
 				fmt.Fprintf(w, "Error: %q\n", err)