diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index c2a1f4c..6a3329c 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -7,6 +7,30 @@
"ImportPath": "github.com/codeskyblue/kexec",
"Rev": "098ccba5e5e7e676f3631983c5ea931a3592871f"
},
+ {
+ "ImportPath": "github.com/equinox-io/equinox",
+ "Rev": "6f97d0d3970881d3e53dd6f547a41109eb055e54"
+ },
+ {
+ "ImportPath": "github.com/equinox-io/equinox/internal/go-update",
+ "Rev": "6f97d0d3970881d3e53dd6f547a41109eb055e54"
+ },
+ {
+ "ImportPath": "github.com/equinox-io/equinox/internal/go-update/internal/binarydist",
+ "Rev": "6f97d0d3970881d3e53dd6f547a41109eb055e54"
+ },
+ {
+ "ImportPath": "github.com/equinox-io/equinox/internal/go-update/internal/osext",
+ "Rev": "6f97d0d3970881d3e53dd6f547a41109eb055e54"
+ },
+ {
+ "ImportPath": "github.com/equinox-io/equinox/internal/osext",
+ "Rev": "6f97d0d3970881d3e53dd6f547a41109eb055e54"
+ },
+ {
+ "ImportPath": "github.com/equinox-io/equinox/proto",
+ "Rev": "6f97d0d3970881d3e53dd6f547a41109eb055e54"
+ },
{
"ImportPath": "github.com/glycerine/rbuf",
"Rev": "b8b438717ac043d5224cc7f079b866e3b9ea0599"
diff --git a/equinox.pub b/equinox.pub
new file mode 100644
index 0000000..d24df2c
--- /dev/null
+++ b/equinox.pub
@@ -0,0 +1,5 @@
+-----BEGIN ECDSA PUBLIC KEY-----
+MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEY8xsSkcFs8XXUicw3n7E77qN/vqKUQ/6
+/X5aBiOVF1yTIRYRXrV3aEvJRzErvQxziT9cLxQq+BFUZqn9pISnPSf9dn0wf9kU
+TxI79zIvne9UT/rDsM0BxSydwtjG00MT
+-----END ECDSA PUBLIC KEY-----
diff --git a/gosuv.go b/gosuv.go
index d280127..34e5b98 100644
--- a/gosuv.go
+++ b/gosuv.go
@@ -8,13 +8,50 @@ import (
"net/http"
"os"
+ "github.com/equinox-io/equinox"
"github.com/urfave/cli"
)
+const appID = "app_8Gji4eEAdDx"
+
var (
- Version string = "dev"
+ Version string = "dev"
+ publicKey = []byte(`
+-----BEGIN ECDSA PUBLIC KEY-----
+MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEY8xsSkcFs8XXUicw3n7E77qN/vqKUQ/6
+/X5aBiOVF1yTIRYRXrV3aEvJRzErvQxziT9cLxQq+BFUZqn9pISnPSf9dn0wf9kU
+TxI79zIvne9UT/rDsM0BxSydwtjG00MT
+-----END ECDSA PUBLIC KEY-----
+`)
)
+func equinoxUpdate() error {
+ var opts equinox.Options
+ if err := opts.SetPublicKeyPEM(publicKey); err != nil {
+ return err
+ }
+
+ // check for the update
+ resp, err := equinox.Check(appID, opts)
+ switch {
+ case err == equinox.NotAvailableErr:
+ fmt.Println("No update available, already at the latest version!")
+ return nil
+ case err != nil:
+ fmt.Println("Update failed:", err)
+ return err
+ }
+
+ // fetch the update and apply it
+ err = resp.Apply()
+ if err != nil {
+ return err
+ }
+
+ fmt.Printf("Updated to new version: %s!\n", resp.ReleaseVersion)
+ return nil
+}
+
func actionStartServer(c *cli.Context) error {
if err := registerHTTPHandlers(); err != nil {
return err
@@ -75,6 +112,10 @@ func actionConfigTest(c *cli.Context) error {
return nil
}
+func actionUpdateSelf(c *cli.Context) error {
+ return equinoxUpdate()
+}
+
func main() {
app := cli.NewApp()
app.Name = "gosuv"
@@ -114,6 +155,11 @@ func main() {
Usage: "Test if config file is valid",
Action: actionConfigTest,
},
+ {
+ Name: "update-self",
+ Usage: "Update gosuv itself",
+ Action: actionUpdateSelf,
+ },
}
if err := app.Run(os.Args); err != nil {
os.Exit(1)
diff --git a/res/css/style.css b/res/css/style.css
index 15b1307..38a8ec5 100644
--- a/res/css/style.css
+++ b/res/css/style.css
@@ -22,9 +22,10 @@ body {
height: 50em;
}
-.status-icon {
- border-radius: 1.5em;
- display: inline-block;
- width: 1.5em;
- font-size: 0.2em;
+.status {
+ background-color: gray;
+ border-radius: 0.3em;
+ padding-left: 0.5em;
+ padding-right: 0.5em;
+ color: white;
}
diff --git a/res/index.html b/res/index.html
index 472a71c..fd0107c 100644
--- a/res/index.html
+++ b/res/index.html
@@ -85,7 +85,9 @@
gohttpserver |
- Running(2h) |
+
+ Running(2h)
+ |
|