mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 02:18:44 -07:00
lib/api: Returns tags in version as list (#7190)
This commit is contained in:
parent
7980c8cea2
commit
ec5a5d5218
@ -643,7 +643,7 @@ func (s *service) getSystemVersion(w http.ResponseWriter, r *http.Request) {
|
|||||||
"isCandidate": build.IsCandidate,
|
"isCandidate": build.IsCandidate,
|
||||||
"isRelease": build.IsRelease,
|
"isRelease": build.IsRelease,
|
||||||
"date": build.Date,
|
"date": build.Date,
|
||||||
"tags": build.Tags,
|
"tags": build.TagsList(),
|
||||||
"stamp": build.Stamp,
|
"stamp": build.Stamp,
|
||||||
"user": build.User,
|
"user": build.User,
|
||||||
})
|
})
|
||||||
|
@ -87,6 +87,13 @@ func LongVersionFor(program string) string {
|
|||||||
date := Date.UTC().Format("2006-01-02 15:04:05 MST")
|
date := Date.UTC().Format("2006-01-02 15:04:05 MST")
|
||||||
v := fmt.Sprintf(`%s %s "%s" (%s %s-%s) %s@%s %s`, program, Version, Codename, runtime.Version(), runtime.GOOS, runtime.GOARCH, User, Host, date)
|
v := fmt.Sprintf(`%s %s "%s" (%s %s-%s) %s@%s %s`, program, Version, Codename, runtime.Version(), runtime.GOOS, runtime.GOARCH, User, Host, date)
|
||||||
|
|
||||||
|
if tags := TagsList(); len(tags) > 0 {
|
||||||
|
v = fmt.Sprintf("%s [%s]", v, strings.Join(tags, ", "))
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
func TagsList() []string {
|
||||||
tags := strings.Split(Tags, ",")
|
tags := strings.Split(Tags, ",")
|
||||||
if len(tags) == 1 && tags[0] == "" {
|
if len(tags) == 1 && tags[0] == "" {
|
||||||
tags = tags[:0]
|
tags = tags[:0]
|
||||||
@ -96,9 +103,7 @@ func LongVersionFor(program string) string {
|
|||||||
tags = append(tags, strings.ToLower(envVar))
|
tags = append(tags, strings.ToLower(envVar))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(tags) > 0 {
|
|
||||||
sort.Strings(tags)
|
sort.Strings(tags)
|
||||||
v = fmt.Sprintf("%s [%s]", v, strings.Join(tags, ", "))
|
return tags
|
||||||
}
|
|
||||||
return v
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user