VIDEO_ENABLED is now permission rather than behaviour: it decides whether the feature exists at all, while turning it on for a server is a toggle in the panel or !video in chat, off by default. Video costs real CPU for every playing channel, so that should be a deliberate choice rather than something a config flag switches on everywhere. With the env flag off the panel renders no toggle at all and !video says so, and the switch applies from the next track — swapping tracks mid-play would cut the current one. The loop button no longer reads "выкл" either: it sat next to the video button showing the same word, so the two states were indistinguishable. Both now name what they do and rely on highlighting for state. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
export type SourceKind = "youtube" | "soundcloud" | "direct" | "local";
|
|
export type LoopMode = "off" | "track" | "queue";
|
|
export type PlayerStatus = "idle" | "connecting" | "buffering" | "playing" | "paused";
|
|
|
|
export interface Track {
|
|
id: string;
|
|
title: string;
|
|
author: string | null;
|
|
duration: number;
|
|
isLive: boolean;
|
|
url: string;
|
|
thumbnail: string | null;
|
|
source: SourceKind;
|
|
requestedBy: { id: string; username: string };
|
|
}
|
|
|
|
export interface PlayerState {
|
|
serverId: string;
|
|
serverName: string | null;
|
|
voiceChannelId: string | null;
|
|
voiceChannelName: string | null;
|
|
status: PlayerStatus;
|
|
current: Track | null;
|
|
position: number;
|
|
queue: Track[];
|
|
history: Track[];
|
|
volume: number;
|
|
loop: LoopMode;
|
|
videoEnabled: boolean;
|
|
updatedAt: number;
|
|
}
|
|
|
|
export interface VoiceChannel {
|
|
id: string;
|
|
name: string;
|
|
}
|
|
|
|
export interface ServerRef {
|
|
id: string;
|
|
name: string;
|
|
iconUrl: string | null;
|
|
}
|
|
|
|
export interface Me {
|
|
user: { id: string; username: string };
|
|
servers: ServerRef[];
|
|
features: { localLibrary: boolean; requireListener: boolean; video: boolean };
|
|
}
|
|
|
|
export interface ServerStateResponse {
|
|
state: PlayerState;
|
|
voiceChannels: VoiceChannel[];
|
|
yourVoiceChannel: VoiceChannel | null;
|
|
canControl: boolean;
|
|
}
|