[Protocol] Add moderation investigation commands

Adds the protocol layer for the moderation investigation suite:
- Command_GetUserSessions/GetUserAlts/GetModeratorLastLogins/ResetUserPassword/RemoveUserAvatar (1013-1017)
- Response extensions 1215-1219 with ServerInfo messages for sessions, alts, and staff logins
- last_login on Response_ReportUserInfo and warning_il on Response_WarnList

Took 2 minutes
This commit is contained in:
Lukas Brübach 2026-08-11 21:10:32 +02:00
parent b4bf871811
commit 2b63bc46a7
12 changed files with 145 additions and 0 deletions

View file

@ -156,6 +156,11 @@ set(PROTO_FILES
response_report_my_list.proto response_report_my_list.proto
response_report_stats.proto response_report_stats.proto
response_report_user_info.proto response_report_user_info.proto
response_moderator_last_logins.proto
response_remove_user_avatar.proto
response_reset_user_password.proto
response_user_alts.proto
response_user_sessions.proto
response_viewlog_history.proto response_viewlog_history.proto
response_warn_history.proto response_warn_history.proto
response_warn_list.proto response_warn_list.proto
@ -171,6 +176,7 @@ set(PROTO_FILES
serverinfo_deckstorage.proto serverinfo_deckstorage.proto
serverinfo_game.proto serverinfo_game.proto
serverinfo_gametype.proto serverinfo_gametype.proto
serverinfo_moderator_login.proto
serverinfo_player.proto serverinfo_player.proto
serverinfo_playerping.proto serverinfo_playerping.proto
serverinfo_playerproperties.proto serverinfo_playerproperties.proto
@ -179,6 +185,8 @@ set(PROTO_FILES
serverinfo_report.proto serverinfo_report.proto
serverinfo_room.proto serverinfo_room.proto
serverinfo_user.proto serverinfo_user.proto
serverinfo_user_alt.proto
serverinfo_user_session.proto
serverinfo_warning.proto serverinfo_warning.proto
serverinfo_zone.proto serverinfo_zone.proto
session_commands.proto session_commands.proto

View file

@ -14,6 +14,11 @@ message ModeratorCommand {
ADD_CARD_ART_RULE = 1010; ADD_CARD_ART_RULE = 1010;
REMOVE_CARD_ART_RULE = 1011; REMOVE_CARD_ART_RULE = 1011;
LIST_CARD_ART_RULES = 1012; LIST_CARD_ART_RULES = 1012;
GET_USER_SESSIONS = 1013;
GET_USER_ALTS = 1014;
GET_MODERATOR_LAST_LOGINS = 1015;
RESET_USER_PASSWORD = 1016;
REMOVE_USER_AVATAR = 1017;
REPORT_LIST = 1200; REPORT_LIST = 1200;
REPORT_ASSIGN = 1201; REPORT_ASSIGN = 1201;
REPORT_RESOLVE = 1202; REPORT_RESOLVE = 1202;
@ -141,3 +146,38 @@ message Command_ListCardArtRules {
optional Command_ListCardArtRules ext = 1012; optional Command_ListCardArtRules ext = 1012;
} }
} }
message Command_GetUserSessions {
extend ModeratorCommand {
optional Command_GetUserSessions ext = 1013;
}
optional string user_name = 1;
optional uint32 limit = 2 [default = 110];
}
message Command_GetUserAlts {
extend ModeratorCommand {
optional Command_GetUserAlts ext = 1014;
}
optional string user_name = 1;
}
message Command_GetModeratorLastLogins {
extend ModeratorCommand {
optional Command_GetModeratorLastLogins ext = 1015;
}
}
message Command_ResetUserPassword {
extend ModeratorCommand {
optional Command_ResetUserPassword ext = 1016;
}
optional string user_name = 1;
}
message Command_RemoveUserAvatar {
extend ModeratorCommand {
optional Command_RemoveUserAvatar ext = 1017;
}
optional string user_name = 1;
}

View file

@ -0,0 +1,10 @@
syntax = "proto2";
import "response.proto";
import "serverinfo_moderator_login.proto";
message Response_ModeratorLastLogins {
extend Response {
optional Response_ModeratorLastLogins ext = 1217;
}
repeated ServerInfo_ModeratorLogin logins = 1;
}

View file

@ -0,0 +1,9 @@
syntax = "proto2";
import "response.proto";
message Response_RemoveUserAvatar {
extend Response {
optional Response_RemoveUserAvatar ext = 1219;
}
optional string user_name = 1;
}

View file

@ -16,4 +16,6 @@ message Response_ReportUserInfo {
optional bool is_active = 7; optional bool is_active = 7;
optional string admin_notes = 8; optional string admin_notes = 8;
repeated ServerInfo_Report recent_reports = 9; repeated ServerInfo_Report recent_reports = 9;
// Last known login of the user, epoch seconds; 0 = unknown.
optional int64 last_login = 10;
} }

View file

@ -0,0 +1,12 @@
syntax = "proto2";
import "response.proto";
message Response_ResetUserPassword {
extend Response {
optional Response_ResetUserPassword ext = 1218;
}
optional string user_name = 1;
// The generated temporary password, shown to the moderator who
// requested the reset. The affected user must change it on first login.
optional string temporary_password = 2;
}

View file

@ -0,0 +1,10 @@
syntax = "proto2";
import "response.proto";
import "serverinfo_user_alt.proto";
message Response_UserAlts {
extend Response {
optional Response_UserAlts ext = 1216;
}
repeated ServerInfo_UserAlt alts = 1;
}

View file

@ -0,0 +1,10 @@
syntax = "proto2";
import "response.proto";
import "serverinfo_user_session.proto";
message Response_UserSessions {
extend Response {
optional Response_UserSessions ext = 1215;
}
repeated ServerInfo_UserSession sessions = 1;
}

View file

@ -8,4 +8,7 @@ message Response_WarnList {
repeated string warning = 1; repeated string warning = 1;
optional string user_name = 2; optional string user_name = 2;
optional string user_clientid = 3; optional string user_clientid = 3;
// Recommended starting intervention level per warning category,
// aligned by index with `warning`. Absent or shorter lists default to 1.
repeated uint32 warning_il = 4;
} }

View file

@ -0,0 +1,11 @@
syntax = "proto2";
/**
* The last login date of a staff member (moderator/judge/admin).
* Used by the moderation "Moderator Last Logins" tool.
*/
message ServerInfo_ModeratorLogin {
optional string user_name = 1; // staff account name
optional uint64 last_login = 2; // last known login, epoch seconds; 0 = unknown
optional uint32 user_level = 3; // ServerInfo_User::UserLevelFlag mask (moderator/judge/admin)
}

View file

@ -0,0 +1,16 @@
syntax = "proto2";
/**
* An account that shares an IP address, client id or eMail address with
* the account being investigated. Used by the moderation "Get User Alts" tool.
*/
message ServerInfo_UserAlt {
optional string user_name = 1; // account name
optional string email = 2; // registration eMail
optional string clientid = 3; // client id
optional uint64 registration_time = 4; // account registration, epoch seconds
optional uint64 last_login = 5; // last known login, epoch seconds; 0 = unknown
optional uint32 warn_count = 6; // number of warnings on record
optional uint32 ban_count = 7; // number of bans on record
optional bool is_active = 8; // account is not deactivated/banned
}

View file

@ -0,0 +1,14 @@
syntax = "proto2";
/**
* A single login session of a user on the server, as stored in the
* sessions table. Used by the moderation "Get User Sessions" tool.
*/
message ServerInfo_UserSession {
optional string user_name = 1; // account that was logged in
optional string ip_address = 2; // IP address used for the session
optional string clientid = 3; // client id used for the session
optional uint64 start_time = 4; // session start, epoch seconds
optional uint64 end_time = 5; // session end, epoch seconds; 0 = still active
optional string connection_type = 6; // "tcp" or "websocket"
}