2026-09-19 18:20:56 +03:00
|
|
|
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"`
|
2026-09-20 18:04:59 +03:00
|
|
|
// VoiceURL — адрес LiveKit для клиента (ws/wss), пусто при выключенном голосе.
|
|
|
|
|
VoiceURL string `json:"voice_url,omitempty"`
|
|
|
|
|
WebPushEnabled bool `json:"web_push_enabled"`
|
|
|
|
|
OAuthEnabled bool `json:"oauth_enabled"`
|
|
|
|
|
PasskeysEnabled bool `json:"passkeys_enabled"`
|
2026-09-19 18:20:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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(),
|
2026-09-19 19:58:32 +03:00
|
|
|
GatewayURL: cfg.GatewayURL(),
|
2026-09-19 18:20:56 +03:00
|
|
|
RTCPath: "/rtc",
|
|
|
|
|
MaxUploadSize: cfg.MaxUploadSize,
|
|
|
|
|
Features: Features{
|
|
|
|
|
RegistrationEnabled: true,
|
|
|
|
|
AntiBotEnabled: false,
|
2026-09-20 18:04:59 +03:00
|
|
|
VoiceEnabled: cfg.VoiceEnabled(),
|
|
|
|
|
VoiceURL: cfg.LiveKitURL,
|
2026-09-19 18:20:56 +03:00
|
|
|
WebPushEnabled: false,
|
|
|
|
|
OAuthEnabled: false,
|
2026-09-26 15:12:43 +03:00
|
|
|
PasskeysEnabled: cfg.WebAuthnEnabled(),
|
2026-09-19 18:20:56 +03:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|