forked from MTSR/telegram
We don't need insecure environment to load a local file
This commit is contained in:
parent
5807ed7b92
commit
20bbdbfa49
17
init.lua
17
init.lua
@ -16,24 +16,11 @@ local UPDATES_LIMIT = 10
|
|||||||
local offset = 0
|
local offset = 0
|
||||||
local http_in_progress = false
|
local http_in_progress = false
|
||||||
|
|
||||||
local ie, req_ie = _G, minetest.request_insecure_environment
|
local JSON = dofile(modpath .. "/JSON.lua")
|
||||||
if req_ie then ie = req_ie() end
|
|
||||||
|
|
||||||
if not ie then
|
|
||||||
error("The mod requires access to insecure functions in order "..
|
|
||||||
"to work. Please add the mod to your secure.trusted_mods "..
|
|
||||||
"setting or disable the mod.")
|
|
||||||
end
|
|
||||||
|
|
||||||
ie.package.path = ie.package.path
|
|
||||||
.. ";" .. modpath .. "/?.lua"
|
|
||||||
|
|
||||||
|
|
||||||
local JSON = ie.require("JSON")
|
|
||||||
|
|
||||||
http_api = minetest.request_http_api()
|
http_api = minetest.request_http_api()
|
||||||
if not http_api then
|
if not http_api then
|
||||||
error("HTTP API cannot be enabled.")
|
error("HTTP API cannot be enabled. Add the mods to trusted.")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function make_request(method, request_body, callback)
|
local function make_request(method, request_body, callback)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user