mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-13 18:15:38 +03:00
25918e56fa
Squashed commit of the following: commit 284190f748345c7556e60b67f051ec5f6f080948 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Dec 6 19:36:00 2023 +0300 all: sync with master; upd chlog
36 lines
1 KiB
Go
36 lines
1 KiB
Go
package websvc
|
|
|
|
import (
|
|
"net/http"
|
|
"runtime"
|
|
|
|
"github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
|
|
"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"`
|
|
Start aghhttp.JSONTime `json:"start"`
|
|
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) {
|
|
aghhttp.WriteJSONResponseOK(w, r, &RespGetV1SystemInfo{
|
|
Arch: runtime.GOARCH,
|
|
Channel: version.Channel(),
|
|
OS: runtime.GOOS,
|
|
// TODO(a.garipov): Fill this when we have an updater.
|
|
NewVersion: "",
|
|
Start: aghhttp.JSONTime(svc.start),
|
|
Version: version.Version(),
|
|
})
|
|
}
|