mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Profiler and reboot for admins with +SERVER/+DEBUG, client skin stuff. (#14255)
* Client skin buttons for reconnect, profiler and reboot. All admins get profiler and reboot if they have the correct flags. * Update vgstation13.dme
This commit is contained in:
committed by
Probe1
parent
a4a80c2580
commit
16a9d54f2a
5
__DEFINES/world.dm
Normal file
5
__DEFINES/world.dm
Normal file
@@ -0,0 +1,5 @@
|
||||
// These are the world/Reboot reason codes as defined in the reference.
|
||||
#define REBOOT_CODE 0
|
||||
#define REBOOT_HOST 1
|
||||
#define REBOOT_TOPIC 2
|
||||
#define REBOOT_SIGUSR1 3
|
||||
@@ -86,6 +86,10 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
|
||||
C.holder = null
|
||||
admins.len = 0
|
||||
|
||||
// Clear profiler and debug access.
|
||||
for(var/A in world.GetConfig("admin"))
|
||||
world.SetConfig("APP/admin", A, null)
|
||||
|
||||
if(config.admin_legacy_system)
|
||||
load_admin_ranks()
|
||||
|
||||
@@ -123,6 +127,8 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
|
||||
//find the client for a ckey if they are connected and associate them with the new admin datum
|
||||
D.associate(directory[ckey])
|
||||
|
||||
if(D.rights & (R_DEBUG|R_SERVER)) // Grant profile/reboot access
|
||||
world.SetConfig("APP/admin", ckey, "role=admin")
|
||||
else
|
||||
//The current admin system uses SQL
|
||||
|
||||
@@ -149,6 +155,10 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
|
||||
|
||||
//find the client for a ckey if they are connected and associate them with the new admin datum
|
||||
D.associate(directory[ckey])
|
||||
|
||||
if(D.rights & (R_DEBUG|R_SERVER)) // Grant profile/reboot access
|
||||
world.SetConfig("APP/admin", ckey, "role=admin")
|
||||
|
||||
if(!admin_datums)
|
||||
world.log << "The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system."
|
||||
diary << "The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system."
|
||||
@@ -187,3 +197,9 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
|
||||
holder.associate(src)
|
||||
|
||||
#endif
|
||||
|
||||
/proc/update_byond_admin(var/ckey)
|
||||
var/datum/admins/D = admin_datums[ckey]
|
||||
world.SetConfig("APP/admin", ckey, null)
|
||||
if (D && D.rights & (R_SERVER|R_DEBUG))
|
||||
world.SetConfig("APP/admin", ckey, "role=admin")
|
||||
|
||||
@@ -32,13 +32,36 @@ var/list/admin_datums = list()
|
||||
admins |= C
|
||||
owner.verbs -= /client/proc/readmin
|
||||
|
||||
add_menu_items()
|
||||
|
||||
/datum/admins/proc/disassociate()
|
||||
if(owner)
|
||||
admins -= owner
|
||||
owner.remove_admin_verbs()
|
||||
owner.holder = null
|
||||
|
||||
remove_menu_items()
|
||||
|
||||
owner = null
|
||||
|
||||
|
||||
/datum/admins/proc/add_menu_items()
|
||||
if (owner && rights & (R_DEBUG|R_SERVER))
|
||||
winset(owner, "server_menu", "is-disabled=false")
|
||||
|
||||
if (rights & R_SERVER)
|
||||
winset(owner, "reboot_menu_item", "is-disabled=false")
|
||||
|
||||
/datum/admins/proc/remove_menu_items()
|
||||
if (owner)
|
||||
winset(owner, "server_menu", "is-disabled=true")
|
||||
winset(owner, "reboot_menu_item", "is-disabled=true")
|
||||
|
||||
/datum/admins/proc/update_menu_items()
|
||||
if (owner)
|
||||
remove_menu_items()
|
||||
add_menu_items()
|
||||
|
||||
/*
|
||||
checks if usr is an admin with at least ONE of the flags in rights_required. (Note, they don't need all the flags)
|
||||
if rights_required == 0, then it simply checks if they are an admin.
|
||||
|
||||
@@ -237,6 +237,7 @@
|
||||
return
|
||||
admin_datums -= adm_ckey
|
||||
D.disassociate()
|
||||
update_byond_admin(adm_ckey)
|
||||
|
||||
message_admins("[key_name_admin(usr)] removed [adm_ckey] from the admins list")
|
||||
log_admin("[key_name(usr)] removed [adm_ckey] from the admins list")
|
||||
@@ -282,6 +283,7 @@
|
||||
|
||||
var/client/C = directory[adm_ckey] //find the client with the specified ckey (if they are logged in)
|
||||
D.associate(C) //link up with the client and add verbs
|
||||
update_byond_admin(adm_ckey)
|
||||
|
||||
message_admins("[key_name_admin(usr)] edited the admin rank of [adm_ckey] to [new_rank]")
|
||||
log_admin("[key_name(usr)] edited the admin rank of [adm_ckey] to [new_rank]")
|
||||
@@ -298,6 +300,9 @@
|
||||
return
|
||||
D.rights ^= permissionlist[new_permission]
|
||||
|
||||
update_byond_admin(adm_ckey)
|
||||
D.update_menu_items()
|
||||
|
||||
message_admins("[key_name_admin(usr)] toggled the [new_permission] permission of [adm_ckey]")
|
||||
log_admin("[key_name(usr)] toggled the [new_permission] permission of [adm_ckey]")
|
||||
log_admin_permission_modification(adm_ckey, permissionlist[new_permission])
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
var/next_allowed_topic_time = 10
|
||||
// comment out the line below when debugging locally to enable the options & messages menu
|
||||
// CONTROL_FREAK_MACROS allows new macros to be made, but won't permit overriding skin-defined ones. http://www.byond.com/forum/?post=2219001#comment22205313
|
||||
control_freak = CONTROL_FREAK_ALL | CONTROL_FREAK_MACROS
|
||||
// control_freak = CONTROL_FREAK_ALL | CONTROL_FREAK_MACROS
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
|
||||
@@ -195,6 +195,7 @@
|
||||
if(holder)
|
||||
add_admin_verbs()
|
||||
admin_memo_show()
|
||||
holder.add_menu_items()
|
||||
|
||||
log_client_to_db()
|
||||
|
||||
|
||||
@@ -233,10 +233,22 @@ var/savefile/panicfile
|
||||
|
||||
|
||||
/world/Reboot(reason)
|
||||
if(reason == 1)
|
||||
if(usr && usr.client)
|
||||
if(!usr.client.holder)
|
||||
return 0
|
||||
if(reason == REBOOT_HOST)
|
||||
if(usr)
|
||||
if (!check_rights(R_SERVER))
|
||||
log_admin("[key_name(usr)] Attempted to reboot world via client debug tools, but they do not have +SERVER and were denied.")
|
||||
message_admins("[key_name_admin(usr)] Attempted to reboot world via client debug tools, but they do not have +SERVER and were denied.")
|
||||
return
|
||||
|
||||
log_admin("[key_name(usr)] Has requested an immediate world restart via client side debugging tools.")
|
||||
message_admins("[key_name_admin(usr)] Has requested an immediate world restart via client side debugging tools.")
|
||||
// To prevent the server shutting down before logs get to the admins or some nonsense.
|
||||
sleep(1)
|
||||
|
||||
to_chat(world, "<span class='danger big'>Rebooting World immediately due to host request!</span>")
|
||||
..()
|
||||
return
|
||||
|
||||
for(var/datum/html_interface/D in html_interfaces)
|
||||
D.closeAll()
|
||||
if(config.map_voting)
|
||||
|
||||
@@ -385,29 +385,34 @@ macro "hotkeymode"
|
||||
|
||||
|
||||
menu "menu"
|
||||
elem
|
||||
name = "&File"
|
||||
elem "client_menu"
|
||||
name = "&Client"
|
||||
command = ""
|
||||
saved-params = "is-checked"
|
||||
elem
|
||||
name = "&Quick screenshot\tF2"
|
||||
command = ".screenshot auto"
|
||||
category = "&File"
|
||||
category = "&Client"
|
||||
saved-params = "is-checked"
|
||||
elem
|
||||
name = "&Save screenshot as...\tShift+F2"
|
||||
command = ".screenshot"
|
||||
category = "&File"
|
||||
category = "&Client"
|
||||
saved-params = "is-checked"
|
||||
elem
|
||||
name = ""
|
||||
command = ""
|
||||
category = "&File"
|
||||
category = "&Client"
|
||||
saved-params = "is-checked"
|
||||
elem
|
||||
name = "Reconnect"
|
||||
command = ".reconnect"
|
||||
category = "&Client"
|
||||
saved-params = "is-checked"
|
||||
elem
|
||||
name = "&Quit"
|
||||
command = ".quit"
|
||||
category = "&File"
|
||||
category = "&Client"
|
||||
saved-params = "is-checked"
|
||||
elem
|
||||
name = "&Icons"
|
||||
@@ -490,6 +495,27 @@ menu "menu"
|
||||
command = "swapsides"
|
||||
category = "Skin"
|
||||
saved-params = "is-checked"
|
||||
elem "server_menu"
|
||||
name = "Server"
|
||||
command = ""
|
||||
is-disabled = true
|
||||
saved-params = "is-checked"
|
||||
elem
|
||||
name = "Profiler"
|
||||
command = ".profile"
|
||||
category = "Server"
|
||||
saved-params = "is-checked"
|
||||
elem
|
||||
name = ""
|
||||
command = ""
|
||||
category = "Server"
|
||||
saved-params = "is-checked"
|
||||
elem "reboot_menu_item"
|
||||
name = "EMERGENCY REBOOT"
|
||||
command = ".reboot"
|
||||
category = "Server"
|
||||
is-disabled = true
|
||||
saved-params = "is-checked"
|
||||
|
||||
|
||||
window "Telecomms IDE"
|
||||
@@ -1026,6 +1052,7 @@ window "window1"
|
||||
size = 640x480
|
||||
anchor1 = none
|
||||
anchor2 = none
|
||||
background-color = none
|
||||
is-visible = false
|
||||
border = sunken
|
||||
saved-params = "pos;size;is-minimized;is-maximized"
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "__DEFINES\stylesheet.dm"
|
||||
#include "__DEFINES\subsystem.dm"
|
||||
#include "__DEFINES\tick.dm"
|
||||
#include "__DEFINES\world.dm"
|
||||
#include "code\_secrets.dm"
|
||||
#include "code\hub.dm"
|
||||
#include "code\names.dm"
|
||||
|
||||
Reference in New Issue
Block a user