1.0.2
This commit is contained in:
2
main.go
2
main.go
@@ -11,7 +11,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var appVersion = semver.MustParse("1.0.1")
|
var appVersion = semver.MustParse("1.0.2")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetupLogging()
|
log.SetupLogging()
|
||||||
|
@@ -129,25 +129,6 @@ func QuotePathForShell(path string) string {
|
|||||||
return fmt.Sprintf(`"%s"`, path)
|
return fmt.Sprintf(`"%s"`, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CheckForUpdate(currentVersion string) (latestVersion, releaseNotes string, updateAvailable bool, err error) {
|
|
||||||
resp, err := http.Get("https://api.github.com/repos/tairasu/EpochSilicon/releases/latest")
|
|
||||||
if err != nil {
|
|
||||||
return "", "", false, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
var data struct {
|
|
||||||
TagName string `json:"tag_name"`
|
|
||||||
Body string `json:"body"`
|
|
||||||
}
|
|
||||||
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
|
|
||||||
return "", "", false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
latest := strings.TrimPrefix(data.TagName, "v")
|
|
||||||
return latest, data.Body, latest != currentVersion, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateInfo contains information about the latest release
|
// UpdateInfo contains information about the latest release
|
||||||
type UpdateInfo struct {
|
type UpdateInfo struct {
|
||||||
TagName string `json:"tag_name"`
|
TagName string `json:"tag_name"`
|
||||||
|
Reference in New Issue
Block a user