-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor latest version checking to not go through rod browser
- Loading branch information
1 parent
764a7b7
commit 5f6668b
Showing
9 changed files
with
125 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package core | ||
|
||
import "time" | ||
|
||
var ( | ||
SteamUsername string | ||
SteamPassword string | ||
CapIDEmail string | ||
CapIDPassword string | ||
AppVersion string | ||
RefreshInterval time.Duration = 30 * time.Second | ||
RunHeadless bool | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package patch | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/blang/semver" | ||
"github.com/rhysd/go-github-selfupdate/selfupdate" | ||
) | ||
|
||
func CheckForUpdate(appVersion string) (bool, string, error) { | ||
latest, found, err := selfupdate.DetectLatest(`williamsjokvist/cfn-tracker`) | ||
if err != nil { | ||
return false, "", fmt.Errorf(`get latest app version: %w`, err) | ||
} | ||
|
||
v, err := semver.Parse(appVersion) | ||
if err != nil { | ||
return false, "", fmt.Errorf(`parse app version: %w`, err) | ||
} | ||
|
||
if !found || latest.Version.LTE(v) { | ||
log.Println("Current version is the latest") | ||
return false, "", nil | ||
} | ||
|
||
log.Println("New app version available: ", latest.Version.String()) | ||
return true, latest.Version.String(), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//go:build darwin | ||
|
||
package patch | ||
|
||
func MustPatch(toVersion string) bool { | ||
|
||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//go:build windows | ||
|
||
package patch | ||
|
||
func MustPatch(toVersion string) bool { | ||
|
||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters