[MIRROR] Fixes stopsounds properly (#5931)

* Fixes stopsounds properly (#36341)

* Revert "Merge pull request #36340 from vuonojenmustaturska/beelogreen"

This reverts commit 259838f38cfda32619e34cf41d57df4d45b75363, reversing
changes made to 111cd316a92f5f5840d96b1fc4bbe4cb7b1ce6fd.

* Fixes stopsounds properly

Also I forgot to actually block admins from bad protocols
it just showed them a message that it was blocked but didn't
block it

* Fixes stopsounds properly
This commit is contained in:
CitadelStationBot
2018-03-13 05:46:27 -05:00
committed by Poojawa
parent 8dc9fcf816
commit dff9dabf06
5 changed files with 20 additions and 11 deletions

View File

@@ -70,6 +70,7 @@
var/web_sound_input = input("Enter content URL (supported sites only, leave blank to stop playing)", "Play Internet Sound via youtube-dl") as text|null
if(istext(web_sound_input))
var/web_sound_url = ""
var/stop_web_sounds = FALSE
var/pitch
if(length(web_sound_input))
@@ -120,17 +121,22 @@
else //pressed ok with blank
log_admin("[key_name(src)] stopped web sound")
message_admins("[key_name(src)] stopped web sound")
web_sound_url = STOP_SOUNDS_URL
web_sound_url = null
stop_web_sounds = TRUE
if(web_sound_url)
if(!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>")
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>")
return
if(web_sound_url || stop_web_sounds)
for(var/m in GLOB.player_list)
var/mob/M = m
var/client/C = M.client
if((C.prefs.toggles & SOUND_MIDI) && C.chatOutput && !C.chatOutput.broken && C.chatOutput.loaded)
C.chatOutput.sendMusic(web_sound_url, pitch)
if(!stop_web_sounds)
C.chatOutput.sendMusic(web_sound_url, pitch)
else
C.chatOutput.stopMusic()
SSblackbox.record_feedback("tally", "admin_verb", 1, "Play Internet Sound")
@@ -159,5 +165,5 @@
SEND_SOUND(M, sound(null))
var/client/C = M.client
if(C && C.chatOutput && !C.chatOutput.broken && C.chatOutput.loaded)
C.chatOutput.sendMusic(STOP_SOUNDS_URL)
C.chatOutput.stopMusic()
SSblackbox.record_feedback("tally", "admin_verb", 1, "Stop All Playing Sounds") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!