@@ -3,6 +3,7 @@ package main
3
3
import (
4
4
"encoding/json"
5
5
"fmt"
6
+ "html"
6
7
"io"
7
8
"os"
8
9
"runtime"
@@ -40,22 +41,22 @@ var h = hub{
40
41
}
41
42
42
43
const commands = `{
43
- "Commands": [
44
- "list",
45
- "open < portName > < baud > [bufferAlgorithm: ({default}, timed, timedraw, timedbinary)]",
46
- "send < portName > < cmd >",
47
- "sendnobuf < portName > < cmd >",
48
- "close < portName >",
49
- "restart",
50
- "exit",
51
- "killupload",
52
- "downloadtool < tool > < toolVersion: {latest} > < pack: {arduino} > < behaviour: {keep} >",
53
- "log",
54
- "memorystats",
55
- "gc",
56
- "hostname",
57
- "version"
58
- ]
44
+ "Commands": [
45
+ "list",
46
+ "open <portName> <baud> [bufferAlgorithm: ({default}, timed, timedraw, timedbinary)]",
47
+ "send <portName> <cmd>",
48
+ "sendnobuf <portName> <cmd>",
49
+ "close <portName>",
50
+ "restart",
51
+ "exit",
52
+ "killupload",
53
+ "downloadtool <tool> <toolVersion: {latest}> <pack: {arduino}> <behaviour: {keep}>",
54
+ "log",
55
+ "memorystats",
56
+ "gc",
57
+ "hostname",
58
+ "version"
59
+ ]
59
60
}`
60
61
61
62
func (h * hub ) unregisterConnection (c * connection ) {
@@ -86,7 +87,7 @@ func (h *hub) run() {
86
87
h .connections [c ] = true
87
88
// send supported commands
88
89
c .send <- []byte (fmt .Sprintf (`{"Version" : "%s"} ` , version ))
89
- c .send <- []byte (commands )
90
+ c .send <- []byte (html . EscapeString ( commands ) )
90
91
c .send <- []byte (fmt .Sprintf (`{"Hostname" : "%s"} ` , * hostname ))
91
92
c .send <- []byte (fmt .Sprintf (`{"OS" : "%s"} ` , runtime .GOOS ))
92
93
case c := <- h .unregister :
0 commit comments