mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
fixed giveruntimelog getruntimelog and getserverlog Any admin with ADMIN rights can give anybody permission to view runtimes simply by typing .giveruntimelog The person given permission can then type .getruntimelog Admins can type .getruntimelog without giving themselves permissions first Moved a lot of the copypasta code into helper procs in __HELPERS/files.dm. There is one which allows a client to browse through folders on the server (in this case to look for logfiles). You can now also return to the directory you started at. Note, for some weird reason, runtimes will no longer show in dreamdeamon. If this is a massive problem I can make it a compile option or something (or you can comment out the line if you're a coder). I know this is a massive pain but it sort of removes much of the effort in getting runtimes from other servers, since they all now have their runtimes saved in a way coders can easily access. It also sort of means we don't have to rely on people remembering to log runtimes and such. And all logs will be organised by month. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5466 316c924e-a436-60f5-8080-3fe189b3f50e
112 lines
4.3 KiB
Plaintext
112 lines
4.3 KiB
Plaintext
/*
|
|
HOW DO I LOG RUNTIMES?
|
|
Firstly, start dreamdeamon if it isn't already running. Then select "world>Log Session" (or press the F3 key)
|
|
navigate the popup window to the data/logs/runtime/ folder from where your tgstation .dmb is located.
|
|
(you may have to make this folder yourself)
|
|
|
|
OPTIONAL: you can select the little checkbox down the bottom to make dreamdeamon save the log everytime you
|
|
start a world. Just remember to repeat these steps with a new name when you update to a new revision!
|
|
|
|
Save it with the name of the revision your server uses (e.g. r3459.txt).
|
|
Game Masters will now be able to grant access any runtime logs you have archived this way!
|
|
This will allow us to gather information on bugs across multiple servers and make maintaining the TG
|
|
codebase for the entire /TG/station commuity a TONNE easier :3 Thanks for your help!
|
|
*/
|
|
|
|
|
|
//This proc allows Game Masters to grant a client access to the .getruntimelog verb
|
|
//Permissions expire at the end of each round.
|
|
//Runtimes can be used to meta or spot game-crashing exploits so it's advised to only grant coders that
|
|
//you trust access. Also, it may be wise to ensure that they are not going to play in the current round.
|
|
/client/proc/giveruntimelog()
|
|
set name = ".giveruntimelog"
|
|
set desc = "Give somebody access to any session logfiles saved to the /log/runtime/ folder."
|
|
set category = null
|
|
|
|
if(!src.holder)
|
|
src << "<font color='red'>Only Admins may use this command.</font>"
|
|
return
|
|
|
|
var/client/target = input(src,"Choose somebody to grant access to the server's runtime logs (permissions expire at the end of each round):","Grant Permissions",null) as null|anything in clients
|
|
if(!istype(target,/client))
|
|
src << "<font color='red'>Error: giveruntimelog(): Client not found.</font>"
|
|
return
|
|
|
|
target.verbs |= /client/proc/getruntimelog
|
|
target << "<font color='red'>You have been granted access to runtime logs. Please use them responsibly or risk being banned.</font>"
|
|
return
|
|
|
|
|
|
//This proc allows download of runtime logs saved within the data/logs/ folder by dreamdeamon.
|
|
//It works similarly to show-server-log.
|
|
/client/proc/getruntimelog()
|
|
set name = ".getruntimelog"
|
|
set desc = "Retrieve any session logfiles saved by dreamdeamon."
|
|
set category = null
|
|
|
|
var/path = browse_files("data/logs/runtime/")
|
|
if(!path)
|
|
return
|
|
|
|
if(file_spam_check())
|
|
return
|
|
|
|
message_admins("[key_name_admin(src)] accessed file: [path]")
|
|
src << run( file(path) )
|
|
src << "Attempting to send file, this may take a fair few minutes if the file is very large."
|
|
return
|
|
|
|
|
|
//This proc allows download of past server logs saved within the data/logs/ folder.
|
|
//It works similarly to show-server-log.
|
|
/client/proc/getserverlog()
|
|
set name = ".getserverlog"
|
|
set desc = "Fetch logfiles from data/logs"
|
|
set category = null
|
|
|
|
var/path = browse_files("data/logs/")
|
|
if(!path)
|
|
return
|
|
|
|
if(file_spam_check())
|
|
return
|
|
|
|
message_admins("[key_name_admin(src)] accessed file: [path]")
|
|
src << run( file(path) )
|
|
src << "Attempting to send file, this may take a fair few minutes if the file is very large."
|
|
return
|
|
|
|
|
|
//Other log stuff put here for the sake of organisation
|
|
|
|
//Shows today's server log
|
|
/datum/admins/proc/view_txt_log()
|
|
set category = "Admin"
|
|
set name = "Show Server Log"
|
|
set desc = "Shows today's server log."
|
|
|
|
var/path = "data/logs/[time2text(world.realtime,"YYYY/MM-Month/DD-Day")].log"
|
|
if( fexists(path) )
|
|
src << run( file(path) )
|
|
else
|
|
src << "<font color='red'>Error: view_txt_log(): File not found/Invalid path([path]).</font>"
|
|
return
|
|
feedback_add_details("admin_verb","VTL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
|
return
|
|
|
|
//Shows today's attack log
|
|
/datum/admins/proc/view_atk_log()
|
|
set category = "Admin"
|
|
set name = "Show Server Attack Log"
|
|
set desc = "Shows today's server attack log."
|
|
|
|
var/path = "data/logs/[time2text(world.realtime,"YYYY/MM-Month/DD-Day")] Attack.log"
|
|
if( fexists(path) )
|
|
src << run( file(path) )
|
|
else
|
|
src << "<font color='red'>Error: view_atk_log(): File not found/Invalid path([path]).</font>"
|
|
return
|
|
usr << run( file(path) )
|
|
feedback_add_details("admin_verb","SSAL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
|
return
|