Improve web interface. ()

This commit is contained in:
Antonio Navarro Perez 2021-01-02 20:09:05 +01:00 committed by GitHub
parent 7c94e663d8
commit ae289e99dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 2538 additions and 561 deletions
http

View file

@ -5,6 +5,7 @@ import (
"io"
"io/ioutil"
"net/http"
"sort"
"github.com/ajnavarro/distribyted/config"
"github.com/ajnavarro/distribyted/stats"
@ -26,8 +27,9 @@ var apiStatusHandler = func(fc *filecache.Cache, ss *stats.Torrent) gin.HandlerF
var apiRoutesHandler = func(ss *stats.Torrent) gin.HandlerFunc {
return func(ctx *gin.Context) {
stats := ss.RoutesStats()
ctx.JSON(http.StatusOK, stats)
s := ss.RoutesStats()
sort.Sort(stats.ByName(s))
ctx.JSON(http.StatusOK, s)
}
}