mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 20:20: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:
parent
842eb67e17
commit
e153839a98
@ -31,7 +31,7 @@ local function pcm_decoder(chunk)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function report_invalid_format(format)
|
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"
|
local pp = require "cc.pretty"
|
||||||
pp.print("Run '" .. pp.text("help speaker", colours.lightGrey) .. "' for information on supported formats.")
|
pp.print("Run '" .. pp.text("help speaker", colours.lightGrey) .. "' for information on supported formats.")
|
||||||
end
|
end
|
||||||
@ -107,6 +107,7 @@ elseif cmd == "play" then
|
|||||||
elseif start == "OggS" then return report_invalid_format("Ogg")
|
elseif start == "OggS" then return report_invalid_format("Ogg")
|
||||||
elseif start == "fLaC" then return report_invalid_format("FLAC")
|
elseif start == "fLaC" then return report_invalid_format("FLAC")
|
||||||
elseif start:sub(1, 3) == "ID3" then return report_invalid_format("MP3")
|
elseif start:sub(1, 3) == "ID3" then return report_invalid_format("MP3")
|
||||||
|
elseif start == "<!DO" --[[<!DOCTYPE]] then return report_invalid_format("HTML")
|
||||||
end
|
end
|
||||||
|
|
||||||
print("Playing " .. file)
|
print("Playing " .. file)
|
||||||
|
Loading…
Reference in New Issue
Block a user