2022-05-12 15:41:39 +01:00
|
|
|
package websvc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"runtime"
|
|
|
|
|
|
|
|
"github.com/AdguardTeam/AdGuardHome/internal/version"
|
|
|
|
)
|
|
|
|
|
|
|
|
// System Handlers
|
|
|
|
|
|
|
|
// RespGetV1SystemInfo describes the response of the GET /api/v1/system/info
|
|
|
|
// HTTP API.
|
|
|
|
type RespGetV1SystemInfo struct {
|
|
|
|
Arch string `json:"arch"`
|
|
|
|
Channel string `json:"channel"`
|
|
|
|
OS string `json:"os"`
|
|
|
|
NewVersion string `json:"new_version,omitempty"`
|
2022-10-04 14:02:55 +01:00
|
|
|
Start JSONTime `json:"start"`
|
2022-05-12 15:41:39 +01:00
|
|
|
Version string `json:"version"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// handleGetV1SystemInfo is the handler for the GET /api/v1/system/info HTTP
|
|
|
|
// API.
|
|
|
|
func (svc *Service) handleGetV1SystemInfo(w http.ResponseWriter, r *http.Request) {
|
2022-10-04 14:02:55 +01:00
|
|
|
writeJSONOKResponse(w, r, &RespGetV1SystemInfo{
|
2022-05-12 15:41:39 +01:00
|
|
|
Arch: runtime.GOARCH,
|
|
|
|
Channel: version.Channel(),
|
|
|
|
OS: runtime.GOOS,
|
|
|
|
// TODO(a.garipov): Fill this when we have an updater.
|
|
|
|
NewVersion: "",
|
2022-10-04 14:02:55 +01:00
|
|
|
Start: JSONTime(svc.start),
|
2022-05-12 15:41:39 +01:00
|
|
|
Version: version.Version(),
|
|
|
|
})
|
|
|
|
}
|