Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-15 19:49:57 +03:00
1 parent 01362d2e51
commit 39aff68d8d
29 files changed
+2061 -1818

No files matched your search

+20 -22
View File
@@ -12,12 +12,12 @@
#include <ConfigManager.hpp>
#include <ConfigTypes.hpp>
#include <CoreInterface.hpp>
#include <Void/Async/EventBus.hpp>
#include <Database.hpp>
#include <RpcTypes.hpp>
#include <StateBlob.hpp>
#include <TrackTypes.hpp>
#include <Types.hpp>
#include <Void/Async/EventBus.hpp>
#include <Void/Service/Registry.hpp>
#include <atomic>
#include <map>
@@ -35,7 +35,8 @@ namespace Void::Logging
namespace Echoion::Core
{
class ListeningRoomManager;
class PluginHost;
class TeamSpeakDirectoryService;
// Main Core implementation of ICoreInterface
class Core : public Api::ICoreInterface
@@ -169,10 +170,10 @@ namespace Echoion::Core
void setupEventBusSubscriptions() noexcept;
// Fetch an online client's avatar bytes (TS local cache, then the
// myTeamSpeak URL, then a legacy file-transfer download) and persist
// them — and the myTS URL — to the database keyed by uid. Returns
// {contentType, bytes} on success. Web-agnostic; used by both the
// avatar HTTP provider and the background warmer.
// myTeamSpeak URL, then a legacy file-transfer download) and
// persist them — and the myTS URL — to the database keyed by uid.
// Returns {contentType, bytes} on success. Web-agnostic; used by
// both the avatar HTTP provider and the background warmer.
[[nodiscard]] std::optional<std::pair<std::string, std::string>>
fetchClientAvatarBytes(const std::string& uid,
uint64_t clientId);
@@ -192,9 +193,9 @@ namespace Echoion::Core
std::shared_ptr<NetworkClient> networkClient_;
std::shared_ptr<LyricsService> lyricsService_;
std::shared_ptr<MusicManager> musicManager_;
std::shared_ptr<ListeningRoomManager> listeningRooms_;
std::string pendingListeningRoomState_;
std::unique_ptr<CommandManager> commandManager_;
std::shared_ptr<PluginHost> extensionPlugins_;
std::shared_ptr<TeamSpeakDirectoryService> directoryService_;
Api::PluginInterfacePtr pluginInterface_;
// State
@@ -210,12 +211,6 @@ namespace Echoion::Core
std::vector<Api::EventCallback> eventCallbacks_;
mutable std::mutex eventMutex_;
// Admin / DJ tracking (RPC clients whose TeamSpeak identity is in
// a configured teamspeak.adminGroups / djGroups server group).
std::vector<uint64_t> adminClients_;
std::vector<uint64_t> djClients_;
mutable std::mutex adminMutex_;
// Authenticated RPC client -> stable TS uid + nickname, resolved
// at token auth. Keys per-user features (favorites, vote-skip).
struct RpcIdentity {
@@ -226,10 +221,12 @@ namespace Echoion::Core
mutable std::mutex rpcIdentityMutex_;
[[nodiscard]] std::optional<RpcIdentity>
rpcIdentity(uint64_t clientId) const;
[[nodiscard]] bool hasLiveTeamSpeakRole(
uint64_t clientId,
const std::vector<uint64_t>& configuredGroups) const;
// Full identity behind an RPC token: uid, display nickname and
// admin standing. Shared by token auth, IP autologin and the
// watch-together identity resolver.
// admin standing. Shared by token auth and IP autologin.
struct TokenIdentity {
std::string uid;
std::string nickname;
@@ -238,8 +235,9 @@ namespace Echoion::Core
};
[[nodiscard]] std::optional<TokenIdentity>
identityForToken(const std::string& token);
// Mark an RPC connection authenticated as `identity` (auth set,
// admin list, per-client identity map).
// Mark an RPC connection authenticated as `identity` and retain its
// stable TeamSpeak identity. Roles are checked live for each
// request.
void registerRpcAuth(uint64_t clientId,
const TokenIdentity& identity);
// Guards RestartWebInterface against overlapping restarts.
@@ -249,7 +247,8 @@ namespace Echoion::Core
std::shared_ptr<Api::Database> database_;
// Background avatar cache warmer + the uids already cached this
// session (so we don't re-download an unchanged avatar every cycle).
// session (so we don't re-download an unchanged avatar every
// cycle).
std::jthread avatarWarmer_;
std::unordered_set<std::string> warmedUids_;
@@ -257,9 +256,8 @@ namespace Echoion::Core
std::shared_ptr<RpcServer> rpcServer_;
#ifdef ECHOION_WITH_WEB
// Browser web interface: serves the static UI and hosts the
// independent sync-watch WebSocket. Bot control from the browser
// goes straight to the RPC server, so this holds no bot handles.
// Browser web interface: serves the static dashboard and same-origin
// RPC bridge. Bot control still terminates at the RPC server.
std::shared_ptr<Web::HttpServer> webServer_;
#endif