Skip to content

Commit ba3eadf

Browse files
mastrolinuxmatteosuppo
authored andcommitted
Remove autoupdate using polling method (#83)
* Use a POST request to trigger update. The updater code has been moved to its own package. The scheduler has been remove. Some functions about unzipping files went into utilities.go * Return something before rebooting after an update * Handle error when looking for path * Add autoupdater to vendor folder * Add CORS origins for Scratch and ScratchX Scratch hardware extensions are written in JavaScript and loaded in Scratch (https://scratch.mit.edu) or the experimental extension site, ScratchX (http://scratchx.org). This change will allow the Scratch Arduino extension to use the Create agent to communicate directly with Arduino boards.
1 parent 83bc945 commit ba3eadf

File tree

13 files changed

+1161
-368
lines changed

13 files changed

+1161
-368
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -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.

config.ini

+1-1
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, https://scratch.mit.edu, http://scratchx.org

main.go

+1-21
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")
@@ -142,25 +140,6 @@ func main() {
142140
launchSelfLater()
143141
}
144142

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

166145
// hostname
@@ -245,6 +224,7 @@ func main() {
245224
r.GET("/info", infoHandler)
246225
r.POST("/killbrowser", killBrowserHandler)
247226
r.POST("/pause", pauseHandler)
227+
r.POST("/update", updateHandler)
248228

249229
go func() {
250230
// check if certificates exist; if not, use plain http

0 commit comments

Comments
 (0)