change to api, making WEB

Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-11 00:44:08 +03:00
1 parent 97dc183bdf
commit e7573fbcd0
6 files changed
+193 -22

No files matched your search

@@ -29,6 +29,9 @@ namespace Echoion::Api
struct BotConfig {
std::string botName = "Echoion";
std::string commandPrefix = "!";
// Default bot language ("en" or "ru"). Applies to users who have not
// picked a per-user language. Anything else normalises to "en".
std::string language = "en";
float defaultVolume = 0.5f;
uint32_t maxQueueSize = 100;
// How long the playback engine waits (emitting silence) for a
@@ -58,6 +61,27 @@ namespace Echoion::Api
std::string rpcBindAddress = "127.0.0.1";
};
// Browser web interface (EchoionWeb). Serves the static UI and hosts the
// independent sync-watch WebSocket. Bot control from the browser goes
// directly to the RPC server (network.rpcPort), not through this server.
struct WebConfig {
bool enabled = false;
uint16_t port = 8080;
std::string bindAddress = "127.0.0.1";
std::string webRoot = "./web";
// Explicit RPC WebSocket URL the browser should use. When empty the
// UI derives ws://<page-host>:<rpcPort> from the served config.
std::string rpcUrl;
// Public address users reach the web interface at (e.g.
// "https://bot.example.com"). Presentation only — !help links to
// it when set; serving is unaffected.
std::string publicUrl;
// Allow the Now Playing view to show the current song's video
// (muted, synced). Users can still disable it locally; this is
// the server-wide off switch, surfaced through /config.json.
bool nowPlayingVideo = true;
};
// Music source resolution chain. Default order tries the native
// innertube YouTube path and Yandex Music first, then falls back to
// (optionally proxied) yt-dlp last.
@@ -108,6 +132,9 @@ namespace Echoion::Api
std::chrono::milliseconds(3600000);
bool enableAuditLog = true;
std::optional<std::string> apiKey;
// Reserved, not currently honored: the web UI, /rpc bridge and /ws
// are all same-origin behind the web server, so no CORS headers are
// emitted anywhere.
bool allowCors = false;
std::vector<std::string> corsOrigins;
};
@@ -136,6 +163,10 @@ namespace Echoion::Api
std::string shuffleMode = "off";
std::string repeatMode = "off";
uint32_t maxHistorySize = 50;
// Vote-to-skip: votes needed to skip the current track.
// 0 = majority of online subscribers.
uint32_t voteSkipThreshold = 0;
};
// Advanced Settings
@@ -181,6 +212,7 @@ namespace Echoion::Api
FeaturesConfig features;
AdvancedConfig advanced;
AdminCredentials admin;
WebConfig web;
std::map<std::string, ConfigEntry> custom;
};