mirror of
https://github.com/bakito/adguardhome-sync.git
synced 2025-01-08 16:19:34 +08:00
32 lines
904 B
Go
32 lines
904 B
Go
package versions
|
|
|
|
import "golang.org/x/mod/semver"
|
|
|
|
const (
|
|
// MinAgh minimal adguardhome version
|
|
MinAgh = "v0.107.0"
|
|
// LastStringCustomRules last adguardhome version with string payload custom rules
|
|
// https://github.com/bakito/adguardhome-sync/issues/99
|
|
LastStringCustomRules = "v0.107.13"
|
|
// IncompatibleAPI adguardhome version with incompatible API
|
|
// https://github.com/bakito/adguardhome-sync/issues/99
|
|
IncompatibleAPI = "v0.107.14"
|
|
// FixedIncompatibleAPI adguardhome version with fixed API
|
|
// https://github.com/bakito/adguardhome-sync/issues/99
|
|
FixedIncompatibleAPI = "v0.107.15"
|
|
)
|
|
|
|
func IsNewerThan(v1 string, v2 string) bool {
|
|
return semver.Compare(sanitize(v1), sanitize(v2)) == 1
|
|
}
|
|
|
|
func IsSame(v1 string, v2 string) bool {
|
|
return semver.Compare(sanitize(v1), sanitize(v2)) == 0
|
|
}
|
|
|
|
func sanitize(v string) string {
|
|
if v == "" || v[0] == 'v' {
|
|
return v
|
|
}
|
|
return "v" + v
|
|
}
|