mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 12:05:59 +01:00
[MIRROR] Allows admins to skip some paper sanitization [MDB IGNORE] (#18728)
* Allows admins to skip some paper sanitization (#72553) ## About The Pull Request This PR allows admins with R_FUN to create paper that doesn't sanitize as much HTML as the default, player-accessible paper. Specifically, the ability for admins with R_FUN to add images that papercode would normally sanitise via HTML img tags. ## Why It's Good For The Game I'd like to make some fancy papers to send as faxes, but the current sanitization doesn't allow for images.  This was a fax I threw together in a few minutes after making the logo ## Changelog 🆑 admins: Admins with the appropriate permissions can now use HTML image tags in paper and faxes. /🆑 * Allows admins to skip some paper sanitization Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
var/datum/fax_panel_interface/ui = new(usr)
|
||||
ui.ui_interact(usr)
|
||||
|
||||
|
||||
/// Admin Fax Panel. Tool for sending fax messages faster.
|
||||
/datum/fax_panel_interface
|
||||
/// All faxes in from machinery list()
|
||||
@@ -30,14 +30,14 @@
|
||||
//Get all faxes, and save them to our list.
|
||||
for(var/obj/machinery/fax/fax in GLOB.machines)
|
||||
available_faxes += WEAKREF(fax)
|
||||
|
||||
|
||||
//Get all stamps
|
||||
for(var/stamp in subtypesof(/obj/item/stamp))
|
||||
var/obj/item/stamp/real_stamp = new stamp()
|
||||
if(!istype(real_stamp, /obj/item/stamp/chameleon) && !istype(real_stamp, /obj/item/stamp/mod))
|
||||
var/stamp_detail = real_stamp.get_writing_implement_details()
|
||||
stamp_list += list(list(real_stamp.name, real_stamp.icon_state, stamp_detail["stamp_class"]))
|
||||
|
||||
|
||||
//Give our paper special status, to read everywhere.
|
||||
fax_paper.request_state = TRUE
|
||||
|
||||
@@ -74,12 +74,12 @@
|
||||
|
||||
for(var/stamp in stamp_list)
|
||||
data["stamps"] += list(stamp[1]) // send only names.
|
||||
|
||||
|
||||
for(var/datum/weakref/weakrefed_fax as anything in available_faxes)
|
||||
var/obj/machinery/fax/another_fax = weakrefed_fax.resolve()
|
||||
if(another_fax && istype(another_fax))
|
||||
data["faxes"] += list(another_fax.fax_name)
|
||||
|
||||
|
||||
return data
|
||||
|
||||
/datum/fax_panel_interface/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
@@ -88,12 +88,12 @@
|
||||
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
|
||||
var/obj/machinery/fax/action_fax
|
||||
|
||||
if(params["faxName"])
|
||||
action_fax = get_fax_by_name(params["faxName"])
|
||||
|
||||
action_fax = get_fax_by_name(params["faxName"])
|
||||
|
||||
switch(action)
|
||||
|
||||
if("follow")
|
||||
@@ -101,20 +101,20 @@
|
||||
usr.client?.admin_ghost()
|
||||
|
||||
usr.client?.admin_follow(action_fax)
|
||||
|
||||
|
||||
if("preview") // see saved variant
|
||||
if(!fax_paper)
|
||||
return
|
||||
fax_paper.ui_interact(usr)
|
||||
|
||||
|
||||
if("save") // save paper
|
||||
if(params["paperName"])
|
||||
default_paper_name = params["paperName"]
|
||||
if(params["fromWho"])
|
||||
sending_fax_name = params["fromWho"]
|
||||
|
||||
|
||||
fax_paper.clear_paper()
|
||||
var/stamp
|
||||
var/stamp
|
||||
var/stamp_class
|
||||
|
||||
for(var/needed_stamp in stamp_list)
|
||||
@@ -122,24 +122,24 @@
|
||||
stamp = needed_stamp[2]
|
||||
stamp_class = needed_stamp[3]
|
||||
break
|
||||
|
||||
|
||||
fax_paper.name = "paper — [default_paper_name]"
|
||||
fax_paper.add_raw_text(params["rawText"])
|
||||
fax_paper.add_raw_text(params["rawText"], advanced_html = TRUE)
|
||||
|
||||
if(stamp)
|
||||
fax_paper.add_stamp(stamp_class, params["stampX"], params["stampY"], params["stampAngle"], stamp)
|
||||
|
||||
fax_paper.update_static_data(usr) // OK, it's work, and update UI.
|
||||
|
||||
|
||||
fax_paper.update_static_data(usr) // OK, it's work, and update UI.
|
||||
|
||||
if("send")
|
||||
//copy
|
||||
var/obj/item/paper/our_fax = fax_paper.copy(/obj/item/paper)
|
||||
our_fax.name = fax_paper.name
|
||||
//send
|
||||
action_fax.receive(our_fax, sending_fax_name)
|
||||
message_admins("[key_name_admin(usr)] has send custom fax message to [action_fax.name][ADMIN_FLW(action_fax)][ADMIN_SHOW_PAPER(fax_paper)].")
|
||||
log_admin("[key_name(usr)] has send custom fax message to [action_fax.name]")
|
||||
|
||||
message_admins("[key_name_admin(usr)] has sent a custom fax message to [action_fax.name][ADMIN_FLW(action_fax)][ADMIN_SHOW_PAPER(fax_paper)].")
|
||||
log_admin("[key_name(usr)] has sent a custom fax message to [action_fax.name]")
|
||||
|
||||
if("createPaper")
|
||||
var/obj/item/paper/our_paper = fax_paper.copy(/obj/item/paper, usr.loc)
|
||||
our_paper.name = fax_paper.name
|
||||
|
||||
Reference in New Issue
Block a user