4 Commits

Author SHA1 Message Date
92c1ce74e5 1.1.2 2025-08-08 09:59:07 -07:00
8e5a94e8d8 actually fix version updates 2025-08-08 09:58:46 -07:00
61e17cffc5 1.1.1 2025-08-08 09:48:56 -07:00
e7b5215d0f fix version check 2025-08-08 09:47:48 -07:00
3 changed files with 25 additions and 5 deletions

1
go.mod
View File

@@ -4,6 +4,7 @@ go 1.24.3
require (
github.com/BurntSushi/toml v1.5.0
github.com/Masterminds/semver/v3 v3.4.0
github.com/go-ole/go-ole v1.3.0
)

2
go.sum
View File

@@ -1,5 +1,7 @@
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=

View File

@@ -5,10 +5,12 @@ import (
"io"
"net/http"
"regexp"
"github.com/Masterminds/semver/v3"
)
const (
version = "1.1.0"
version = "1.1.2"
versionUrl = "https://git.burkey.co/eburk/epochcli/raw/branch/master/version.go"
)
@@ -28,11 +30,26 @@ func needUpdate() (bool, error) {
return false, fmt.Errorf("unable to read response body: %v", err)
}
re := regexp.MustCompile(`const version = "([\d.]+)"`)
re := regexp.MustCompile(`version\s+=\s+"(\d+.\d+.\d+)"`)
ver := re.FindStringSubmatch(string(b))
if len(ver) < 2 || ver[1] == "" {
return false, fmt.Errorf("unable to find version in response")
if ver[1] == "" {
return false, fmt.Errorf("unable to parse version number")
}
return ver[1] != version, nil
curVer, err := semver.NewVersion(version)
if err != nil {
return false, fmt.Errorf("unable to parse current version to semver: %v", err)
}
newVer, err := semver.NewVersion(ver[1])
if err != nil {
return false, fmt.Errorf("unable to parse new version to semver: %v", err)
}
if curVer.LessThan(newVer) {
fmt.Println("Current Version: ", curVer)
fmt.Println("Latest Version: ", newVer)
return true, nil
}
return false, nil
}