Skip to content

Commit 9f13038

Browse files
committed
Merge pull request arduino#88 from arduino/devel
Merge from devel
2 parents 9013af9 + 64849f6 commit 9f13038

20 files changed

+1396
-405
lines changed

.drone.sec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.js55JcNOTOEYUK7TvkYbNUbvZvoKkze6nB0ql2b3ZWkMn6LGRdlfo3e7ktMiRf8e9RAffm86SQSEMorTw78h8iFmub7JI0Z8Xwm1A960SmkW-ULLrzE0uT6il7_pYzjOAxboUiH0ToCElvsTYEUBicc7p4a3gIhgZAezd1w52JIYxzbFQ0ca0fws3KH3H4iR6-N0d7Cc5xEXFIzHgH_OhJUXYiaCW-g5GLgbPQPu29Ofv3-_sZzXTJj4VSjvgRNzkudJieM5KjN_5L9KU6wSJyGECVsTd-kaM0yOesl9NbWq-6SMORIK43kBEgu679OWuMzJ6HbbW6Bk5I8XQASp0w.FvNQmCS3b0mq8MGN.uS9nMU1WjTWxIvkOr41zAGp6OY7MzxWQ2KteBaRm9hE3XDSWvOAwVO7i6BJOQNUX--SMCBs6tdhYyaC-x7PSGze0Ki33LU7pPc-yBhbLUdzGrxYLm1JF_IQ5QlVK2YRk5nFRSIimzylsPEkGHCd-nQciHC_m0Wetzldb-d49MNw6wZFsby8MQKVQJoWUVXM7LM-jZ5tmAmzxV1S0Py6LqUT7AAGL2RNax22YsNaOY214KTiSnIrT8eo3zmvzi28CdsapOIYxCFP8Z_JUAkjYAuow5ysxFkVvEGxr9d-W8TCyL36Sa4GgfEVvtzpcKpVmhzMllIXiXVh8ZdLJ_EuWomNSV_9veIy_ULmKo8B8tB6Uv2nlnFqGAxaf5DNYcqqQj4isHpEWFSR0ZIGU5ksoH_bY0pzQsf3wwii3KlzOJg.7WbHe_TOAdzgMW16sBvzIg
1+
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.pr9ZMRbPGFZ6rTQOAmHQJN4RRE8Hmnl6Sn6ek2DogiLA6qIZCCei6RHLppto2tpM1ApM5pLpW64TjGf_mCLIesk_GtnUF6baxrHodcI8EB3VV3CsXU3EJF3_FOk3uSJUOi7hbtn54ztMBL2QKeccUiO-KBC2BHiD8VVpjnY5C-TLYV-1Td2fUZc3QB4eoqeTlvglu0nSvHHGCL89RQU0ZEW_-h_tXXaDrvXS648g-U2B9uwnVgBgBPhQqOzP02cW2-ojgkAC7xNpO_BOWoYouT56kkeM5MEx1XyJ-tAdP0AU8mG3x6mRBbng2nwTiXt9RqIJ01RKysMdgth17SZQ8A.apeQnLTu98uqD1Xl.se-xrnl2-B63chHdq719TO98hjxVIN6qTkCnTv5y__LM7ku-FBmlUnZLKy6jDZfO3Fz0jUNwSxuU2LGJWuJ5-PEQkqhsjJuDNBbrAKbt9oqFpXUKXOyu5yw8f64GHgG0bmlrZS6X04P4JAx6t9pXE0rKV5yktoYLLcTgoHnWm3C8eX7H1ayewDJ_CD2ricdZ5J-YAe4sz1AR2mRPRiyx-LTheTc2sALqZv39_ctOI9weNIGy013Jc_6MchmERmT2c4QKlIhy2ra9CPZsOgyn6d008qse14Q32IP97VJ3KLCq69P7u3y28KGz6btjfurLFP1EuipKhWxpIsE4YWQcf_l-eXxpd-l2SUPFMMNBI6aXItKpPofgjMAPeJzlIkhkXCtfRRWIgDaHlS_eAk0nWaXSQyUljUnR7qaVyCqh.FAYZK3PkD_9u3cXwsD8WSw

.drone.yml

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,42 @@
11
build:
2-
image: arduino/golang-linux-32
3-
commands:
4-
- apt-get update && apt-get install libgtk-3-dev libappindicator3-dev
5-
- GOOS=linux GOARCH=386 CC=gcc CXX=gcc CGO_ENABLED=1 go build -o artifacts/linux-386/arduino-create-agent
6-
- cp config.ini artifacts/linux-386
7-
build:
8-
image: arduino/golang-cross
9-
auth_config:
10-
username: $$DOCKER_USERNAME
11-
password: $$DOCKER_PASSWORD
12-
email: $$DOCKER_EMAIL
13-
commands:
14-
- apt-get update && apt-get install libgtk-3-dev libappindicator3-dev zip
15-
# Linux amd64
16-
- GOOS=linux GOARCH=amd64 CC=gcc CXX=gcc CGO_ENABLED=1 go build -o artifacts/linux-amd64/arduino-create-agent
17-
- cp config.ini artifacts/linux-amd64
18-
# Darwin amd64
19-
- GOOS=darwin GOARCH=amd64 CC=o64-clang CXX=o64-clang CGO_ENABLED=1 go build -o artifacts/osx/arduino-create-agent
20-
- cp config.ini artifacts/osx
21-
# Windows 386
22-
- GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-gcc CGO_ENABLED=1 go build -o artifacts/windows/arduino-create-agent.exe -ldflags -H=windowsgui
23-
- cp config.ini artifacts/windows
24-
- zip -r arduino-create-agent.zip artifacts/*
2+
crosscompilation:
3+
image: arduino/golang-cross
4+
auth_config:
5+
username: $$DOCKER_USERNAME
6+
password: $$DOCKER_PASSWORD
7+
email: $$DOCKER_EMAIL
8+
commands:
9+
- go get github.com/kardianos/govendor
10+
- govendor vet +local
11+
- govendor test +local
12+
# Linux amd64
13+
- GOOS=linux GOARCH=amd64 CC=gcc CXX=gcc CGO_ENABLED=1 go build -o artifacts/linux-amd64/arduino-create-agent
14+
- cp config.ini artifacts/linux-amd64
15+
# Darwin amd64
16+
- GOOS=darwin GOARCH=amd64 CC=o64-clang CXX=o64-clang CGO_ENABLED=1 go build -o artifacts/osx/arduino-create-agent
17+
- cp config.ini artifacts/osx
18+
# Windows 386
19+
- GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-gcc CGO_ENABLED=1 go build -o artifacts/windows/arduino-create-agent.exe -ldflags -H=windowsgui
20+
- cp config.ini artifacts/windows
21+
- zip -r arduino-create-agent.zip artifacts/*
22+
linux32:
23+
image: arduino/golang-linux-32
24+
commands:
25+
- GOOS=linux GOARCH=386 CC=gcc CXX=gcc CGO_ENABLED=1 go build -o artifacts/linux-386/arduino-create-agent
26+
- cp config.ini artifacts/linux-386
2527
notify:
2628
slack:
2729
webhook_url: $$SLACK_WEBHOOK
2830
channel: $$SLACK_CHANNEL
2931
username: drone
32+
when:
33+
event: pull_request
34+
template: |
35+
{{#success build.status}}
36+
[{{ repo.name}}] Congrats {{ build.author }}! Your PR works: {{ build.link_url}}
37+
{{else}}
38+
[{{ repo.name}}] Damn {{ build.author }}! Something went wrong with your PR: {{ build.link_url}}
39+
{{/success}}
3040
publish:
3141
github_release:
3242
api_key: $$GITHUB_API_KEY
@@ -35,4 +45,17 @@ publish:
3545
checksum:
3646
- md5
3747
when:
38-
branch: [master, devel, test]
48+
event: tag
49+
notify:
50+
slack:
51+
webhook_url: $$SLACK_WEBHOOK
52+
channel: $$SLACK_CHANNEL
53+
username: drone
54+
when:
55+
event: tag
56+
template: |
57+
{{#success build.status}}
58+
[{{ repo.name}}/{{ build.branch }}] A new release is available: {{ build.link_url}}
59+
{{else}}
60+
[{{ repo.name}}/{{ build.branch }}] Something went wrong while building a new release: {{ build.link_url}}
61+
{{/success}}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ will build the `arduino-create-agent` binary.
3434
You can use `bootstrapPlatforms` function to compile the needed CGO-enabled environment
3535

3636
Other prerequisites are:
37-
* libappindicator (Linux only)
37+
* libappindicator (Linux only on Ubuntu `sudo apt-get install libappindicator1`)
3838
* [go-selfupdate] (https://github.com/sanbornm/go-selfupdate) if you want to test automatic updates
3939

4040
## Submitting an issue
@@ -92,6 +92,7 @@ By making a contribution to this project, I certify that:
9292
this project or the open source license(s) involved.
9393
```
9494

95+
9596
## Creating a release
9697
Just create a new release on github, and our drone server will build and upload
9798
the compiled binaries for every architecture in a zip file in the release itself.

bufferflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
//"time"
66
)
77

8-
var availableBufferAlgorithms = []string{"default", "timed"}
8+
var availableBufferAlgorithms = []string{"default", "timed", "timedraw"}
99

1010
type BufferMsg struct {
1111
Cmd string

bufferflow_timedraw.go

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"time"
6+
7+
log "github.com/Sirupsen/logrus"
8+
)
9+
10+
type BufferflowTimedRaw struct {
11+
Name string
12+
Port string
13+
Output chan []byte
14+
Input chan string
15+
ticker *time.Ticker
16+
}
17+
18+
var (
19+
bufferedOutputRaw []byte
20+
)
21+
22+
func (b *BufferflowTimedRaw) Init() {
23+
log.Println("Initting timed buffer flow (output once every 16ms)")
24+
25+
go func() {
26+
for data := range b.Input {
27+
bufferedOutputRaw = append(bufferedOutputRaw, []byte(data)...)
28+
}
29+
}()
30+
31+
go func() {
32+
b.ticker = time.NewTicker(16 * time.Millisecond)
33+
for _ = range b.ticker.C {
34+
if len(bufferedOutputRaw) != 0 {
35+
m := SpPortMessageRaw{bufferedOutputRaw}
36+
buf, _ := json.Marshal(m)
37+
// data is now encoded in base64 format
38+
// need a decoder on the other side
39+
b.Output <- []byte(buf)
40+
bufferedOutputRaw = nil
41+
}
42+
}
43+
}()
44+
45+
}
46+
47+
func (b *BufferflowTimedRaw) BlockUntilReady(cmd string, id string) (bool, bool) {
48+
//log.Printf("BlockUntilReady() start\n")
49+
return true, false
50+
}
51+
52+
func (b *BufferflowTimedRaw) OnIncomingData(data string) {
53+
b.Input <- data
54+
}
55+
56+
// Clean out b.sem so it can truly block
57+
func (b *BufferflowTimedRaw) ClearOutSemaphore() {
58+
}
59+
60+
func (b *BufferflowTimedRaw) BreakApartCommands(cmd string) []string {
61+
return []string{cmd}
62+
}
63+
64+
func (b *BufferflowTimedRaw) Pause() {
65+
return
66+
}
67+
68+
func (b *BufferflowTimedRaw) Unpause() {
69+
return
70+
}
71+
72+
func (b *BufferflowTimedRaw) SeeIfSpecificCommandsShouldSkipBuffer(cmd string) bool {
73+
return false
74+
}
75+
76+
func (b *BufferflowTimedRaw) SeeIfSpecificCommandsShouldPauseBuffer(cmd string) bool {
77+
return false
78+
}
79+
80+
func (b *BufferflowTimedRaw) SeeIfSpecificCommandsShouldUnpauseBuffer(cmd string) bool {
81+
return false
82+
}
83+
84+
func (b *BufferflowTimedRaw) SeeIfSpecificCommandsShouldWipeBuffer(cmd string) bool {
85+
return false
86+
}
87+
88+
func (b *BufferflowTimedRaw) SeeIfSpecificCommandsReturnNoResponse(cmd string) bool {
89+
return false
90+
}
91+
92+
func (b *BufferflowTimedRaw) ReleaseLock() {
93+
}
94+
95+
func (b *BufferflowTimedRaw) IsBufferGloballySendingBackIncomingData() bool {
96+
return true
97+
}
98+
99+
func (b *BufferflowTimedRaw) Close() {
100+
b.ticker.Stop()
101+
close(b.Input)
102+
}

config.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ v = true # show debug logging
77
appName = CreateBridge
88
updateUrl = http://downloads.arduino.cc/
99
#updateUrl = http://localhost/
10-
origins = http://webide.arduino.cc:8080
10+
origins = http://webide.arduino.cc:8080

hub.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ func checkCmd(m []byte) {
171171
// kill the running process (assumes singleton for now)
172172
go spHandlerProgramKill()
173173

174+
} else if strings.HasPrefix(sl, "sendjsonraw") {
175+
// will catch sendjsonraw
176+
go spWriteJsonRaw(s)
177+
174178
} else if strings.HasPrefix(sl, "sendjson") {
175179
// will catch sendjson
176180
go spWriteJson(s)

main.go

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"time"
1515

1616
log "github.com/Sirupsen/logrus"
17-
"github.com/carlescere/scheduler"
1817
"github.com/gin-gonic/gin"
1918
"github.com/itsjamie/gin-cors"
2019
"github.com/kardianos/osext"
@@ -25,7 +24,6 @@ import (
2524
var (
2625
version = "x.x.x-dev" //don't modify it, Jenkins will take care
2726
git_revision = "xxxxxxxx" //don't modify it, Jenkins will take care
28-
embedded_autoupdate = true
2927
embedded_autoextract = false
3028
hibernate = flag.Bool("hibernate", false, "start hibernated")
3129
verbose = flag.Bool("v", true, "show debug logging")
@@ -143,25 +141,6 @@ func main() {
143141
launchSelfLater()
144142
}
145143

146-
if embedded_autoupdate {
147-
148-
var updater = &Updater{
149-
CurrentVersion: version,
150-
ApiURL: *updateUrl,
151-
BinURL: *updateUrl,
152-
DiffURL: "",
153-
Dir: "update/",
154-
CmdName: *appName,
155-
}
156-
157-
if updater != nil {
158-
updater_job := func() {
159-
go updater.BackgroundRun()
160-
}
161-
scheduler.Every(5).Minutes().Run(updater_job)
162-
}
163-
}
164-
165144
log.Println("Version:" + version)
166145

167146
// hostname
@@ -246,6 +225,7 @@ func main() {
246225
r.GET("/info", infoHandler)
247226
r.POST("/killbrowser", killBrowserHandler)
248227
r.POST("/pause", pauseHandler)
228+
r.POST("/update", updateHandler)
249229

250230
go func() {
251231
// check if certificates exist; if not, use plain http
@@ -334,8 +314,8 @@ const homeTemplateHtml = `<!DOCTYPE html>
334314
return false;
335315
}
336316
socket.emit("command", msg.val());
337-
if (msg.val().indexOf("log off") != -1) {only_log = true;}
338-
if (msg.val().indexOf("log on") != -1) {only_log = false;}
317+
if (msg.val().indexOf("log off") != -1) {only_log = true}
318+
if (msg.val().indexOf("log on") != -1) {only_log = false}
339319
msg.val("");
340320
return false
341321
});

0 commit comments

Comments
 (0)