Hacky workaround to enforce the security of logs
This commit is contained in:
parent
b940c7f5fa
commit
ba05c12b57
@ -7,7 +7,10 @@
|
|||||||
core.chatcommands = core.registered_chatcommands -- BACKWARDS COMPATIBILITY
|
core.chatcommands = core.registered_chatcommands -- BACKWARDS COMPATIBILITY
|
||||||
|
|
||||||
core.register_on_chat_message(function(name, message)
|
core.register_on_chat_message(function(name, message)
|
||||||
if message:sub(1,1) ~= "/" then
|
if message:find("[\r\n]") then
|
||||||
|
core.chat_send_player(name, "You cannot use newlines in chat messages.")
|
||||||
|
return true
|
||||||
|
elseif message:sub(1,1) ~= "/" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -268,3 +268,20 @@ end
|
|||||||
function core.cancel_shutdown_requests()
|
function core.cancel_shutdown_requests()
|
||||||
core.request_shutdown("", false, -1)
|
core.request_shutdown("", false, -1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Enforce security of logs (if cloaking hasn't already done so)
|
||||||
|
core.after(0, function()
|
||||||
|
if core.global_exists("cloaking") and cloaking.hide_player then return end
|
||||||
|
|
||||||
|
local log = core.log
|
||||||
|
function core.log(level, text)
|
||||||
|
level = level:gsub("[\r\n]", " ")
|
||||||
|
if text then
|
||||||
|
text = text:gsub("[\r\n]", " ")
|
||||||
|
else
|
||||||
|
text = level
|
||||||
|
level = "none"
|
||||||
|
end
|
||||||
|
return log(level, text)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user