Play Internet Sound sanity checks (#36080)

* Play Internet Sound sanity checks

Now checks if the content URL uses http(s) before playing

* HTML is not HTTP: renames regex

* Converted global regexes to procs that return them

* Revert "Converted global regexes to procs that return them"

This reverts commit 2eedbd6982b0c4de943a72c94f92f9d75001c06e.
This commit is contained in:
JJRcop
2018-03-10 20:44:09 -06:00
committed by duncathan salt
parent ee7a5648af
commit 05b320e63c
5 changed files with 20 additions and 12 deletions
+4 -2
View File
@@ -74,8 +74,7 @@
if(length(web_sound_input))
web_sound_input = trim(web_sound_input)
var/static/regex/html_protocol_regex = regex("https?://")
if(findtext(web_sound_input, ":") && !findtext(web_sound_input, html_protocol_regex))
if(findtext(web_sound_input, ":") && !findtext(web_sound_input, GLOB.is_http_protocol))
to_chat(src, "<span class='boldwarning'>Non-http(s) URIs are not allowed.</span>")
to_chat(src, "<span class='warning'>For youtube-dl shortcuts like ytsearch: please use the appropriate full url from the website.</span>")
return
@@ -124,6 +123,9 @@
web_sound_url = " "
if(web_sound_url)
if(web_sound_url != " " && !findtext(web_sound_url, GLOB.is_http_protocol))
to_chat(src, "<span class='boldwarning'>BLOCKED: Content URL not using http(s) protocol</span>")
to_chat(src, "<span class='warning'>The media provider returned a content URL that isn't using the HTTP or HTTPS protocol</span>")
for(var/m in GLOB.player_list)
var/mob/M = m
var/client/C = M.client