From d1e57b91c4b31644b2fdc1b05371eb67fd9cb3fe Mon Sep 17 00:00:00 2001 From: forest2001 Date: Thu, 30 Nov 2023 00:15:35 +0000 Subject: [PATCH 1/7] I think it works? --- code/modules/admin/admin_verbs.dm | 1 + code/modules/admin/tabs/admin_tab.dm | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 9833505ee346..07d7d4e89623 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -36,6 +36,7 @@ GLOBAL_LIST_INIT(admin_verbs_default, list( /client/proc/togglenichelogs, /datum/admins/proc/display_tags, /datum/admins/proc/player_notes_show, + /datum/admins/proc/check_ckey, /datum/admins/proc/toggleooc, /*toggles ooc on/off for everyone*/ /datum/admins/proc/togglelooc, /*toggles ooc on/off for everyone*/ /datum/admins/proc/toggledsay, /*toggles dsay on/off for everyone*/ diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index cc927a62d3b0..38c448d47e4a 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -185,6 +185,20 @@ dat += "" show_browser(usr, dat, "Admin record for [key]", "adminplayerinfo", "size=480x480") +/datum/admins/proc/check_ckey(target_key as text) + set name = "Check CKey" + set category = "Admin" + + if (!istype(src,/datum/admins)) + src = usr.client.admin_holder + if (!istype(src,/datum/admins) || !(src.rights & R_MOD)) + to_chat(usr, "Error: you are not an admin!") + return + if(!target_key) + return + + analyze_ckey(target_key) + /datum/admins/proc/sleepall() set name = "Sleep All" set category = "Admin.InView" From 7fdb14bde67c80cca14d052803f352d9f96c16e0 Mon Sep 17 00:00:00 2001 From: forest2001 Date: Thu, 30 Nov 2023 00:16:20 +0000 Subject: [PATCH 2/7] log! --- code/modules/admin/tabs/admin_tab.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index 38c448d47e4a..aab78c1b1464 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -198,6 +198,7 @@ return analyze_ckey(target_key) + log_admin("[key_name(usr)] analyzed ckey '[target_key]'") /datum/admins/proc/sleepall() set name = "Sleep All" From 73113956b6b4c4742bf3c9be07d4a9b0825b1297 Mon Sep 17 00:00:00 2001 From: forest2001 Date: Thu, 30 Nov 2023 03:34:38 +0000 Subject: [PATCH 3/7] I think it works now? --- code/modules/admin/tabs/admin_tab.dm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index aab78c1b1464..11b20476a4a1 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -189,16 +189,23 @@ set name = "Check CKey" set category = "Admin" + var/mob/user = usr if (!istype(src,/datum/admins)) - src = usr.client.admin_holder + src = user.client.admin_holder if (!istype(src,/datum/admins) || !(src.rights & R_MOD)) - to_chat(usr, "Error: you are not an admin!") + to_chat(user, "Error: you are not an admin!") return if(!target_key) + to_chat(user, "Error: No key detected!") return + var/list/keys = list() + keys += analyze_ckey(target_key) + var/text_output = "Check Ckey Results: " + for(var/key in keys) + text_output += "[key]," + to_chat(user, SPAN_WARNING(text_output)) - analyze_ckey(target_key) - log_admin("[key_name(usr)] analyzed ckey '[target_key]'") + log_admin("[key_name(user)] analyzed ckey '[target_key]'") /datum/admins/proc/sleepall() set name = "Sleep All" From b820101a34e7ed60824978ed062a45980551ebb1 Mon Sep 17 00:00:00 2001 From: forest2001 <41653574+realforest2001@users.noreply.github.com> Date: Fri, 1 Dec 2023 23:40:33 +0000 Subject: [PATCH 4/7] Apply suggestions from code review Co-authored-by: harryob --- code/modules/admin/tabs/admin_tab.dm | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index 11b20476a4a1..cd58f7891e24 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -190,20 +190,16 @@ set category = "Admin" var/mob/user = usr - if (!istype(src,/datum/admins)) + if (!istype(src, /datum/admins)) src = user.client.admin_holder - if (!istype(src,/datum/admins) || !(src.rights & R_MOD)) + if (!istype(src, /datum/admins) || !(rights & R_MOD)) to_chat(user, "Error: you are not an admin!") return if(!target_key) to_chat(user, "Error: No key detected!") return - var/list/keys = list() - keys += analyze_ckey(target_key) - var/text_output = "Check Ckey Results: " - for(var/key in keys) - text_output += "[key]," - to_chat(user, SPAN_WARNING(text_output)) + var/list/keys = analyze_ckey(target_key) + to_chat(user, SPAN_WARNING("Check CKey Results: [keys.Join(", ")]")) log_admin("[key_name(user)] analyzed ckey '[target_key]'") From 2848637943a71bb0b23e072759e55580f45822ac Mon Sep 17 00:00:00 2001 From: forest2001 <41653574+realforest2001@users.noreply.github.com> Date: Mon, 4 Dec 2023 20:49:31 +0000 Subject: [PATCH 5/7] Update code/modules/admin/tabs/admin_tab.dm Co-authored-by: harryob --- code/modules/admin/tabs/admin_tab.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index cd58f7891e24..6d41059db62e 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -199,7 +199,10 @@ to_chat(user, "Error: No key detected!") return var/list/keys = analyze_ckey(target_key) - to_chat(user, SPAN_WARNING("Check CKey Results: [keys.Join(", ")]")) + if(!keys) + to_chat(user, SPAN_WARNING("No results for [target_key].")) + return + to_chat(user, SPAN_WARNING("Check CKey Results: [keys.Join(", ")]")) log_admin("[key_name(user)] analyzed ckey '[target_key]'") From 6d22a6669d335ad8f110d193b4bcab24961382eb Mon Sep 17 00:00:00 2001 From: forest2001 Date: Mon, 4 Dec 2023 20:55:45 +0000 Subject: [PATCH 6/7] fixed indentation. --- code/modules/admin/tabs/admin_tab.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index 6d41059db62e..7dec4f802169 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -198,11 +198,12 @@ if(!target_key) to_chat(user, "Error: No key detected!") return + to_chat(user, SPAN_WARNING("Checking Ckey: [target_key]")) var/list/keys = analyze_ckey(target_key) if(!keys) - to_chat(user, SPAN_WARNING("No results for [target_key].")) - return - to_chat(user, SPAN_WARNING("Check CKey Results: [keys.Join(", ")]")) + to_chat(user, SPAN_WARNING("No results for [target_key].")) + return + to_chat(user, SPAN_WARNING("Check CKey Results: [keys.Join(", ")]")) log_admin("[key_name(user)] analyzed ckey '[target_key]'") From 3156db73c5b3355ad54d3910cc8b873ba09e84d2 Mon Sep 17 00:00:00 2001 From: harryob Date: Wed, 6 Dec 2023 17:46:30 +0000 Subject: [PATCH 7/7] Update code/modules/admin/tabs/admin_tab.dm Co-authored-by: Drathek <76988376+Drulikar@users.noreply.github.com> --- code/modules/admin/tabs/admin_tab.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/admin/tabs/admin_tab.dm b/code/modules/admin/tabs/admin_tab.dm index 7dec4f802169..8dce41ac8235 100644 --- a/code/modules/admin/tabs/admin_tab.dm +++ b/code/modules/admin/tabs/admin_tab.dm @@ -195,6 +195,7 @@ if (!istype(src, /datum/admins) || !(rights & R_MOD)) to_chat(user, "Error: you are not an admin!") return + target_key = ckey(target_key) if(!target_key) to_chat(user, "Error: No key detected!") return