Admin Library Moderation (in-game edition) (#75645)

For the longest time, the only way admins could moderate the library was
by using statbus's external tool.
But a few months back statbus went down, and ever since then they've
been sitting lost. Shit sucks.

The whole external thing has been bugging me for a while, so let's fix
all that yeah?

This pr adds a new verb to the admin tab that allows admins to
ban/restore books from the library.
It includes expanded (ckey) search, faster response times, in tool book
viewing with and without markdown rendering, and viewing of deleted
books.

This is accomplished with a special subtype of library consoles, stored
on the admin datum.
It shouldn't let you do anything without +BAN, rip my live debugging or
whatever.

I've also hooked into (and fixed) Ned's existing library actions log,
and added viewing support to the ban/restore pages.
This logs banning admin, ban time, ban reason, etc.

As a part of this, I've fixed/expanded on the existing UIs.
I've added ID search to all existing consoles, and fixed an existing bug
with the visitor console not supporting category search (shows how many
people actually use the thing)

Changes to the library_action table were pretty minor. The ckey column
was too small, so longer keys just caused it to fail on ban. Bad.
That and the ip address column was signed, which wasted space and was
non standard with other tables.
This commit is contained in:
LemonInTheDark
2023-05-31 22:45:32 +00:00
committed by GitHub
parent 40cf99a164
commit 57ef596898
18 changed files with 1002 additions and 39 deletions
+12 -1
View File
@@ -93,7 +93,7 @@ GLOBAL_PROTECT(admin_verbs_admin)
/client/proc/cmd_admin_law_panel,
/client/proc/log_viewer_new,
)
GLOBAL_LIST_INIT(admin_verbs_ban, list(/client/proc/unban_panel, /client/proc/ban_panel, /client/proc/stickybanpanel))
GLOBAL_LIST_INIT(admin_verbs_ban, list(/client/proc/unban_panel, /client/proc/ban_panel, /client/proc/stickybanpanel, /client/proc/library_control))
GLOBAL_PROTECT(admin_verbs_ban)
GLOBAL_LIST_INIT(admin_verbs_sounds, list(/client/proc/play_local_sound, /client/proc/play_direct_mob_sound, /client/proc/play_sound, /client/proc/set_round_end_sound))
GLOBAL_PROTECT(admin_verbs_sounds)
@@ -1025,3 +1025,14 @@ GLOBAL_PROTECT(admin_verbs_poll)
message_admins("[key_name_admin(usr)] has loaded lazy template '[choice]'")
to_chat(usr, span_boldnicegreen("Template loaded, you have been moved to the bottom left of the reservation."))
/client/proc/library_control()
set name = "Library Management"
set category = "Admin"
if(!check_rights(R_BAN))
return
if(!holder.library_manager)
holder.library_manager = new()
holder.library_manager.ui_interact(usr)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Library Management") // If you are copy-pasting this, ensure the 4th parameter is unique to the new proc!