Denis V. Dedkov 9 年之前
父節點
當前提交
6cf28b9902
共有 1 個文件被更改,包括 3 次插入2 次删除
  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)