mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-10-21 19:41:59 +00:00
* chore: add .github/CODEOWNERS for main branch policy Signed-off-by: MrAlders0n <MrAlders0n@smal.ca> * chore: add .github/workflows/main-source-guard.yml for main branch policy Signed-off-by: MrAlders0n <MrAlders0n@smal.ca> * feat(meshmapper): authenticate API imports (#211) * feat(observers): add traffic-sorted directory (#212) * fix(observers): rank available traffic over rolling seven days * chore: bump version to 2.1.0 * chore: set release version to 2.0.2 * feat(api): add /info with mobile min app version (#214) * chore: bump version to 2.0.3 --------- Signed-off-by: MrAlders0n <MrAlders0n@smal.ca>
35 lines
883 B
Go
35 lines
883 B
Go
// Copyright 2026 Beacon Contributors
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/MeshCore-Beacon/beacon-server/internal/api"
|
|
"github.com/go-chi/chi/v5"
|
|
)
|
|
|
|
// InfoRouter mounts GET /info. The mobile app treats a 404 as "no requirement",
|
|
// so this route must stay mounted once shipped.
|
|
func InfoRouter(info api.Info) http.Handler {
|
|
r := chi.NewRouter()
|
|
r.Get("/", getInfo(info))
|
|
return r
|
|
}
|
|
|
|
// getInfo godoc
|
|
//
|
|
// @Summary Server info and minimum mobile app version
|
|
// @Description minAppVersion is null when the server sets no requirement.
|
|
// @Tags Info
|
|
// @Produce json
|
|
// @Success 200 {object} api.Info
|
|
// @Router /info [get]
|
|
func getInfo(info api.Info) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Cache-Control", "no-cache")
|
|
respond(w, http.StatusOK, info)
|
|
}
|
|
}
|