Corrected a bunch of over-escaping. (#24876)

* Corrected a bunch of over-escaping.

* unundefine

* Fixed #23759

* Apply suggestions from code review

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Review fix

---------

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
Charlie Nolan
2024-04-07 02:59:15 -07:00
committed by GitHub
parent 0bfe115003
commit 6c4a80d2e5
21 changed files with 48 additions and 43 deletions
+4
View File
@@ -38,6 +38,10 @@
/proc/sanitize(t, list/repl_chars = null)
return html_encode(sanitize_simple(t,repl_chars))
/// sanitize() with a pre-set list of characters to remove from IC speech.
/proc/sanitize_for_ic(t)
return sanitize(t, list("<" = "", ">" = "", "\[" = "", "]" = "", "{" = "", "}" = ""))
// Gut ANYTHING that isnt alphanumeric, or brackets
/proc/paranoid_sanitize(t)
var/regex/alphanum_only = regex("\[^a-zA-Z0-9# ,.?!:;()]", "g")
@@ -517,7 +517,7 @@
return FALSE
if(sanitize)
message = trim_strip_html_properly(message)
message = sanitize_for_ic(trim(message))
if(stat)
if(stat == DEAD)
@@ -234,11 +234,11 @@
setMenuState(ui.user, COMM_SCREEN_STAT)
if("setmsg1")
stat_msg1 = clean_input("Line 1", "Enter Message Text", stat_msg1)
stat_msg1 = tgui_input_text(ui.user, "Line 1", stat_msg1, "Enter Message Text", encode = FALSE)
setMenuState(ui.user, COMM_SCREEN_STAT)
if("setmsg2")
stat_msg2 = clean_input("Line 2", "Enter Message Text", stat_msg2)
stat_msg2 = tgui_input_text(ui.user, "Line 2", stat_msg2, "Enter Message Text", encode = FALSE)
setMenuState(ui.user, COMM_SCREEN_STAT)
if("nukerequest")
@@ -246,7 +246,7 @@
if(centcomm_message_cooldown > world.time)
to_chat(ui.user, "<span class='warning'>Arrays recycling. Please stand by.</span>")
return
var/input = tgui_input_text(ui.user, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.")
var/input = tgui_input_text(ui.user, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.", encode = FALSE)
if(!input || ..() || !(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT))
return
if(length(input) < COMM_CCMSGLEN_MINIMUM)
@@ -264,7 +264,7 @@
if(centcomm_message_cooldown > world.time)
to_chat(ui.user, "<span class='warning'>Arrays recycling. Please stand by.</span>")
return
var/input = tgui_input_text(ui.user, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "CentComm Message")
var/input = tgui_input_text(ui.user, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "CentComm Message", encode = FALSE)
if(!input || ..() || !(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT))
return
if(length(input) < COMM_CCMSGLEN_MINIMUM)
@@ -283,7 +283,7 @@
if(centcomm_message_cooldown > world.time)
to_chat(ui.user, "Arrays recycling. Please stand by.")
return
var/input = tgui_input_text(ui.user, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "Send Message")
var/input = tgui_input_text(ui.user, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "Send Message", encode = FALSE)
if(!input || ..() || !(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT))
return
if(length(input) < COMM_CCMSGLEN_MINIMUM)
@@ -818,7 +818,7 @@ GLOBAL_LIST_EMPTY(deadsay_radio_systems)
to_chat(hearer, "<span class='deadsay'><b>[speaker_name]</b> ([ghost_follow_link(subject, hearer)]) [message]</span>")
/obj/item/radio/headset/deadsay/talk_into(mob/living/M, list/message_pieces, channel, verbage)
var/message = sanitize(copytext(multilingual_to_message(message_pieces), 1, MAX_MESSAGE_LEN))
var/message = copytext(multilingual_to_message(message_pieces), 1, MAX_MESSAGE_LEN)
if(!message)
return
@@ -34,13 +34,13 @@
A.UpdateButtons()
/obj/item/voice_changer/proc/set_voice(mob/user)
var/chosen_voice = clean_input("What voice would you like to mimic? Leave this empty to use the voice on your ID card.", "Set Voice Changer", voice, user)
var/chosen_voice = input("What voice would you like to mimic? Leave this empty to use the voice on your ID card.", "Set Voice Changer", voice, user)
if(!chosen_voice)
voice = null
to_chat(user, "<span class='notice'>You are now mimicking the voice on your ID card.</span>")
return
voice = sanitize(copytext_char(chosen_voice, 1, MAX_MESSAGE_LEN))
voice = sanitize_for_ic(copytext_char(chosen_voice, 1, MAX_MESSAGE_LEN))
to_chat(user, "<span class='notice'>You are now mimicking <b>[voice]</b>.</span>")
/obj/item/voice_changer/voice_modulator
+1 -1
View File
@@ -2438,7 +2438,7 @@
if(!input)
qdel(P)
return
input = admin_pencode_to_html(html_encode(input)) // Encode everything from pencode to html
input = admin_pencode_to_html(input) // Encode everything from pencode to html
var/customname = clean_input("Pick a title for the fax.", "Fax Title", null, owner)
if(!customname)
+1 -1
View File
@@ -60,7 +60,7 @@
SEND_SOUND(X, sound('sound/effects/adminhelp.ogg'))
/proc/ERT_Announce(text, mob/Sender, repeat_warning)
var/msg = sanitizeSafe(text)
var/msg = sanitize(text)
var/insert_this = list(list(
"time" = station_time_timestamp(),
"sender_real_name" = "[Sender.real_name ? Sender.real_name : Sender.name]",
+1 -1
View File
@@ -92,7 +92,7 @@
/mob/camera/blob/proc/blob_talk(message)
log_say("(BLOB) [message]", src)
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = sanitize_for_ic(trim(copytext(message, 1, MAX_MESSAGE_LEN)))
if(!message)
return
+1 -1
View File
@@ -334,7 +334,7 @@
return
if(!(container ? container : src).Adjacent(user)) // Is the user next to the seed/container?
return
variant = copytext(sanitize(html_encode(trim(V))), 1, 64) // Sanitization must happen after null check because it converts nulls to empty strings
variant = html_encode(copytext(trim(V), 1, 64))
if(variant == "")
variant = null
if(prev != variant)
@@ -40,6 +40,7 @@ GLOBAL_DATUM_INIT(ghost_crew_monitor, /datum/ui_module/crew_monitor/ghost, new)
/// The "color" their runechat would have had
var/alive_runechat_color = "#FFFFFF"
hud_type = /datum/hud/ghost
speaks_ooc = TRUE
/mob/dead/observer/New(mob/body=null, flags=1)
set_invisibility(GLOB.observer_default_invisibility)
@@ -754,19 +754,19 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
user.set_machine(src)
var/dat = {"<table>
<tr><td><B>Left Hand:</B></td><td><A href='?src=[UID()];item=[SLOT_HUD_LEFT_HAND]'>[(l_hand && !(l_hand.flags&ABSTRACT)) ? html_encode(l_hand) : "<font color=grey>Empty</font>"]</A></td></tr>
<tr><td><B>Right Hand:</B></td><td><A href='?src=[UID()];item=[SLOT_HUD_RIGHT_HAND]'>[(r_hand && !(r_hand.flags&ABSTRACT)) ? html_encode(r_hand) : "<font color=grey>Empty</font>"]</A></td></tr>
<tr><td><b>Left Hand:</b></td><td><a href='?src=[UID()];item=[SLOT_HUD_LEFT_HAND]'>[(l_hand && !(l_hand.flags&ABSTRACT)) ? l_hand : "<font color=grey>Empty</font>"]</a></td></tr>
<tr><td><b>Right Hand:</b></td><td><a href='?src=[UID()];item=[SLOT_HUD_RIGHT_HAND]'>[(r_hand && !(r_hand.flags&ABSTRACT)) ? r_hand : "<font color=grey>Empty</font>"]</a></td></tr>
<tr><td>&nbsp;</td></tr>"}
dat += "<tr><td><B>Back:</B></td><td><A href='?src=[UID()];item=[SLOT_HUD_BACK]'>[(back && !(back.flags&ABSTRACT)) ? html_encode(back) : "<font color=grey>Empty</font>"]</A>"
dat += "<tr><td><b>Back:</b></td><td><a href='?src=[UID()];item=[SLOT_HUD_BACK]'>[(back && !(back.flags&ABSTRACT)) ? back : "<font color=grey>Empty</font>"]</a>"
if(istype(wear_mask, /obj/item/clothing/mask) && istype(back, /obj/item/tank))
dat += "&nbsp;<A href='?src=[UID()];internal=[SLOT_HUD_BACK]'>[internal ? "Disable Internals" : "Set Internals"]</A>"
dat += "&nbsp;<a href='?src=[UID()];internal=[SLOT_HUD_BACK]'>[internal ? "Disable Internals" : "Set Internals"]</a>"
dat += "</td></tr><tr><td>&nbsp;</td></tr>"
dat += "<tr><td><B>Head:</B></td><td><A href='?src=[UID()];item=[SLOT_HUD_HEAD]'>[(head && !(head.flags&ABSTRACT)) ? html_encode(head) : "<font color=grey>Empty</font>"]</A></td></tr>"
dat += "<tr><td><b>Head:</b></td><td><a href='?src=[UID()];item=[SLOT_HUD_HEAD]'>[(head && !(head.flags&ABSTRACT)) ? head : "<font color=grey>Empty</font>"]</a></td></tr>"
dat += "<tr><td><B>Mask:</B></td><td><A href='?src=[UID()];item=[SLOT_HUD_WEAR_MASK]'>[(wear_mask && !(wear_mask.flags&ABSTRACT)) ? html_encode(wear_mask) : "<font color=grey>Empty</font>"]</A></td></tr>"
dat += "<tr><td><b>Mask:</b></td><td><a href='?src=[UID()];item=[SLOT_HUD_WEAR_MASK]'>[(wear_mask && !(wear_mask.flags&ABSTRACT)) ? wear_mask : "<font color=grey>Empty</font>"]</a></td></tr>"
if(istype(wear_mask, /obj/item/clothing/mask/muzzle))
var/obj/item/clothing/mask/muzzle/M = wear_mask
@@ -165,7 +165,7 @@ GLOBAL_LIST_INIT(soapy_words, list(
S.message = uppertext(S.message)
verb = "yells loudly"
if(span)
if(span && !speaks_ooc)
S.message = "<span class='[span]'>[S.message]</span>"
if(wear_mask)
+4 -1
View File
@@ -112,7 +112,10 @@ GLOBAL_LIST_EMPTY(channel_to_radio_key)
return FALSE
if(sanitize)
message = trim_strip_html_properly(message)
if(speaks_ooc)
message = sanitize(message)
else
message = sanitize_for_ic(message)
if(stat)
if(stat == DEAD)
@@ -172,9 +172,9 @@
popup.open()
/mob/living/simple_animal/pet/dog/corgi/proc/get_invslot_content()
var/dat = "<br><B>Head:</B> <A href='?src=[UID()];[inventory_head ? "remove_inv=head'>[html_encode(inventory_head)]" : "add_inv=head'>Nothing"]</A>"
dat += "<br><B>Back:</B> <A href='?src=[UID()];[inventory_back ? "remove_inv=back'>[html_encode(inventory_back)]" : "add_inv=back'>Nothing"]</A>"
dat += "<br><B>Collar:</B> <A href='?src=[UID()];[pcollar ? "remove_inv=collar'>[pcollar]" : "add_inv=collar'>Nothing"]</A>"
var/dat = "<br><b>Head:</b> <a href='?src=[UID()];[inventory_head ? "remove_inv=head'>[inventory_head]" : "add_inv=head'>Nothing"]</a>"
dat += "<br><b>Back:</b> <A href='?src=[UID()];[inventory_back ? "remove_inv=back'>[inventory_back]" : "add_inv=back'>Nothing"]</a>"
dat += "<br><b>Collar:</b> <a href='?src=[UID()];[pcollar ? "remove_inv=collar'>[pcollar]" : "add_inv=collar'>Nothing"]</a>"
return dat
@@ -134,10 +134,10 @@
var/dat = {"<table>"}
dat += "<tr><td><B>Headset:</B></td><td><A href='?src=[UID()];[ears?"remove_inv":"add_inv"]=ears'>[(ears && !(ears.flags&ABSTRACT)) ? html_encode(ears) : "<font color=grey>Empty</font>"]</A></td></tr>"
dat += "<tr><td><b>Headset:</b></td><td><a href='?src=[UID()];[ears?"remove_inv":"add_inv"]=ears'>[(ears && !(ears.flags&ABSTRACT)) ? ears : "<font color=grey>Empty</font>"]</a></td></tr>"
if(can_collar)
dat += "<tr><td>&nbsp;</td></tr>"
dat += "<tr><td><B>Collar:</B></td><td><A href='?src=[UID()];[pcollar ? "remove_inv" : "add_inv"]=collar'>[(pcollar && !(pcollar.flags&ABSTRACT)) ? html_encode(pcollar) : "<font color=grey>Empty</font>"]</A></td></tr>"
dat += "<tr><td><b>Collar:</b></td><td><a href='?src=[UID()];[pcollar ? "remove_inv" : "add_inv"]=collar'>[(pcollar && !(pcollar.flags&ABSTRACT)) ? pcollar : "<font color=grey>Empty</font>"]</a></td></tr>"
dat += {"</table>
<A href='?src=[user.UID()];mach_close=mob\ref[src]'>Close</A>
@@ -512,8 +512,8 @@
return
user.set_machine(src)
var/dat = "<table><tr><td><B>Collar:</B></td><td><A href='?src=[UID()];item=[SLOT_HUD_COLLAR]'>[(pcollar && !(pcollar.flags & ABSTRACT)) ? html_encode(pcollar) : "<font color=grey>Empty</font>"]</A></td></tr></table>"
dat += "<A href='?src=[user.UID()];mach_close=mob\ref[src]'>Close</A>"
var/dat = "<table><tr><td><b>Collar:</b></td><td><a href='?src=[UID()];item=[SLOT_HUD_COLLAR]'>[(pcollar && !(pcollar.flags & ABSTRACT)) ? pcollar : "<font color=grey>Empty</font>"]</a></td></tr></table>"
dat += "<a href='?src=[user.UID()];mach_close=mob\ref[src]'>Close</a>"
var/datum/browser/popup = new(user, "mob\ref[src]", "[src]", 440, 250)
popup.set_content(dat)
+5 -5
View File
@@ -605,11 +605,11 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
/mob/proc/show_inv(mob/user)
user.set_machine(src)
var/dat = {"<table>
<tr><td><B>Left Hand:</B></td><td><A href='?src=[UID()];item=[SLOT_HUD_LEFT_HAND]'>[(l_hand && !(l_hand.flags&ABSTRACT)) ? html_encode(l_hand) : "<font color=grey>Empty</font>"]</A></td></tr>
<tr><td><B>Right Hand:</B></td><td><A href='?src=[UID()];item=[SLOT_HUD_RIGHT_HAND]'>[(r_hand && !(r_hand.flags&ABSTRACT)) ? html_encode(r_hand) : "<font color=grey>Empty</font>"]</A></td></tr>
<tr><td><b>Left Hand:</b></td><td><a href='?src=[UID()];item=[SLOT_HUD_LEFT_HAND]'>[(l_hand && !(l_hand.flags&ABSTRACT)) ? l_hand : "<font color=grey>Empty</font>"]</a></td></tr>
<tr><td><b>Right Hand:</b></td><td><a href='?src=[UID()];item=[SLOT_HUD_RIGHT_HAND]'>[(r_hand && !(r_hand.flags&ABSTRACT)) ? r_hand : "<font color=grey>Empty</font>"]</a></td></tr>
<tr><td>&nbsp;</td></tr>"}
dat += {"</table>
<A href='?src=[user.UID()];mach_close=mob\ref[src]'>Close</A>
<a href='?src=[user.UID()];mach_close=mob\ref[src]'>Close</a>
"}
var/datum/browser/popup = new(user, "mob\ref[src]", "[src]", 440, 250)
@@ -732,7 +732,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
set category = "IC"
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = sanitize_simple(html_encode(msg), list("\n" = "<BR>"))
msg = sanitize(msg, list("\n" = "<BR>"))
var/combined = length(memory + msg)
if(mind && (combined < MAX_PAPER_MESSAGE_LEN))
@@ -772,7 +772,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
to_chat(usr, "<span class='notice'>You have to be conscious to change your flavor text</span>")
return
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = html_encode(msg)
msg = msg
flavor_text = msg
+1 -9
View File
@@ -1,7 +1,3 @@
#define ILLEGAL_CHARACTERS_LIST list("<" = "", ">" = "", \
"\[" = "", "]" = "", "{" = "", "}" = "")
/mob/proc/say()
return
@@ -26,16 +22,14 @@
else if(response == "No")
return
*/
message = replace_characters(message, ILLEGAL_CHARACTERS_LIST)
set_typing_indicator(FALSE)
usr.say(message)
/mob/verb/me_verb(message as text)
set name = "Me"
set category = "IC"
message = strip_html_properly(message)
message = sanitize(message)
set_typing_indicator(FALSE, TRUE)
if(use_me)
@@ -222,5 +216,3 @@
for(var/datum/multilingual_say_piece/S in message_pieces)
. += S.message + " "
. = trim_right(.)
#undef ILLEGAL_CHARACTERS_LIST
+4
View File
@@ -246,3 +246,7 @@
var/next_click_modifier = 1
/// Tracks the open UIs that a mob has, used in TGUI for various things, such as updating UIs
var/list/open_uis = list()
/// Does this mob speak OOC?
/// Controls whether they can say some symbols.
var/speaks_ooc = FALSE
+1
View File
@@ -87,6 +87,7 @@
/obj/effect/mob_spawn/human/alive/ghost_bar/proc/equip_item(mob/living/carbon/human/H, path, slot)
var/obj/item/I = new path(H)
H.equip_or_collect(I, slot, TRUE)
H.speaks_ooc = TRUE
return I
/obj/structure/ghost_bar_cryopod
+1 -1
View File
@@ -12,7 +12,7 @@
var/report_message = "Complete this goal."
/datum/station_goal/proc/send_report()
GLOB.minor_announcement.Announce("Priority Nanotrasen directive received. Project \"[name]\" details inbound.", "Incoming Priority Message", 'sound/AI/commandreport.ogg')
GLOB.minor_announcement.Announce("Priority Nanotrasen directive received. Project \"[html_decode(name)]\" details inbound.", "Incoming Priority Message", 'sound/AI/commandreport.ogg')
print_command_report(get_report(), "Nanotrasen Directive [pick(GLOB.phonetic_alphabet)] \Roman[rand(1,50)]", FALSE)
on_report()