mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 00:55:09 -07:00
* [Server/Client/Protocol] Add developer staff role Introduce a Developer staff level (proto flag 32, DB admin bit 8) that sits between admin and moderator: no kick/ban/warn/report/admin powers, but gets server log access via a new developer command container family (GET_SERVER_STATS, VIEWLOG_HISTORY) and an idle-timeout exemption. - Protocol: IsDeveloper flag, developer_commands.proto envelope, Command_GetServerStats/Command_GetLogHistory, Response_GetServerStats, Command_AdjustMod.should_be_developer - Servatrice: fail-closed developer dispatcher, uptime snapshot handler, shared log history handler reuse, bit-8 DB mapping - Client: burgundy pawn/badge/labels/sort order, prepareDeveloperCommand, minimal Developer stats tab, log tab access, promote/demote actions Took 24 minutes Took 18 seconds * [Server/Client/Protocol] Address developer role review feedback Address ZeizaZach's review of the developer staff role: - Nudge the developer log query to exclude private chat and sender IPs (the ModeratorCommand path still sees everything). - Deduplicate Command_GetLogHistory into Command_ViewLogHistory, which now extends both ModeratorCommand (ext) and DeveloperCommand (dev_ext); the client picks the DeveloperCommand-scoped extension by extendee, and the server reads it via the extension number. - Pull the uptime snapshot SQL into Servatrice_DatabaseInterface as getLatestUptimeSnapshot() and widen the reported counters to 64-bit. - Document the admin bitfield (1 admin, 2 moderator, 4 judge, 8 developer) and add a server-side test for the developer command path. * Add missing trailing newline to user_context_menu.cpp * Remove stale includes of deleted command_get_log_history proto The Command_GetLogHistory message was folded into Command_ViewLogHistory, which deleted command_get_log_history.proto, but serversocketinterface still #included its generated header. Fresh CI builds fail on the missing file; local builds masked it by reusing a previously generated header. * [Server] Exclude chat rows when private-chat filter is bypassable A developer who omits log_location entirely — or sends only "chat" — leaves chatType, gameType, roomType all false, so getMessageLogHistory skips the target_type clause and returns every row, private messages included. When !allowPrivateChat the server now forces game+room when no surviving location was requested, guaranteeing the query always carries a target_type restriction. [Client] Demote mod+dev to moderator path in log-tab dispatch The developer command family is strictly weaker than the moderator one (no private chat, no sender_ip, ip filter ignored), so granting the developer bit to an existing moderator must not silently strip their capabilities. useDeveloperCommands is now true only when the user holds the developer bit and not the moderator bit. [Client] Hide the IP-address filter for developer log tab users The developer path ignores the ip_address query field server-side. Showing the field lets a developer type an IP and get results that are silently unfiltered by it rather than an empty result set — reads as a broken filter. Hide labelFindIPAddress/findIPAddress alongside the privateChat checkbox. * Developer pawn is silver. * [Client] Fix indentation of merged Card Art Rules / Developer tabs --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
91 lines
5.9 KiB
Protocol Buffer
91 lines
5.9 KiB
Protocol Buffer
syntax = "proto2";
|
||
|
||
/// Server response envelope linking to a command
|
||
/**
|
||
* This message is sent immediately after a client command, using the same `cmd_id`
|
||
* to connect the response to the command.
|
||
*
|
||
* Responses may contain standard outcome codes (`ResponseCode`) and indicate
|
||
* what type of response the server is sending (`ResponseType`).
|
||
*/
|
||
message Response {
|
||
|
||
// Outcome of the command sent by the client
|
||
enum ResponseCode {
|
||
RespNotConnected = -1; // Client is not connected or session expired
|
||
RespNothing = 0; // No response required
|
||
RespOk = 1; // Command succeeded
|
||
RespNotInRoom = 2; // Client is not in the room for this command
|
||
RespInternalError = 3; // Server encountered an unexpected error
|
||
RespInvalidCommand = 4; // Command was invalid or unrecognized
|
||
RespInvalidData = 5; // Command data was invalid or malformed
|
||
RespNameNotFound = 6; // Target user not found
|
||
RespLoginNeeded = 7; // Client must log in first
|
||
RespFunctionNotAllowed = 8; // Client tried to perform a restricted action
|
||
RespGameNotStarted = 9; // Game has not started yet
|
||
RespGameFull = 10; // Game is full
|
||
RespContextError = 11; // Context (room/game) mismatch
|
||
RespWrongPassword = 12; // Password for this room or game is incorrect
|
||
RespSpectatorsNotAllowed = 13; // Spectators are not allowed in this room/game
|
||
RespOnlyBuddies = 14; // Only buddies can perform this action
|
||
RespUserLevelTooLow = 15; // User’s permission level is insufficient
|
||
RespInIgnoreList = 16; // Target user has ignored the client
|
||
RespWouldOverwriteOldSession = 17; // Would overwrite an existing session
|
||
RespChatFlood = 18; // Too many messages sent in short time
|
||
RespUserIsBanned = 19; // Client is banned
|
||
RespAccessDenied = 20; // Access to this action is denied
|
||
RespUsernameInvalid = 21; // Username is invalid
|
||
RespRegistrationRequired = 22; // Registration is required
|
||
RespRegistrationAccepted = 23; // Server agrees to process client's registration request
|
||
RespUserAlreadyExists = 24; // Client attempted to register a name which is already registered
|
||
RespEmailRequiredToRegister = 25; // Server requires email to register accounts but client did not provide one
|
||
RespTooManyRequests = 26; // Server refused to complete command because client has sent too many too quickly
|
||
RespPasswordTooShort = 27; // Server requires a decent password
|
||
RespAccountNotActivated =
|
||
28; // Client attempted to log into a registered username but the account hasn't been activated
|
||
RespRegistrationDisabled = 29; // Server does not allow clients to register
|
||
RespRegistrationFailed = 30; // Server accepted a reg request but failed to perform the registration
|
||
RespActivationAccepted = 31; // Server accepted a reg user activation token
|
||
RespActivationFailed = 32; // Server didn't accept a reg user activation token
|
||
RespRegistrationAcceptedNeedsActivation =
|
||
33; // Server accepted client registration, but it will need token activation
|
||
RespClientIdRequired = 34; // Server requires client to generate and send its client id before allowing access
|
||
RespClientUpdateRequired = 35; // Client is missing features that the server is requiring
|
||
RespServerFull = 36; // Server user limit reached
|
||
RespEmailBlackListed = 37; // Server has blocked the email address provided for registration for some reason
|
||
RespPasswordChangeRequired = 38; // Server requires the user to change their password before proceeding
|
||
}
|
||
|
||
// Type of response, used to route handling on the client
|
||
enum ResponseType {
|
||
JOIN_ROOM = 1000; // Response for joining a room
|
||
LIST_USERS = 1001; // Response listing users
|
||
GET_GAMES_OF_USER = 1002; // Response with user's games
|
||
GET_USER_INFO = 1003; // Response with user info
|
||
DUMP_ZONE = 1004; // Response with zone dump
|
||
LOGIN = 1005; // Response to login attempt
|
||
DECK_LIST = 1006; // Response with deck list
|
||
DECK_DOWNLOAD = 1007; // Response for deck download
|
||
DECK_UPLOAD = 1008; // Response for deck upload
|
||
REGISTER = 1009; // Response to registration
|
||
ACTIVATE = 1010; // Response to activation
|
||
ADJUST_MOD = 1011; // Response to mod adjustments
|
||
BAN_HISTORY = 1012; // Response with ban history
|
||
WARN_HISTORY = 1013; // Response with warn history
|
||
WARN_LIST = 1014; // Response with current warnings
|
||
VIEW_LOG = 1015; // Response with logs
|
||
FORGOT_PASSWORD_REQUEST = 1016; // Response to password reset request
|
||
PASSWORD_SALT = 1017; // Response containing password salt
|
||
GET_ADMIN_NOTES = 1018; // Response with admin notes
|
||
GET_SERVER_STATS = 1019; // Response with server status statistics
|
||
REPLAY_LIST = 1100; // Response listing replays
|
||
REPLAY_DOWNLOAD = 1101; // Response for replay download
|
||
REPLAY_GET_CODE = 1102; // Response containing replay code
|
||
CARD_ART_RULE_LIST = 1200; // Response containing a list of card art rules
|
||
}
|
||
|
||
required uint64 cmd_id = 1; // Command ID that this response corresponds to
|
||
optional ResponseCode response_code = 2; // Outcome code of the command
|
||
|
||
extensions 100 to max; // Protobuf extensions reserved for future use
|
||
}
|