mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-20 17:09:54 +01:00
Handlers live in <tag>_handlers.go, so the package grows by tag rather than by endpoint, and shared convention helpers keep plain names without clashing with tag files. Signed-off-by: Deluan <deluan@navidrome.org>
30 lines
861 B
Go
30 lines
861 B
Go
package apiv1
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/navidrome/navidrome/api"
|
|
"github.com/navidrome/navidrome/consts"
|
|
)
|
|
|
|
func (rt *Router) GetServerInfo(ctx context.Context, _ GetServerInfoRequestObject) (GetServerInfoResponseObject, error) {
|
|
count, err := rt.ds.User().CountAll(ctx)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("counting users: %w", err)
|
|
}
|
|
return GetServerInfo200JSONResponse{
|
|
Name: "Navidrome",
|
|
ServerVersion: consts.Version,
|
|
SpecVersion: api.SpecVersion(),
|
|
SetupRequired: count == 0,
|
|
LoginMethods: LoginMethods{Password: &PasswordLoginMethod{}},
|
|
}, nil
|
|
}
|
|
|
|
func (rt *Router) GetCapabilities(context.Context, GetCapabilitiesRequestObject) (GetCapabilitiesResponseObject, error) {
|
|
return GetCapabilities200JSONResponse{
|
|
Core: &CoreCapability{Version: 1},
|
|
Password: &PasswordCapability{Version: 1},
|
|
}, nil
|
|
}
|