[MIRROR] Encode changes (#11301)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-08-04 16:23:19 -07:00
committed by GitHub
parent 5e6a4639d0
commit 4e2361f8df
202 changed files with 370 additions and 408 deletions

View File

@@ -80,7 +80,7 @@
if(W.has_tool_quality(TOOL_SCREWDRIVER))
playsound(src, W.usesound, 50, 1)
var/input = sanitize(tgui_input_text(user, "Which networks would you like to connect this camera to? Separate networks with a comma. No Spaces!\nFor example: "+using_map.station_short+",Security,Secret ", "Set Network", camera_network ? camera_network : NETWORK_DEFAULT))
var/input = tgui_input_text(user, "Which networks would you like to connect this camera to? Separate networks with a comma. No Spaces!\nFor example: "+using_map.station_short+",Security,Secret ", "Set Network", camera_network ? camera_network : NETWORK_DEFAULT, MAX_MESSAGE_LEN)
if(!input)
to_chat(user, "No input found please hang up and try your call again.")
return
@@ -92,7 +92,7 @@
var/area/camera_area = get_area(src)
var/temptag = "[sanitize(camera_area.name)] ([rand(1, 999)])"
input = sanitizeSafe(tgui_input_text(user, "How would you like to name the camera?", "Set Camera Name", camera_name ? camera_name : temptag), MAX_NAME_LEN)
input = sanitizeSafe(tgui_input_text(user, "How would you like to name the camera?", "Set Camera Name", camera_name ? camera_name : temptag, MAX_NAME_LEN, encode = FALSE), MAX_NAME_LEN)
state = 4
var/obj/machinery/camera/C = new(src.loc)

View File

@@ -205,7 +205,7 @@
if(is_authenticated() && modify)
var/t1 = params["assign_target"]
if(t1 == "Custom")
var/temp_t = sanitize(tgui_input_text(ui.user, "Enter a custom job assignment.","Assignment"), 45)
var/temp_t = tgui_input_text(ui.user, "Enter a custom job assignment.","Assignment", "", 45)
//let custom jobs function as an impromptu alt title, mainly for sechuds
if(temp_t && modify)
modify.assignment = temp_t

View File

@@ -197,7 +197,7 @@
if(nam)
giv_name = nam
if("reason")
var/reas = sanitize(tgui_input_text(ui.user, "Reason why pass is issued", "Reason", reason))
var/reas = tgui_input_text(ui.user, "Reason why pass is issued", "Reason", reason, MAX_MESSAGE_LEN)
if(reas)
reason = reas
if("duration")

View File

@@ -82,7 +82,7 @@
to_chat(ui.user, "Unauthorized Access.")
. = TRUE
if("warn")
var/warning = sanitize(tgui_input_text(ui.user, "Message:", "Enter your message here!", ""))
var/warning = tgui_input_text(ui.user, "Message:", "Enter your message here!", "", MAX_MESSAGE_LEN)
if(!warning)
return
var/obj/item/implant/I = locate(params["imp"])

View File

@@ -228,7 +228,7 @@
return FALSE
var/timeout = world.time + 600
var/reason = sanitize(tgui_input_text(ui.user, "Reason:","Why do you require this item?",""))
var/reason = tgui_input_text(ui.user, "Reason:","Why do you require this item?","", MAX_MESSAGE_LEN)
if(world.time > timeout)
to_chat(ui.user, span_warning("Error. Request timed out."))
return FALSE
@@ -282,7 +282,7 @@
return FALSE
var/timeout = world.time + 600
var/reason = sanitize(tgui_input_text(ui.user, "Reason:","Why do you require this item?",""))
var/reason = tgui_input_text(ui.user, "Reason:","Why do you require this item?","", MAX_MESSAGE_LEN)
if(world.time > timeout)
to_chat(ui.user, span_warning("Error. Request timed out."))
return FALSE
@@ -325,7 +325,7 @@
return FALSE
if(!(authorization & SUP_ACCEPT_ORDERS))
return FALSE
var/new_val = sanitize(tgui_input_text(ui.user, params["edit"], "Enter the new value for this field:", params["default"]))
var/new_val = tgui_input_text(ui.user, params["edit"], "Enter the new value for this field:", params["default"], MAX_MESSAGE_LEN)
if(!new_val)
return FALSE
@@ -400,7 +400,7 @@
if(!field)
return FALSE
var/new_val = sanitize(tgui_input_text(ui.user, field, "Enter the new value for this field:", L[lowertext(field)]))
var/new_val = tgui_input_text(ui.user, field, "Enter the new value for this field:", L[lowertext(field)], MAX_MESSAGE_LEN)
if(!new_val)
return
@@ -443,7 +443,7 @@
return FALSE
if(!(authorization & SUP_ACCEPT_ORDERS))
return FALSE
var/new_val = sanitize(tgui_input_text(ui.user, params["edit"], "Enter the new value for this field:", params["default"]))
var/new_val = tgui_input_text(ui.user, params["edit"], "Enter the new value for this field:", params["default"], MAX_MESSAGE_LEN)
if(!new_val)
return

View File

@@ -305,7 +305,7 @@
if(auth)
var/t1 = href_list["assign"]
if(t1 == "Custom")
var/temp_t = sanitize(tgui_input_text(usr, "Enter a custom job assignment.","Assignment"))
var/temp_t = tgui_input_text(usr, "Enter a custom job assignment.","Assignment", "", MAX_MESSAGE_LEN)
if(temp_t)
t1 = temp_t
set_default_access(t1)

View File

@@ -129,7 +129,7 @@
if(default_deconstruction_screwdriver(user, W))
return
else if(panel_open && istype(W, /obj/item/pen))
var/t = sanitizeSafe(tgui_input_text(user, "Enter the name for \the [src].", src.name, initial(src.name), MAX_NAME_LEN), MAX_NAME_LEN)
var/t = sanitizeSafe(tgui_input_text(user, "Enter the name for \the [src].", src.name, initial(src.name), MAX_NAME_LEN, encode = FALSE), MAX_NAME_LEN)
if(t && in_range(src, user))
name = t
else if(panel_open && istype(W, /obj/item/multitool))

View File

@@ -313,7 +313,7 @@
if(speed <= 0)
speed = 1
if("setpath")
var/newpath = sanitize(tgui_input_text(usr, "Please define a new path!",,path))
var/newpath = tgui_input_text(usr, "Please define a new path!",,path, MAX_MESSAGE_LEN)
if(newpath && newpath != "")
moving = 0 // stop moving
path = newpath

View File

@@ -28,7 +28,7 @@
if(istype(I, /obj/item/multitool))
if(panel_open)
var/input = sanitize(tgui_input_text(user, "What id would you like to give this conveyor?", "Multitool-Conveyor interface", id))
var/input = tgui_input_text(user, "What id would you like to give this conveyor?", "Multitool-Conveyor interface", id, MAX_KEYPAD_INPUT_LEN)
if(!input)
to_chat(user, "No input found please hang up and try your call again.")
return

View File

@@ -150,7 +150,7 @@ Transponder Codes:<UL>"}
usr.set_machine(src)
if(href_list["locedit"])
var/newloc = sanitize(tgui_input_text(usr, "Enter New Location", "Navigation Beacon", location, MAX_NAME_LEN))
var/newloc = tgui_input_text(usr, "Enter New Location", "Navigation Beacon", location, MAX_NAME_LEN)
if(newloc)
location = newloc
updateDialog()
@@ -159,13 +159,11 @@ Transponder Codes:<UL>"}
var/codekey = href_list["code"]
var/newkey = tgui_input_text(usr, "Enter Transponder Code Key", "Navigation Beacon", codekey, MAX_NAME_LEN)
newkey = sanitize(newkey,MAX_NAME_LEN)
if(!newkey)
return
var/codeval = codes[codekey]
var/newval = tgui_input_text(usr, "Enter Transponder Code Value", "Navigation Beacon", codeval, MAX_NAME_LEN)
newval = sanitize(newval,MAX_NAME_LEN)
if(!newval)
newval = codekey
return
@@ -183,12 +181,10 @@ Transponder Codes:<UL>"}
else if(href_list["add"])
var/newkey = tgui_input_text(usr, "Enter New Transponder Code Key", "Navigation Beacon", null, MAX_NAME_LEN)
newkey = sanitize(newkey,MAX_NAME_LEN)
if(!newkey)
return
var/newval = tgui_input_text(usr, "Enter New Transponder Code Value", "Navigation Beacon", null, MAX_NAME_LEN)
newval = sanitize(newval,MAX_NAME_LEN)
if(!newval)
newval = "1"
return

View File

@@ -448,11 +448,11 @@ GLOBAL_LIST_BOILERPLATE(allCasters, /obj/machinery/newscaster)
return TRUE
if("set_new_message")
msg = sanitize(tgui_input_text(ui.user, "Write your Feed story", "Network Channel Handler", multiline = TRUE, prevent_enter = TRUE))
msg = sanitize(tgui_input_text(ui.user, "Write your Feed story", "Network Channel Handler","", MAX_MESSAGE_LEN, TRUE, encode = FALSE, prevent_enter = TRUE), MAX_MESSAGE_LEN, FALSE, FALSE, TRUE)
return TRUE
if("set_new_title")
title = sanitize(tgui_input_text(ui.user, "Enter your Feed title", "Network Channel Handler"))
title = tgui_input_text(ui.user, "Enter your Feed title", "Network Channel Handler", "", MAX_KEYPAD_INPUT_LEN)
return TRUE
if("set_attachment")

View File

@@ -95,7 +95,6 @@ GLOBAL_LIST_BOILERPLATE(pointdefense_turrets, /obj/machinery/pointdefense)
/obj/machinery/pointdefense_control/attackby(var/obj/item/W, var/mob/user)
if(W?.has_tool_quality(TOOL_MULTITOOL))
var/new_ident = tgui_input_text(user, "Enter a new ident tag.", "[src]", id_tag, MAX_NAME_LEN)
new_ident = sanitize(new_ident,MAX_NAME_LEN)
if(new_ident && new_ident != id_tag && user.Adjacent(src) && CanInteract(user, GLOB.tgui_physical_state))
// Check for duplicate controllers with this ID
for(var/obj/machinery/pointdefense_control/PC as anything in GLOB.pointdefense_controllers)
@@ -170,7 +169,6 @@ GLOBAL_LIST_BOILERPLATE(pointdefense_turrets, /obj/machinery/pointdefense)
/obj/machinery/pointdefense/attackby(var/obj/item/W, var/mob/user)
if(W?.has_tool_quality(TOOL_MULTITOOL))
var/new_ident = tgui_input_text(user, "Enter a new ident tag.", "[src]", id_tag, MAX_NAME_LEN)
new_ident = sanitize(new_ident,MAX_NAME_LEN)
if(new_ident && new_ident != id_tag && user.Adjacent(src))
to_chat(user, span_notice("You register [src] with the [new_ident] network."))
id_tag = new_ident

View File

@@ -1078,7 +1078,7 @@
return
if(istype(I, /obj/item/pen)) //you can rename turrets like bots!
var/t = sanitizeSafe(tgui_input_text(user, "Enter new turret name", name, finish_name, MAX_NAME_LEN), MAX_NAME_LEN)
var/t = sanitizeSafe(tgui_input_text(user, "Enter new turret name", name, finish_name, MAX_NAME_LEN, encode = FALSE), MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, user) && loc != user)

View File

@@ -148,7 +148,7 @@ GLOBAL_LIST_EMPTY_TYPED(allConsoles, /obj/machinery/requests_console)
if(reject_bad_text(params["write"]))
recipient = params["write"] //write contains the string of the receiving department's name
var/new_message = sanitize(tgui_input_text(ui.user, "Write your message:", "Awaiting Input", ""))
var/new_message = tgui_input_text(ui.user, "Write your message:", "Awaiting Input", "", MAX_MESSAGE_LEN)
if(new_message)
message = new_message
screen = RCS_MESSAUTH
@@ -164,7 +164,7 @@ GLOBAL_LIST_EMPTY_TYPED(allConsoles, /obj/machinery/requests_console)
. = TRUE
if("writeAnnouncement")
var/new_message = sanitize(tgui_input_text(ui.user, "Write your message:", "Awaiting Input", ""))
var/new_message = tgui_input_text(ui.user, "Write your message:", "Awaiting Input", "", MAX_MESSAGE_LEN)
if(new_message)
message = new_message
else
@@ -233,7 +233,7 @@ GLOBAL_LIST_EMPTY_TYPED(allConsoles, /obj/machinery/requests_console)
if(computer_deconstruction_screwdriver(user, O))
return
if(istype(O, /obj/item/multitool))
var/input = sanitize(tgui_input_text(user, "What Department ID would you like to give this request console?", "Multitool-Request Console Interface", department))
var/input = tgui_input_text(user, "What Department ID would you like to give this request console?", "Multitool-Request Console Interface", department, MAX_MESSAGE_LEN)
if(!input)
to_chat(user, "No input found. Please hang up and try your call again.")
return

View File

@@ -129,7 +129,6 @@
if("network")
var/newnet = tgui_input_text(ui.user, "Which network do you want to view?", "Comm Monitor", network, 15)
newnet = sanitize(newnet,15)
if(newnet && ((ui.user in range(1, src)) || issilicon(ui.user)))
if(length(newnet) > 15)

View File

@@ -295,8 +295,7 @@
. = TRUE
if("network")
var/newnet = tgui_input_text(ui.user, "Specify the new network for this machine. This will break all current links.", src, network)
newnet = sanitize(newnet,15)
var/newnet = tgui_input_text(ui.user, "Specify the new network for this machine. This will break all current links.", src, network, 15)
if(newnet && canAccess(ui.user))
if(length(newnet) > 15)

View File

@@ -101,7 +101,6 @@
if("network")
var/newnet = tgui_input_text(ui.user, "Which network do you want to view?", "Comm Monitor", network, 15)
newnet = sanitize(newnet,15) //Honestly, I'd be amazed if someone managed to do HTML in 15 chars.
if(newnet && ((ui.user in range(1, src)) || issilicon(ui.user)))
if(length(newnet) > 15)
set_temp("FAILED: NETWORK TAG STRING TOO LENGTHY", "bad")

View File

@@ -191,7 +191,6 @@
if(href_list["network"])
var/newnet = tgui_input_text(usr, "Which network do you want to view?", "Comm Monitor", network, 15)
newnet = sanitize(newnet,15)
if(newnet && ((usr in range(1, src)) || issilicon(usr)))
if(length(newnet) > 15)

View File

@@ -137,7 +137,7 @@
SEND_SIGNAL(avatar, COMSIG_HUMAN_DNA_FINALIZED)
var/newname = sanitize(tgui_input_text(avatar, "Your mind feels foggy. You're certain your name is [occupant.real_name], but it could also be [avatar.name]. Would you like to change it to something else?", "Name change", null, MAX_NAME_LEN), MAX_NAME_LEN)
var/newname = tgui_input_text(avatar, "Your mind feels foggy. You're certain your name is [occupant.real_name], but it could also be [avatar.name]. Would you like to change it to something else?", "Name change", null, MAX_NAME_LEN)
if (newname)
avatar.real_name = newname
@@ -147,7 +147,7 @@
else
// There's only one body per one of these pods, so let's be kind.
var/newname = sanitize(tgui_input_text(avatar, "Your mind feels foggy. You're certain your name is [occupant.real_name], but it feels like it is [avatar.name]. Would you like to change it to something else?", "Name change", null, MAX_NAME_LEN), MAX_NAME_LEN)
var/newname = tgui_input_text(avatar, "Your mind feels foggy. You're certain your name is [occupant.real_name], but it feels like it is [avatar.name]. Would you like to change it to something else?", "Name change", null, MAX_NAME_LEN)
if(newname)
avatar.real_name = newname
avatar.name = newname

View File

@@ -325,7 +325,7 @@
avatar.Sleeping(1)
// Prompt for username after they've enterred the body.
var/newname = sanitize(tgui_input_text(avatar, "You are entering virtual reality. Your username is currently [src.name]. Would you like to change it to something else?", "Name change", null, MAX_NAME_LEN), MAX_NAME_LEN)
var/newname = tgui_input_text(avatar, "You are entering virtual reality. Your username is currently [src.name]. Would you like to change it to something else?", "Name change", null, MAX_NAME_LEN)
if(newname)
avatar.real_name = newname
avatar.name = newname

View File

@@ -84,6 +84,6 @@
avatar.virtual_reality_mob = TRUE
log_and_message_admins("[key_name_admin(avatar)] joined virtual reality from the ghost menu.")
var/newname = sanitize(tgui_input_text(avatar, "You are entering virtual reality. Your username is currently [src.name]. Would you like to change it to something else?", "Name change", null, MAX_NAME_LEN), MAX_NAME_LEN)
var/newname = tgui_input_text(avatar, "You are entering virtual reality. Your username is currently [src.name]. Would you like to change it to something else?", "Name change", null, MAX_NAME_LEN)
if(newname)
avatar.real_name = newname