1 parent
24075fbd52
commit
caac928923
5 files changed
+131
-9
No files matched your search
@@ -72,8 +72,8 @@ namespace Echoion::Api
|
||||
// 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.
|
||||
// "https://bot.example.com"). Required by the internal URL
|
||||
// shortener and also used by !help when set; serving is unaffected.
|
||||
std::string publicUrl;
|
||||
// External VoidWatch deployment. Echoion only presents this link
|
||||
// and redirects the retired local /watch entrypoint to it.
|
||||
@@ -82,6 +82,22 @@ namespace Echoion::Api
|
||||
// (muted, synced). Users can still disable it locally; this is
|
||||
// the server-wide off switch, surfaced through /config.json.
|
||||
bool nowPlayingVideo = true;
|
||||
// Forwarded client addresses are trusted only when the immediate
|
||||
// peer belongs to one of these IPv4/IPv6 CIDRs. Empty is safest and
|
||||
// ignores X-Forwarded-For entirely.
|
||||
std::vector<std::string> trustedProxyCidrs;
|
||||
};
|
||||
|
||||
struct UrlShorteningConfig {
|
||||
bool enabled = false;
|
||||
std::string provider = "url-shortener-internal";
|
||||
std::vector<std::string> sources = {"youtube"};
|
||||
std::chrono::milliseconds timeout = std::chrono::milliseconds(3000);
|
||||
};
|
||||
|
||||
struct PluginsConfig {
|
||||
// Empty resolves to a plugins.d directory beside the main config.
|
||||
std::string configDirectory;
|
||||
};
|
||||
|
||||
// Music source resolution chain. Default order tries the native
|
||||
@@ -181,6 +197,71 @@ namespace Echoion::Api
|
||||
uint32_t tempCleanupInterval = 3600; // seconds
|
||||
};
|
||||
|
||||
// Component updater. Runtime means the complete relocatable daemon bundle,
|
||||
// not only the echoiond ELF. Core and managed extension plugins may use
|
||||
// independent channels, but the updater still enforces the compatibility
|
||||
// metadata carried by the selected feed releases.
|
||||
struct UpdatePublicKey {
|
||||
std::string id;
|
||||
std::string ed25519;
|
||||
};
|
||||
|
||||
struct UpdateSourceConfig {
|
||||
// Empty is only meaningful for the built-in "official" source and
|
||||
// resolves to the URL injected by the release build.
|
||||
std::string url;
|
||||
std::vector<UpdatePublicKey> publicKeys;
|
||||
bool allowUnsigned = false;
|
||||
// Environment variable name only. Secret values are never
|
||||
// persisted.
|
||||
std::string bearerTokenEnv;
|
||||
};
|
||||
|
||||
struct UpdateComponentConfig {
|
||||
bool enabled = true;
|
||||
std::string source = "official";
|
||||
std::string channel = "stable";
|
||||
bool autoApply = true;
|
||||
};
|
||||
|
||||
struct PluginUpdateOverride {
|
||||
std::string source = "official";
|
||||
std::string channel = "stable";
|
||||
bool autoApply = true;
|
||||
};
|
||||
|
||||
struct PluginUpdatesConfig {
|
||||
bool enabled = true;
|
||||
std::string source = "official";
|
||||
std::string channel = "stable";
|
||||
bool autoApply = true;
|
||||
bool managedOnly = true;
|
||||
std::map<std::string, PluginUpdateOverride> overrides;
|
||||
};
|
||||
|
||||
struct UpdateMaintenanceWindow {
|
||||
// HH:MM in UTC. The updater validates the value before saving it.
|
||||
std::string start = "03:00";
|
||||
std::chrono::milliseconds duration = std::chrono::hours(2);
|
||||
};
|
||||
|
||||
struct UpdatesConfig {
|
||||
bool enabled = true;
|
||||
std::chrono::milliseconds checkInterval = std::chrono::hours(6);
|
||||
std::chrono::milliseconds jitter = std::chrono::minutes(30);
|
||||
UpdateMaintenanceWindow maintenanceWindowUtc;
|
||||
std::chrono::milliseconds maxRuntimeDeferral =
|
||||
std::chrono::hours(24);
|
||||
// Number of previous healthy versions retained in addition to
|
||||
// active.
|
||||
uint32_t retainHealthyVersions = 2;
|
||||
std::map<std::string, UpdateSourceConfig> sources = {
|
||||
{"official", UpdateSourceConfig{}}};
|
||||
UpdateComponentConfig runtime;
|
||||
UpdateComponentConfig core;
|
||||
PluginUpdatesConfig plugins;
|
||||
};
|
||||
|
||||
// Connection settings passed across the Echoion host interface.
|
||||
struct ServerConfig {
|
||||
std::string address;
|
||||
@@ -213,6 +294,9 @@ namespace Echoion::Api
|
||||
SecurityConfig security;
|
||||
FeaturesConfig features;
|
||||
AdvancedConfig advanced;
|
||||
UpdatesConfig updates;
|
||||
UrlShorteningConfig urlShortening;
|
||||
PluginsConfig plugins;
|
||||
AdminCredentials admin;
|
||||
WebConfig web;
|
||||
std::map<std::string, ConfigEntry> custom;
|
||||
|
||||
@@ -158,6 +158,19 @@ namespace Echoion::Api
|
||||
// on the new Core (state-transfer corruption on hot reload). Only
|
||||
// ever add new virtuals at the very end.
|
||||
virtual Result<void> reloadConfig() = 0;
|
||||
|
||||
// Managed extension reconciliation for the host updater. The
|
||||
// request and response are versioned JSON documents so the plugin
|
||||
// package format can evolve without exposing Core implementation
|
||||
// types here. Append-only ABI: do not move this entry above
|
||||
// existing methods.
|
||||
[[nodiscard]] virtual Result<std::string>
|
||||
managePluginsJson(const std::string& /*requestJson*/)
|
||||
{
|
||||
return fail(
|
||||
ErrorCode::NotSupported,
|
||||
"managed plugin updates are not supported by this Core");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Echoion::Api
|
||||
@@ -195,6 +195,19 @@ namespace Echoion::Api
|
||||
registerEventCallback(const EventCallback& callback) = 0;
|
||||
virtual void
|
||||
unregisterEventCallback(const EventCallback& callback) = 0;
|
||||
|
||||
// Host-owned control plane. Keep this generic JSON operation at the
|
||||
// very end of the ABI so updater/service operations can evolve
|
||||
// without shifting existing vtable entries. Hosts that do not
|
||||
// expose a control plane retain the previous behavior through this
|
||||
// default.
|
||||
[[nodiscard]] virtual Result<std::string>
|
||||
hostControl(const std::string& /*method*/,
|
||||
const std::string& /*requestJson*/)
|
||||
{
|
||||
return fail(ErrorCode::NotSupported,
|
||||
"host control is not supported by this host");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Echoion::Api
|
||||
@@ -117,7 +117,16 @@ namespace Echoion::Api
|
||||
RemoveTeamSpeakServerGroupMember,
|
||||
SendTeamSpeakPrivateMessage,
|
||||
SendTeamSpeakChannelMessage,
|
||||
SendTeamSpeakServerMessage
|
||||
SendTeamSpeakServerMessage,
|
||||
|
||||
// Component updater (append-only; values 89-95).
|
||||
GetUpdateStatus,
|
||||
GetUpdateConfig,
|
||||
SetUpdateConfig,
|
||||
CheckForUpdates,
|
||||
ApplyUpdate,
|
||||
RollbackUpdate,
|
||||
ConfirmUnsignedUpdate
|
||||
};
|
||||
|
||||
struct RpcRequest {
|
||||
|
||||
@@ -21,7 +21,10 @@ namespace Echoion::Api
|
||||
URL,
|
||||
// Appended after URL so existing uint8_t-serialized history rows
|
||||
// keep their meaning.
|
||||
Yandex
|
||||
Yandex,
|
||||
// Media returned by an extension plugin. Keep this distinct from
|
||||
// Unknown so source allowlists never have to permit unknown values.
|
||||
Plugin
|
||||
};
|
||||
|
||||
struct TrackInfo {
|
||||
@@ -34,15 +37,15 @@ namespace Echoion::Api
|
||||
TrackSource source;
|
||||
std::string originalUrl;
|
||||
std::optional<std::string>
|
||||
shortenedUrl; // faumaray.ru shortened link
|
||||
shortenedUrl; // provider-generated public link
|
||||
std::optional<std::string> streamUrl;
|
||||
std::optional<AudioStreamInfo> audioInfo;
|
||||
std::chrono::system_clock::time_point addedAt;
|
||||
std::string requestedBy;
|
||||
|
||||
// Format track as markdown link: [Title](shortenedUrl)
|
||||
// Only uses shortened URL (faumaray), returns empty string if not
|
||||
// available
|
||||
// Only uses a successfully generated shortened URL; returns no link
|
||||
// if unavailable.
|
||||
[[nodiscard]] std::string formatWithLink() const
|
||||
{
|
||||
if (shortenedUrl.has_value() && !shortenedUrl->empty()) {
|
||||
@@ -53,8 +56,8 @@ namespace Echoion::Api
|
||||
}
|
||||
|
||||
// Format track with artist and link
|
||||
// Only uses shortened URL (faumaray), returns text only if not
|
||||
// available
|
||||
// Only uses a successfully generated shortened URL; returns text if
|
||||
// unavailable.
|
||||
[[nodiscard]] std::string formatWithArtistAndLink() const
|
||||
{
|
||||
std::string displayTitle = title;
|
||||
|
||||
Reference in new issue
Block a user