Skip to content

Merge from devel #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Apr 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1130ea8
Add bufferflow timedraw
facchinm Nov 12, 2015
6c1c6fa
add sendjsonraw command
facchinm Nov 12, 2015
d710b2d
Use a POST request to trigger update.
matteosuppo Mar 1, 2016
272cd49
Return something before rebooting after an update
matteosuppo Mar 1, 2016
781d8ae
Handle error when looking for path
matteosuppo Mar 1, 2016
981fd38
Merge branch 'devel' into updater
matteosuppo Mar 3, 2016
7c55c5e
Merge pull request #30 from facchinm/timedraw
matteosuppo Mar 3, 2016
8d60ac4
Add autoupdater to vendor folder
matteosuppo Mar 3, 2016
7376967
Update drone to notify arduino-create
matteosuppo Mar 3, 2016
9c7581c
Update drone.sec
matteosuppo Mar 3, 2016
a10a5f8
Fix event hook for notify
matteosuppo Mar 3, 2016
83bc945
Merge pull request #80 from arduino/drone
mastrolinux Mar 7, 2016
d47afcd
Merge branch 'devel' into updater
matteosuppo Mar 10, 2016
6a575f8
Add CORS origins for Scratch and ScratchX
khanning Mar 25, 2016
95f9053
Merge pull request #82 from khanning/devel
matteosuppo Mar 25, 2016
90677b6
Merge pull request #73 from arduino/updater
mastrolinux Apr 7, 2016
68f63b4
Trigger build jenkins
matteosuppo Apr 8, 2016
3497f58
Allow update for dev
matteosuppo Apr 11, 2016
712843b
Remove Scratch and ScratchX CORS entries
khanning Apr 11, 2016
82a4b4e
Remove useless function
matteosuppo Apr 11, 2016
d72645e
Merge pull request #85 from khanning/devel
mastrolinux Apr 12, 2016
9cd874b
Merge pull request #84 from arduino/allowupdatefordev
mastrolinux Apr 12, 2016
e169600
Add info to install libappindicator
mastrolinux Apr 13, 2016
14f88c9
Merge pull request #86 from arduino/fake-commit
Apr 13, 2016
67b28a7
Use a goroutine to detach the restart from the request
matteosuppo Apr 13, 2016
64849f6
Merge pull request #87 from arduino/fixrestart
mastrolinux Apr 14, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .drone.sec
Original file line number Diff line number Diff line change
@@ -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
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
71 changes: 47 additions & 24 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
build:
image: arduino/golang-linux-32
commands:
- apt-get update && apt-get install libgtk-3-dev libappindicator3-dev
- GOOS=linux GOARCH=386 CC=gcc CXX=gcc CGO_ENABLED=1 go build -o artifacts/linux-386/arduino-create-agent
- cp config.ini artifacts/linux-386
build:
image: arduino/golang-cross
auth_config:
username: $$DOCKER_USERNAME
password: $$DOCKER_PASSWORD
email: $$DOCKER_EMAIL
commands:
- apt-get update && apt-get install libgtk-3-dev libappindicator3-dev zip
# Linux amd64
- GOOS=linux GOARCH=amd64 CC=gcc CXX=gcc CGO_ENABLED=1 go build -o artifacts/linux-amd64/arduino-create-agent
- cp config.ini artifacts/linux-amd64
# Darwin amd64
- GOOS=darwin GOARCH=amd64 CC=o64-clang CXX=o64-clang CGO_ENABLED=1 go build -o artifacts/osx/arduino-create-agent
- cp config.ini artifacts/osx
# Windows 386
- 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
- cp config.ini artifacts/windows
- zip -r arduino-create-agent.zip artifacts/*
crosscompilation:
image: arduino/golang-cross
auth_config:
username: $$DOCKER_USERNAME
password: $$DOCKER_PASSWORD
email: $$DOCKER_EMAIL
commands:
- go get github.com/kardianos/govendor
- govendor vet +local
- govendor test +local
# Linux amd64
- GOOS=linux GOARCH=amd64 CC=gcc CXX=gcc CGO_ENABLED=1 go build -o artifacts/linux-amd64/arduino-create-agent
- cp config.ini artifacts/linux-amd64
# Darwin amd64
- GOOS=darwin GOARCH=amd64 CC=o64-clang CXX=o64-clang CGO_ENABLED=1 go build -o artifacts/osx/arduino-create-agent
- cp config.ini artifacts/osx
# Windows 386
- 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
- cp config.ini artifacts/windows
- zip -r arduino-create-agent.zip artifacts/*
linux32:
image: arduino/golang-linux-32
commands:
- GOOS=linux GOARCH=386 CC=gcc CXX=gcc CGO_ENABLED=1 go build -o artifacts/linux-386/arduino-create-agent
- cp config.ini artifacts/linux-386
notify:
slack:
webhook_url: $$SLACK_WEBHOOK
channel: $$SLACK_CHANNEL
username: drone
when:
event: pull_request
template: |
{{#success build.status}}
[{{ repo.name}}] Congrats {{ build.author }}! Your PR works: {{ build.link_url}}
{{else}}
[{{ repo.name}}] Damn {{ build.author }}! Something went wrong with your PR: {{ build.link_url}}
{{/success}}
publish:
github_release:
api_key: $$GITHUB_API_KEY
Expand All @@ -35,4 +45,17 @@ publish:
checksum:
- md5
when:
branch: [master, devel, test]
event: tag
notify:
slack:
webhook_url: $$SLACK_WEBHOOK
channel: $$SLACK_CHANNEL
username: drone
when:
event: tag
template: |
{{#success build.status}}
[{{ repo.name}}/{{ build.branch }}] A new release is available: {{ build.link_url}}
{{else}}
[{{ repo.name}}/{{ build.branch }}] Something went wrong while building a new release: {{ build.link_url}}
{{/success}}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ will build the `arduino-create-agent` binary.
You can use `bootstrapPlatforms` function to compile the needed CGO-enabled environment

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

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


## Creating a release
Just create a new release on github, and our drone server will build and upload
the compiled binaries for every architecture in a zip file in the release itself.
2 changes: 1 addition & 1 deletion bufferflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
//"time"
)

var availableBufferAlgorithms = []string{"default", "timed"}
var availableBufferAlgorithms = []string{"default", "timed", "timedraw"}

type BufferMsg struct {
Cmd string
Expand Down
102 changes: 102 additions & 0 deletions bufferflow_timedraw.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package main

import (
"encoding/json"
"time"

log "github.com/Sirupsen/logrus"
)

type BufferflowTimedRaw struct {
Name string
Port string
Output chan []byte
Input chan string
ticker *time.Ticker
}

var (
bufferedOutputRaw []byte
)

func (b *BufferflowTimedRaw) Init() {
log.Println("Initting timed buffer flow (output once every 16ms)")

go func() {
for data := range b.Input {
bufferedOutputRaw = append(bufferedOutputRaw, []byte(data)...)
}
}()

go func() {
b.ticker = time.NewTicker(16 * time.Millisecond)
for _ = range b.ticker.C {
if len(bufferedOutputRaw) != 0 {
m := SpPortMessageRaw{bufferedOutputRaw}
buf, _ := json.Marshal(m)
// data is now encoded in base64 format
// need a decoder on the other side
b.Output <- []byte(buf)
bufferedOutputRaw = nil
}
}
}()

}

func (b *BufferflowTimedRaw) BlockUntilReady(cmd string, id string) (bool, bool) {
//log.Printf("BlockUntilReady() start\n")
return true, false
}

func (b *BufferflowTimedRaw) OnIncomingData(data string) {
b.Input <- data
}

// Clean out b.sem so it can truly block
func (b *BufferflowTimedRaw) ClearOutSemaphore() {
}

func (b *BufferflowTimedRaw) BreakApartCommands(cmd string) []string {
return []string{cmd}
}

func (b *BufferflowTimedRaw) Pause() {
return
}

func (b *BufferflowTimedRaw) Unpause() {
return
}

func (b *BufferflowTimedRaw) SeeIfSpecificCommandsShouldSkipBuffer(cmd string) bool {
return false
}

func (b *BufferflowTimedRaw) SeeIfSpecificCommandsShouldPauseBuffer(cmd string) bool {
return false
}

func (b *BufferflowTimedRaw) SeeIfSpecificCommandsShouldUnpauseBuffer(cmd string) bool {
return false
}

func (b *BufferflowTimedRaw) SeeIfSpecificCommandsShouldWipeBuffer(cmd string) bool {
return false
}

func (b *BufferflowTimedRaw) SeeIfSpecificCommandsReturnNoResponse(cmd string) bool {
return false
}

func (b *BufferflowTimedRaw) ReleaseLock() {
}

func (b *BufferflowTimedRaw) IsBufferGloballySendingBackIncomingData() bool {
return true
}

func (b *BufferflowTimedRaw) Close() {
b.ticker.Stop()
close(b.Input)
}
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ v = true # show debug logging
appName = CreateBridge
updateUrl = http://downloads.arduino.cc/
#updateUrl = http://localhost/
origins = http://webide.arduino.cc:8080
origins = http://webide.arduino.cc:8080
4 changes: 4 additions & 0 deletions hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ func checkCmd(m []byte) {
// kill the running process (assumes singleton for now)
go spHandlerProgramKill()

} else if strings.HasPrefix(sl, "sendjsonraw") {
// will catch sendjsonraw
go spWriteJsonRaw(s)

} else if strings.HasPrefix(sl, "sendjson") {
// will catch sendjson
go spWriteJson(s)
Expand Down
26 changes: 3 additions & 23 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"time"

log "github.com/Sirupsen/logrus"
"github.com/carlescere/scheduler"
"github.com/gin-gonic/gin"
"github.com/itsjamie/gin-cors"
"github.com/kardianos/osext"
Expand All @@ -25,7 +24,6 @@ import (
var (
version = "x.x.x-dev" //don't modify it, Jenkins will take care
git_revision = "xxxxxxxx" //don't modify it, Jenkins will take care
embedded_autoupdate = true
embedded_autoextract = false
hibernate = flag.Bool("hibernate", false, "start hibernated")
verbose = flag.Bool("v", true, "show debug logging")
Expand Down Expand Up @@ -142,25 +140,6 @@ func main() {
launchSelfLater()
}

if embedded_autoupdate {

var updater = &Updater{
CurrentVersion: version,
ApiURL: *updateUrl,
BinURL: *updateUrl,
DiffURL: "",
Dir: "update/",
CmdName: *appName,
}

if updater != nil {
updater_job := func() {
go updater.BackgroundRun()
}
scheduler.Every(5).Minutes().Run(updater_job)
}
}

log.Println("Version:" + version)

// hostname
Expand Down Expand Up @@ -245,6 +224,7 @@ func main() {
r.GET("/info", infoHandler)
r.POST("/killbrowser", killBrowserHandler)
r.POST("/pause", pauseHandler)
r.POST("/update", updateHandler)

go func() {
// check if certificates exist; if not, use plain http
Expand Down Expand Up @@ -335,8 +315,8 @@ const homeTemplateHtml = `<!DOCTYPE html>
return false;
}
socket.emit("command", msg.val());
if (msg.val().indexOf("log off") != -1) {only_log = true;}
if (msg.val().indexOf("log on") != -1) {only_log = false;}
if (msg.val().indexOf("log off") != -1) {only_log = true}
if (msg.val().indexOf("log on") != -1) {only_log = false}
msg.val("");
return false
});
Expand Down
Loading