fix http security leak
parent
e4fdfa60bf
commit
4fe069abac
|
@ -1,3 +1,4 @@
|
|||
local http = core.request_http_api()
|
||||
local make_fs = i3.files.gui()
|
||||
|
||||
IMPORT("gmatch", "split")
|
||||
|
@ -22,13 +23,13 @@ function i3.register_craft(def)
|
|||
local width, c = 0, 0
|
||||
|
||||
if true_str(def.url) then
|
||||
if not i3.http then
|
||||
if not http then
|
||||
return err(fmt([[i3.register_craft(): Unable to reach %s.
|
||||
No HTTP support for this mod: add it to the `secure.http_mods` or
|
||||
`secure.trusted_mods` setting.]], def.url))
|
||||
end
|
||||
|
||||
i3.http.fetch({url = def.url}, function(result)
|
||||
http.fetch({url = def.url}, function(result)
|
||||
if result.succeeded then
|
||||
local t = core.parse_json(result.data)
|
||||
if is_table(t) then
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
local http = core.request_http_api()
|
||||
local replacements = {fuel = {}}
|
||||
|
||||
IMPORT("maxn", "copy", "insert", "sort", "match", "sub")
|
||||
|
@ -269,13 +270,13 @@ local function init_recipes()
|
|||
resolve_aliases(_select)
|
||||
sort(i3.init_items)
|
||||
|
||||
if i3.http and true_str(i3.export_url) then
|
||||
if http and true_str(i3.export_url) then
|
||||
local post_data = {
|
||||
recipes = i3.recipes_cache,
|
||||
usages = i3.usages_cache,
|
||||
}
|
||||
|
||||
i3.http.fetch_async {
|
||||
http.fetch_async {
|
||||
url = i3.export_url,
|
||||
post_data = core.write_json(post_data),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue