Sanitization and better TGUI utilization

- Sanitizes some more things so you can't put HTML into it.
- Utilizes TGUI better to show the user the max they can post.
- Limits some things like circuits so you can't insert 50000 characters.
This commit is contained in:
C.L
2022-09-29 23:02:23 -04:00
parent 9f7e4f0d7c
commit 6236a13194
23 changed files with 67 additions and 44 deletions
@@ -154,12 +154,13 @@ list[](
var/new_data = null
switch(type_to_use)
if("string")
new_data = tgui_input_text(usr, "Now type in a string.","[src] string writing", istext(default) ? default : null)
new_data = tgui_input_text(usr, "Now type in a string.","[src] string writing", istext(default) ? default : null, MAX_NAME_LEN)
new_data = sanitize(new_data,MAX_NAME_LEN)
if(istext(new_data) && holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input [new_data] into the pin.</span>")
return new_data
if("number")
new_data = tgui_input_number(usr, "Now type in a number.","[src] number writing", isnum(default) ? default : null)
new_data = tgui_input_number(usr, "Now type in a number.","[src] number writing", isnum(default) ? default : null, MAX_NAME_LEN)
if(isnum(new_data) && holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input [new_data] into the pin.</span>")
return new_data
@@ -122,7 +122,7 @@
switch(type_to_use)
if("string")
accepting_refs = 0
new_data = tgui_input_text(usr, "Now type in a string.","[src] string writing")
new_data = tgui_input_text(usr, "Now type in a string.","[src] string writing", null, MAX_MESSAGE_LEN)
new_data = sanitizeSafe(new_data, MAX_MESSAGE_LEN, 0, 0)
if(istext(new_data) && CanInteract(user, GLOB.tgui_physical_state))
data_to_write = new_data
@@ -72,7 +72,8 @@
power_draw_per_use = 4
/obj/item/integrated_circuit/input/textpad/ask_for_input(mob/user)
var/new_input = tgui_input_text(user, "Enter some words, please.","Number pad", get_pin_data(IC_OUTPUT, 1))
var/new_input = tgui_input_text(user, "Enter some words, please.","Number pad", get_pin_data(IC_OUTPUT, 1),MAX_NAME_LEN)
new_input = sanitize(new_input,MAX_NAME_LEN)
if(istext(new_input) && CanInteract(user, GLOB.tgui_physical_state))
set_pin_data(IC_OUTPUT, 1, new_input)
push_data()
@@ -96,13 +96,14 @@
switch(type_to_use)
if("string")
accepting_refs = 0
new_data = tgui_input_text(usr, "Now type in a string.","[src] string writing")
new_data = tgui_input_text(usr, "Now type in a string.","[src] string writing", MAX_NAME_LEN)
new_data = sanitize(new_data,MAX_NAME_LEN)
if(istext(new_data) && CanInteract(user, GLOB.tgui_physical_state))
O.data = new_data
to_chat(user, "<span class='notice'>You set \the [src]'s memory to [O.display_data(O.data)].</span>")
if("number")
accepting_refs = 0
new_data = tgui_input_number(usr, "Now type in a number.","[src] number writing")
new_data = tgui_input_number(usr, "Now type in a number.","[src] number writing", MAX_NAME_LEN)
if(isnum(new_data) && CanInteract(user, GLOB.tgui_physical_state))
O.data = new_data
to_chat(user, "<span class='notice'>You set \the [src]'s memory to [O.display_data(O.data)].</span>")