mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +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:
@@ -161,13 +161,15 @@
|
||||
* * font - The font to use.
|
||||
* * color - The font color to use.
|
||||
* * bold - Whether this text should be rendered completely bold.
|
||||
* * advanced_html - Boolean that is true when the writer has R_FUN permission, which sanitizes less HTML (such as images) from the new paper_input
|
||||
*/
|
||||
/obj/item/paper/proc/add_raw_text(text, font, color, bold)
|
||||
/obj/item/paper/proc/add_raw_text(text, font, color, bold, advanced_html)
|
||||
var/new_input_datum = new /datum/paper_input(
|
||||
text,
|
||||
font,
|
||||
color,
|
||||
bold,
|
||||
advanced_html,
|
||||
)
|
||||
|
||||
input_field_count += get_input_field_count(text)
|
||||
@@ -585,7 +587,7 @@
|
||||
// Safe to assume there are writing implement details as user.can_write(...) fails with an invalid writing implement.
|
||||
var/writing_implement_data = holding.get_writing_implement_details()
|
||||
|
||||
add_raw_text(paper_input, writing_implement_data["font"], writing_implement_data["color"], writing_implement_data["use_bold"])
|
||||
add_raw_text(paper_input, writing_implement_data["font"], writing_implement_data["color"], writing_implement_data["use_bold"], check_rights_for(user?.client, R_FUN))
|
||||
|
||||
log_paper("[key_name(user)] wrote to [name]: \"[paper_input]\"")
|
||||
to_chat(user, "You have added to your paper masterpiece!");
|
||||
@@ -672,15 +674,18 @@
|
||||
var/colour = ""
|
||||
/// Whether to render the font bold or not.
|
||||
var/bold = FALSE
|
||||
/// Whether the creator of this input field has the R_FUN permission, thus allowing less sanitization
|
||||
var/advanced_html = FALSE
|
||||
|
||||
/datum/paper_input/New(_raw_text, _font, _colour, _bold)
|
||||
/datum/paper_input/New(_raw_text, _font, _colour, _bold, _advanced_html)
|
||||
raw_text = _raw_text
|
||||
font = _font
|
||||
colour = _colour
|
||||
bold = _bold
|
||||
advanced_html = _advanced_html
|
||||
|
||||
/datum/paper_input/proc/make_copy()
|
||||
return new /datum/paper_input(raw_text, font, colour, bold);
|
||||
return new /datum/paper_input(raw_text, font, colour, bold, advanced_html)
|
||||
|
||||
/datum/paper_input/proc/to_list()
|
||||
return list(
|
||||
@@ -688,6 +693,7 @@
|
||||
font = font,
|
||||
color = colour,
|
||||
bold = bold,
|
||||
advanced_html = advanced_html,
|
||||
)
|
||||
|
||||
/// A single instance of a saved stamp on paper.
|
||||
|
||||
Reference in New Issue
Block a user