Files

55 lines
1.7 KiB
Go
Raw Permalink Normal View History

package meta
import "glchat/internal/config"
const APIVersion = "v1"
type Features struct {
RegistrationEnabled bool `json:"registration_enabled"`
AntiBotEnabled bool `json:"anti_bot_enabled"`
VoiceEnabled bool `json:"voice_enabled"`
// VoiceURL — адрес LiveKit для клиента (ws/wss), пусто при выключенном голосе.
VoiceURL string `json:"voice_url,omitempty"`
WebPushEnabled bool `json:"web_push_enabled"`
UnfurlEnabled bool `json:"unfurl_enabled"`
PasskeysEnabled bool `json:"passkeys_enabled"`
}
type Response struct {
Name string `json:"name"`
Version string `json:"version"`
Commit string `json:"commit"`
BuildDate string `json:"build_date"`
APIVersion string `json:"api_version"`
BaseURL string `json:"base_url"`
FilesURL string `json:"files_url"`
GatewayURL string `json:"gateway_url"`
RTCPath string `json:"rtc_path"`
MaxUploadSize int64 `json:"max_upload_size"`
Features Features `json:"features"`
}
func New(cfg config.Config) Response {
return Response{
Name: cfg.InstanceName,
Version: cfg.Version,
Commit: cfg.Commit,
BuildDate: cfg.BuildDate,
APIVersion: APIVersion,
BaseURL: cfg.BaseURL(),
FilesURL: cfg.FilesURL(),
GatewayURL: cfg.GatewayURL(),
RTCPath: "/rtc",
MaxUploadSize: cfg.MaxUploadSize,
Features: Features{
RegistrationEnabled: true,
AntiBotEnabled: false,
VoiceEnabled: cfg.VoiceEnabled(),
VoiceURL: cfg.LiveKitURL,
WebPushEnabled: cfg.WebPushEnabled(),
UnfurlEnabled: cfg.UnfurlEnabled,
PasskeysEnabled: cfg.WebAuthnEnabled(),
},
}
}