1 parent
d146f11f02
commit
5c036d91fb
72 files changed
+5875
-1243
No files matched your search
@@ -73,10 +73,18 @@ namespace Echoion::Core::Dto
|
||||
};
|
||||
|
||||
struct ManageUsersRequest {
|
||||
std::string action; // "list" | "remove"
|
||||
std::string action; // "list" | "remove" | "clearAll"
|
||||
std::optional<std::string> uid;
|
||||
};
|
||||
|
||||
struct UrlRequest {
|
||||
std::string url;
|
||||
};
|
||||
|
||||
struct AnnounceRequest {
|
||||
std::string text;
|
||||
};
|
||||
|
||||
// ── RPC handler responses ───────────────────────────────────────────────
|
||||
|
||||
struct Track {
|
||||
@@ -88,6 +96,9 @@ namespace Echoion::Core::Dto
|
||||
int source = 0;
|
||||
std::optional<std::string> thumbnailUrl;
|
||||
std::optional<std::string> url; // originalUrl (play-by-url)
|
||||
// Shortened faumaray.ru link when available; the web UI prefers
|
||||
// it for "open original link" (falls back to url).
|
||||
std::optional<std::string> shortenedUrl;
|
||||
};
|
||||
|
||||
[[nodiscard]] inline Track toTrack(const Api::TrackInfo& t)
|
||||
@@ -104,7 +115,28 @@ namespace Echoion::Core::Dto
|
||||
.thumbnailUrl = t.thumbnailUrl,
|
||||
.url = t.originalUrl.empty()
|
||||
? std::nullopt
|
||||
: std::optional(t.originalUrl)};
|
||||
: std::optional(t.originalUrl),
|
||||
.shortenedUrl =
|
||||
t.shortenedUrl && !t.shortenedUrl->empty()
|
||||
? t.shortenedUrl
|
||||
: std::nullopt};
|
||||
}
|
||||
|
||||
// Inverse of toTrack (client-supplied tracks, e.g. AddFavorite).
|
||||
[[nodiscard]] inline Api::TrackInfo fromTrack(const Track& t)
|
||||
{
|
||||
Api::TrackInfo info;
|
||||
info.id = t.id;
|
||||
info.title = t.title;
|
||||
info.artist = t.artist;
|
||||
info.album = t.album;
|
||||
if (t.duration) {
|
||||
info.duration = std::chrono::milliseconds(*t.duration);
|
||||
}
|
||||
info.source = static_cast<Api::TrackSource>(t.source);
|
||||
info.thumbnailUrl = t.thumbnailUrl;
|
||||
info.originalUrl = t.url.value_or("");
|
||||
return info;
|
||||
}
|
||||
|
||||
struct QueueItem {
|
||||
@@ -127,6 +159,12 @@ namespace Echoion::Core::Dto
|
||||
float volume = 0.0f;
|
||||
bool repeat = false;
|
||||
bool shuffle = false;
|
||||
// Radio mode: auto-enqueue related tracks when the queue runs dry.
|
||||
bool autoplay = false;
|
||||
// Vote-skip state for the current track (additive fields).
|
||||
std::uint32_t skipVotes = 0;
|
||||
std::uint32_t skipVotesNeeded = 0;
|
||||
bool skipVoted = false;
|
||||
};
|
||||
|
||||
struct Success {
|
||||
@@ -143,6 +181,37 @@ namespace Echoion::Core::Dto
|
||||
float volume = 0.0f;
|
||||
};
|
||||
|
||||
struct Autoplay {
|
||||
bool autoplay = false;
|
||||
};
|
||||
|
||||
// Per-user preferences stored in the kv store; `language` shares the
|
||||
// "lang:<uid>" key with the !lang chat command so the web switcher and
|
||||
// the bot stay in sync.
|
||||
struct UserPrefs {
|
||||
std::string language;
|
||||
};
|
||||
|
||||
// Custom emoji metadata (name + mime); the image itself is served at
|
||||
// GET /emoji/<name>, not inlined here.
|
||||
struct CustomEmojiDto {
|
||||
std::string name;
|
||||
std::string mime;
|
||||
std::string addedBy;
|
||||
};
|
||||
struct CustomEmojiList {
|
||||
std::vector<CustomEmojiDto> emojis;
|
||||
};
|
||||
// AddCustomEmoji request: name + mime + base64-encoded image bytes.
|
||||
struct AddEmojiRequest {
|
||||
std::string name;
|
||||
std::string mime;
|
||||
std::string dataBase64;
|
||||
};
|
||||
struct EmojiNameRequest {
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct QueuedResponse {
|
||||
bool success = true;
|
||||
std::uint64_t queueId = 0;
|
||||
@@ -192,6 +261,13 @@ namespace Echoion::Core::Dto
|
||||
std::uint32_t connectedClients = 0;
|
||||
std::uint32_t subscribers = 0;
|
||||
std::uint32_t queueLength = 0;
|
||||
std::uint32_t onlineSubscribers = 0;
|
||||
// Nicknames behind onlineSubscribers, so non-admin clients can
|
||||
// render a "listening now" list without the admin user API.
|
||||
std::vector<std::string> onlineSubscriberNames;
|
||||
// TeamSpeak uids parallel to onlineSubscriberNames (same order), so
|
||||
// the web UI can fetch each listener's avatar at /avatar/<uid>.
|
||||
std::vector<std::string> onlineSubscriberUids;
|
||||
};
|
||||
|
||||
struct AuditEntryDto {
|
||||
@@ -207,12 +283,77 @@ namespace Echoion::Core::Dto
|
||||
struct SubscriberDto {
|
||||
std::string uid;
|
||||
std::string nickname;
|
||||
bool online = false;
|
||||
};
|
||||
|
||||
struct UsersResponse {
|
||||
std::vector<SubscriberDto> users;
|
||||
};
|
||||
|
||||
// Authenticate success. isAdmin/isDj/uid/nickname are additive — older
|
||||
// clients that only read `message` keep working.
|
||||
struct AuthSuccess {
|
||||
bool success = true;
|
||||
std::string message;
|
||||
bool isAdmin = false;
|
||||
bool isDj = false;
|
||||
std::string uid;
|
||||
std::string nickname;
|
||||
// Set by address-based autologin so the client can persist the
|
||||
// session token it never typed; empty for normal token auth.
|
||||
std::string token;
|
||||
};
|
||||
|
||||
struct AddFavoriteRequest {
|
||||
Track track;
|
||||
};
|
||||
|
||||
struct FavoritesResponse {
|
||||
std::vector<Track> tracks;
|
||||
};
|
||||
|
||||
// GetLyrics response: plain text plus, when available, time-synced lines
|
||||
// (ms offset from track start) so the web UI can highlight the active line.
|
||||
struct LyricsLineDto {
|
||||
std::int64_t ms = 0;
|
||||
std::string text;
|
||||
};
|
||||
|
||||
struct LyricsResponse {
|
||||
bool found = false;
|
||||
std::string plain;
|
||||
std::vector<LyricsLineDto> synced;
|
||||
std::string source; // "lrclib" when resolved
|
||||
std::string title;
|
||||
std::string artist;
|
||||
};
|
||||
|
||||
struct VoteSkipResponse {
|
||||
std::uint32_t votes = 0;
|
||||
std::uint32_t needed = 0;
|
||||
bool voted = false;
|
||||
bool skipped = false;
|
||||
};
|
||||
|
||||
struct RequesterDto {
|
||||
std::string uid;
|
||||
std::string nickname;
|
||||
std::uint64_t count = 0;
|
||||
};
|
||||
|
||||
struct AggregateStatsResponse {
|
||||
std::uint64_t tracksToday = 0;
|
||||
std::uint64_t listeningMsToday = 0;
|
||||
std::uint64_t queueAdditionsToday = 0;
|
||||
std::uint64_t skipsToday = 0;
|
||||
std::uint64_t playsTotal = 0;
|
||||
std::uint64_t skipsTotal = 0;
|
||||
std::vector<RequesterDto> topRequesters;
|
||||
std::uint64_t youtubeCount = 0;
|
||||
std::uint64_t yandexCount = 0;
|
||||
std::uint64_t otherCount = 0;
|
||||
};
|
||||
|
||||
// ── Event-broadcast payloads ────────────────────────────────────────────
|
||||
|
||||
struct TrackBrief {
|
||||
|
||||
Reference in new issue
Block a user