1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 04:00:30 +00:00

Detect playing HTML files in speaker

Goes someway towards preventing people playing YouTube or non-raw GitHub
files.
This commit is contained in:
Jonathan Coates 2023-05-26 10:19:42 +01:00
parent 842eb67e17
commit e153839a98
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06

View File

@ -31,7 +31,7 @@ local function pcm_decoder(chunk)
end
local function report_invalid_format(format)
printError(("The speaker cannot play %s files."):format(format))
printError(("speaker cannot play %s files."):format(format))
local pp = require "cc.pretty"
pp.print("Run '" .. pp.text("help speaker", colours.lightGrey) .. "' for information on supported formats.")
end
@ -107,6 +107,7 @@ elseif cmd == "play" then
elseif start == "OggS" then return report_invalid_format("Ogg")
elseif start == "fLaC" then return report_invalid_format("FLAC")
elseif start:sub(1, 3) == "ID3" then return report_invalid_format("MP3")
elseif start == "<!DO" --[[<!DOCTYPE]] then return report_invalid_format("HTML")
end
print("Playing " .. file)