diff options
author | lawl <github@dumbinter.net> | 2020-11-12 14:50:42 +0100 |
---|---|---|
committer | lawl <github@dumbinter.net> | 2020-11-12 14:50:42 +0100 |
commit | 8ddee5f4bd9209fbfab63e6fd0b815c92c74266b (patch) | |
tree | 81323851f4a11a0bd079d6b911b4a42f46f9a921 | |
parent | 76d5c2e5ff89075c0f4fddfa92e20c285e3da14e (diff) | |
download | noisetorch-8ddee5f4bd9209fbfab63e6fd0b815c92c74266b.tar.gz noisetorch-8ddee5f4bd9209fbfab63e6fd0b815c92c74266b.zip |
Add build flag to enable the update
A regular make will produce a build without the updater.
An explicit -tags release is now required to bake the updater in.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | config.go | 5 | ||||
-rw-r--r-- | update.go | 2 | ||||
-rw-r--r-- | update_noop.go | 28 |
5 files changed, 35 insertions, 5 deletions
@@ -14,7 +14,7 @@ release: rnnoise mkdir -p tmp/.local/bin/ go generate - CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-s -w -extldflags "-static"' . + CGO_ENABLED=0 GOOS=linux go build -tags release -a -ldflags '-s -w -extldflags "-static"' . upx noisetorch mv noisetorch tmp/.local/bin/ cd tmp/; \ @@ -94,9 +94,6 @@ Install the Go compiler from [golang.org](https://golang.org/). And make sure yo make # build it ``` -If you build from source, it's recommended that you disable automatic update checks. -In `~/.config/noisetorch/config.toml` set `EnableUpdates = false`. - ## Special thanks to * [xiph.org](https://xiph.org)/[Mozilla's](https://mozilla.org) excellent [RNNoise](https://jmvalin.ca/demo/rnnoise/). @@ -20,7 +20,10 @@ const configFile = "config.toml" func initializeConfigIfNot() { log.Println("Checking if config needs to be initialized") - conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true} + conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true} // if you're a package maintainer and you mess with this, we have a problem. + // Unless you set -tags release on the build the updater is *not* compiled in any. DO NOT MESS WITH THIS! + // This isn't and never was the proper location to disable the updater. + configdir := configDir() ok, err := exists(configdir) if err != nil { @@ -1,3 +1,5 @@ +// +build release + package main import ( diff --git a/update_noop.go b/update_noop.go new file mode 100644 index 0000000..bdd7698 --- /dev/null +++ b/update_noop.go @@ -0,0 +1,28 @@ +// +build !release + +package main + +import "errors" + +type updateui struct { + serverVersion string + available bool + triggered bool + updatingText string +} + +func updateCheck(ctx *ntcontext) { + +} + +func update(ctx *ntcontext) { + +} + +func fetchFile(file string) ([]byte, error) { + return make([]byte, 0), errors.New("Disabled by build flags") +} + +func publickey() []byte { + return make([]byte, 0) +} |