mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00: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,
|
||||
"isRelease": build.IsRelease,
|
||||
"date": build.Date,
|
||||
"tags": build.Tags,
|
||||
"tags": build.TagsList(),
|
||||
"stamp": build.Stamp,
|
||||
"user": build.User,
|
||||
})
|
||||
|
@ -87,6 +87,13 @@ func LongVersionFor(program string) string {
|
||||
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)
|
||||
|
||||
if tags := TagsList(); len(tags) > 0 {
|
||||
v = fmt.Sprintf("%s [%s]", v, strings.Join(tags, ", "))
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func TagsList() []string {
|
||||
tags := strings.Split(Tags, ",")
|
||||
if len(tags) == 1 && tags[0] == "" {
|
||||
tags = tags[:0]
|
||||
@ -96,9 +103,7 @@ func LongVersionFor(program string) string {
|
||||
tags = append(tags, strings.ToLower(envVar))
|
||||
}
|
||||
}
|
||||
if len(tags) > 0 {
|
||||
sort.Strings(tags)
|
||||
v = fmt.Sprintf("%s [%s]", v, strings.Join(tags, ", "))
|
||||
}
|
||||
return v
|
||||
|
||||
sort.Strings(tags)
|
||||
return tags
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user