Fixes the PDA Messenger not decoding HTML tags (#15236)

* Messenger Fix V1

Co-Authored-By: moxian <moxian@users.noreply.github.com>

* Messenger Fix V1.1

Now with 100% less javascript!

Co-authored-by: moxian <moxian@users.noreply.github.com>
This commit is contained in:
SabreML
2021-01-21 21:03:25 +00:00
committed by GitHub
co-authored by moxian
parent 0783f87ce2
commit 2c2bd88cd7
4 changed files with 8 additions and 16 deletions
-9
View File
@@ -38,15 +38,6 @@
t = replacetext(t, char, repl_chars[char])
return t
/proc/readd_quotes(var/t)
var/list/repl_chars = list("&#34;" = "\"")
for(var/char in repl_chars)
var/index = findtext(t, char)
while(index)
t = copytext(t, 1, index) + repl_chars[char] + copytext(t, index+5)
index = findtext(t, char)
return t
//Runs byond's sanitization proc along-side sanitize_simple
/proc/sanitize(var/t,var/list/repl_chars = null)
return html_encode(sanitize_simple(t,repl_chars))
+3 -1
View File
@@ -87,7 +87,9 @@
//If the computer is being hacked or is emagged, display the reboot message.
if(hacking || emag)
message = rebootmsg
var/dat = "<head><title>Message Monitor Console</title></head><body>"
var/dat = "<head><title>Message Monitor Console</title>"
dat += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /></head>"
dat += "<body>"
dat += "<center><h2>Message Monitor Console</h2></center><hr>"
dat += "<center><h4><font color='blue'[message]</h5></center>"
+1 -1
View File
@@ -55,7 +55,7 @@
note = "Congratulations, your station has chosen the [pda.model_name]!"
/datum/data/pda/app/notekeeper/update_ui(mob/user as mob, list/data)
data["note"] = note // current pda notes
data["note"] = html_decode(note) // current pda notes
/datum/data/pda/app/notekeeper/ui_act(action, params)
if(..())
+4 -5
View File
@@ -28,8 +28,8 @@
data["messages"] = tnote
for(var/c in tnote)
if(c["target"] == active_conversation)
data["convo_name"] = sanitize(c["owner"])
data["convo_job"] = sanitize(c["job"])
data["convo_name"] = c["owner"]
data["convo_job"] = c["job"]
break
else
var/list/convopdas = list()
@@ -113,7 +113,6 @@
if(!t)
return
t = sanitize(copytext(t, 1, MAX_MESSAGE_LEN))
t = readd_quotes(t)
if(!t || !istype(P))
return
if(!in_range(pda, U) && pda.loc != U)
@@ -171,8 +170,8 @@
useMS.send_pda_message("[P.owner]","[pda.owner]","[t]")
tnote.Add(list(list("sent" = 1, "owner" = "[P.owner]", "job" = "[P.ownjob]", "message" = "[t]", "target" = "[P.UID()]")))
PM.tnote.Add(list(list("sent" = 0, "owner" = "[pda.owner]", "job" = "[pda.ownjob]", "message" = "[t]", "target" = "[pda.UID()]")))
tnote.Add(list(list("sent" = 1, "owner" = "[P.owner]", "job" = "[P.ownjob]", "message" = "[html_decode(t)]", "target" = "[P.UID()]")))
PM.tnote.Add(list(list("sent" = 0, "owner" = "[pda.owner]", "job" = "[pda.ownjob]", "message" = "[html_decode(t)]", "target" = "[pda.UID()]")))
pda.investigate_log("<span class='game say'>PDA Message - <span class='name'>[U.key] - [pda.owner]</span> -> <span class='name'>[P.owner]</span>: <span class='message'>[t]</span></span>", "pda")
// Show it to ghosts