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