]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
vote master: support player ID (pubkey) authentication
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 12 Apr 2025 11:29:43 +0000 (21:29 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 3 May 2025 08:24:56 +0000 (18:24 +1000)
commands.cfg
qcsrc/common/checkextension.qc
qcsrc/server/client.qc
qcsrc/server/command/vote.qh
qcsrc/server/world.qc

index c1392b0943c6ae19bbdd141ae37280de70a9b943..12595678861b0419055a55290da622e2b811b5b4 100644 (file)
@@ -386,6 +386,7 @@ set sv_vote_limit 160 "maximum allowed length of a vote command"
 set sv_vote_master_commands "movetored movetoblue movetoyellow movetopink movetospec" "extra commands which vote masters can execute by themselves, along with the normal sv_vote_commands" // maybe add kickban here (but then sv_vote_master 0)
 set sv_vote_master 0   "allows the use of the vote master system"
 set sv_vote_master_callable 0 "when set, users can use \"vmaster\" to call a vote to become master of voting commands"
+set sv_vote_master_ids "" "space-separated list of player IDs (signed public key fingerprints) which will be logged in as master automatically"
 set sv_vote_master_password "" "when set, users can use \"vlogin PASSWORD\" to log in as master, then run master commands directly using vdo"
 set sv_vote_master_playerlimit 2 "minimum number of players needed for a player to be allowed to vote for master"
 set sv_vote_no_stops_vote 1 "allow the vote caller to stop their own vote simply by voting no"
index 9f10501ef73d3d0352d841679379c9f419a00db6..9ff685d7d3df064225500b9220e85a2bde560d77 100644 (file)
@@ -36,7 +36,7 @@ void CheckEngineExtensions(void)
                LOG_WARN("Engine lacks HTTP support, XonStat and map downloads are unavailable.");
 
        if (!checkextension("DP_CRYPTO"))
-               LOG_WARN("Engine lacks DP_CRYPTO, Player IDs (required for XonStat and CTS/CTF records) are unavailable.");
+               LOG_WARN("Engine lacks DP_CRYPTO, Player IDs (required for XonStat, CTS/CTF records and pubkey authentication) are unavailable.");
 
 #ifdef SVQC // change to GAMEQC if/when we use nudgeoutofsolid in CSQC
        if (checkextension("DP_QC_NUDGEOUTOFSOLID"))
index 5367d48fe4ad044d95a937d3319333ffd9323df0..664855fed86c211e498cd0cd398eaec10388a4cc 100644 (file)
@@ -1238,6 +1238,11 @@ void ClientConnect(entity this)
 
        if (get_nextmap() != "")
                Send_NextMap_To_Player(this);
+
+       // cvar hook/callback TODO: recheck this when the cvar is changed
+       if (autocvar_sv_vote_master_ids != "" && this.crypto_idfp_signed)
+               if (strstrofs(autocvar_sv_vote_master_ids, this.crypto_idfp, 0) >= 0)
+                       this.vote_master = true;
 }
 
 .string shootfromfixedorigin;
index 98dec6b7d3bd56a3e31291bf2207ef13d960c68d..47b6417c6a0092e876116d45d4727f381df1712a 100644 (file)
@@ -11,6 +11,7 @@ float autocvar_sv_vote_majority_factor_of_voted;
 bool autocvar_sv_vote_master;
 bool autocvar_sv_vote_master_callable;
 string autocvar_sv_vote_master_commands;
+string autocvar_sv_vote_master_ids;
 string autocvar_sv_vote_master_password;
 int autocvar_sv_vote_master_playerlimit;
 bool autocvar_sv_vote_no_stops_vote;
index 5e4bc9c69aa3657e077e0429ade5025514b6354e..34820c684f16336836136e8ddd0e3a64617f1ba9 100644 (file)
@@ -231,6 +231,7 @@ void cvar_changes_init()
                BADCVAR("serverconfig");
                BADCVAR("sv_autoscreenshot");
                BADCVAR("sv_heartbeatperiod");
+               BADCVAR("sv_vote_master_ids");
                BADCVAR("sv_vote_master_password");
                BADCVAR("sys_colortranslation");
                BADCVAR("sys_specialcharactertranslation");
@@ -525,9 +526,7 @@ void cvar_changes_init()
                BADCVAR("sv_vote_call");
                BADCVAR("sv_vote_commands");
                BADCVAR("sv_vote_majority_factor");
-               BADCVAR("sv_vote_master");
-               BADCVAR("sv_vote_master_commands");
-               BADCVAR("sv_vote_master_password");
+               BADPREFIX("sv_vote_master");
                BADCVAR("sv_vote_simple_majority_factor");
                BADVALUE("sys_ticrate", "0.0078125");
                BADVALUE("sys_ticrate", "0.015625");