Skip to content

Commit 319cac4

Browse files
committedMay 21, 2018
Ensure trayicon will call 127.0.0.1
Note that https will be broken unless certificates are regenerated, since they were created for localhost, not 127.0.0.1
1 parent e1222c4 commit 319cac4

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed
 

‎README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ It will listen to http and websocket connections on a range of ports from `8990`
9191
### Discover the port
9292
You should make GET request to the `/info` endpoint on the possible ports, until you find a reply:
9393

94-
$ curl http://localhost:8990/info
95-
curl: (7) Failed to connect to localhost port 8990: Connection refused
96-
$ curl http://localhost:8991/info
94+
$ curl http://127.0.0.1:8990/info
95+
curl: (7) Failed to connect to 127.0.0.1 port 8990: Connection refused
96+
$ curl http://127.0.0.1:8991/info
9797

98-
$ curl http://localhost:8992/info
99-
{"http":"http://localhost:8992","https":"https://localhost:8991","version":"1.0.36","ws":"ws://localhost:8992","wss":"wss://localhost:8991"}
98+
$ curl http://127.0.0.1:8992/info
99+
{"http":"http://127.0.0.1:8992","https":"https://127.0.0.1:8991","version":"1.0.36","ws":"ws://127.0.0.1:8992","wss":"wss://127.0.0.1:8991"}
100100

101101
The reply will contain a json with info about the version and the http and https endpoints to use
102102

@@ -176,7 +176,7 @@ where you should replace /dev/ttyACM0 with the actual port and 9600 with the bau
176176
You will receive a message like:
177177
178178
```json
179-
{
179+
{
180180
"Cmd":"Open",
181181
"Desc":"Got register/open on port.",
182182
"Port":"/dev/ttyACM0",
@@ -189,7 +189,7 @@ You will receive a message like:
189189
or
190190
191191
```json
192-
{
192+
{
193193
"Cmd":"OpenFail",
194194
"Desc":"Error opening port. Serial port busy",
195195
"Port":"/dev/ttyACM0",
@@ -204,7 +204,7 @@ You can then close the port with
204204
You will receive a message like:
205205
206206
```json
207-
{
207+
{
208208
"Cmd":"Close",
209209
"Desc":"Got unregister/close on port.",
210210
"Port":"/dev/ttyACM0",
@@ -216,7 +216,7 @@ or
216216
217217
218218
```json
219-
{
219+
{
220220
"Error":"We could not find the serial port /dev/ttyACM0 that you were trying to close."
221221
}
222222
```
@@ -238,7 +238,7 @@ with a reply like
238238
You can receive output from the serial port by listening to messages like this:
239239
240240
```json
241-
{
241+
{
242242
"D":"output string\r\n"
243243
}
244244
```

‎certificates.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
)
3030

3131
var (
32-
host = "localhost"
32+
host = "127.0.0.1"
3333
validFrom = ""
3434
validFor = 365 * 24 * time.Hour * 2 // 2 years
3535
rsaBits = 2048
@@ -104,7 +104,7 @@ func generateSingleCertificate(isCa bool) (*x509.Certificate, error) {
104104
Subject: pkix.Name{
105105
Organization: []string{"Arduino LLC US"},
106106
Country: []string{"US"},
107-
CommonName: "localhost",
107+
CommonName: "127.0.0.1",
108108
OrganizationalUnit: []string{"IT"},
109109
},
110110
NotBefore: notBefore,

‎trayicon.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ func getConfigs() []ConfigIni {
8383
filepath.Walk(dest, func(path string, f os.FileInfo, _ error) error {
8484
if !f.IsDir() {
8585
if filepath.Ext(path) == ".ini" {
86-
cfg, _ := ini.LoadSources(ini.LoadOptions{IgnoreInlineComment: true}, filepath.Join(dest, f.Name()))
86+
cfg, err := ini.LoadSources(ini.LoadOptions{IgnoreInlineComment: true}, filepath.Join(dest, f.Name()))
87+
if err != nil {
88+
return err
89+
}
8790
defaultSection, err := cfg.GetSection("")
8891
name := defaultSection.Key("name").String()
8992
if name == "" || err != nil {
@@ -183,7 +186,7 @@ func setupSysTrayReal() {
183186
for {
184187
<-mDebug.ClickedCh
185188
logAction("log on")
186-
open.Start("http://localhost" + port)
189+
open.Start("http://127.0.0.1" + port)
187190
}
188191
}()
189192

0 commit comments

Comments
 (0)