66 lines
1.4 KiB
TypeScript
66 lines
1.4 KiB
TypeScript
// Maps the numeric RpcMethod enum value carried by audit-log entries to a
|
|
// human name. This mirrors the declaration order of `enum class RpcMethod`
|
|
// in EchoionApi/include/echoion/api/rpc/RpcTypes.hpp, which is explicitly
|
|
// append-only ("numeric values are server-internal and only need to stay
|
|
// self-consistent") — so index == enum value. When you append a method to
|
|
// that enum, append it here too.
|
|
const RPC_METHOD_BY_INDEX: readonly string[] = [
|
|
'Play', // 0
|
|
'Pause',
|
|
'Resume',
|
|
'Stop',
|
|
'Skip',
|
|
'Seek',
|
|
'SetVolume',
|
|
'QueueTrack',
|
|
'RemoveFromQueue',
|
|
'ClearQueue',
|
|
'GetQueue', // 10
|
|
'MoveInQueue',
|
|
'GetCurrentTrack',
|
|
'GetTrackInfo',
|
|
'SearchTracks',
|
|
'LoadPlaylist',
|
|
'SavePlaylist',
|
|
'GetPlaylists',
|
|
'DeletePlaylist',
|
|
'GetConfig',
|
|
'SetConfig', // 20
|
|
'ReloadConfig',
|
|
'GetStatus',
|
|
'HotReload',
|
|
'Shutdown',
|
|
'Authenticate',
|
|
'Logout',
|
|
'GetAuditLog',
|
|
'ManageUsers',
|
|
'GetServerInfo',
|
|
'RequestLoginToken', // 30
|
|
'ValidateLoginToken',
|
|
'ToggleShuffle',
|
|
'ToggleRepeat',
|
|
'ShuffleQueue',
|
|
'GetPlaylist',
|
|
'GetHistory',
|
|
'GetStats',
|
|
'GetFavorites',
|
|
'AddFavorite',
|
|
'RemoveFavorite', // 40
|
|
'VoteSkip',
|
|
'Announce',
|
|
'GetAggregateStats',
|
|
'AuthenticateByAddress',
|
|
'RestartWebInterface',
|
|
'ToggleAutoplay',
|
|
'GetUserPrefs',
|
|
'SetUserPrefs',
|
|
'GetCustomEmojis',
|
|
'AddCustomEmoji', // 50
|
|
'RemoveCustomEmoji',
|
|
'GetLyrics',
|
|
];
|
|
|
|
export function auditMethodName(method: number): string {
|
|
return RPC_METHOD_BY_INDEX[method] ?? `Method #${method}`;
|
|
}
|