summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_mainmenu.cpp
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-12-11 04:43:14 +0000
committerParamat <paramat@users.noreply.github.com>2018-12-11 04:43:14 +0000
commitf318366c20e6c134d600c0f8fa212186035ea8e3 (patch)
tree2e89bb75271cc80903e9664608c979f616eecab6 /src/script/lua_api/l_mainmenu.cpp
parenta833bee9edaeb6df69d1e510759a7b33915a41e0 (diff)
downloadminetest-f318366c20e6c134d600c0f8fa212186035ea8e3.tar.gz
minetest-f318366c20e6c134d600c0f8fa212186035ea8e3.tar.bz2
minetest-f318366c20e6c134d600c0f8fa212186035ea8e3.zip
Fix ContentDB packages timing out by using download_file instead (#7891)
Diffstat (limited to 'src/script/lua_api/l_mainmenu.cpp')
-rw-r--r--src/script/lua_api/l_mainmenu.cpp64
1 files changed, 0 insertions, 64 deletions
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index 39a3f3a62..f0f56098f 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -991,68 +991,6 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L)
return 1;
}
-int ModApiMainMenu::l_get_package_list(lua_State *L)
-{
- std::string url = g_settings->get("contentdb_url");
- bool show_nonfree = g_settings->getBool("show_nonfree_packages");
- std::vector<Package> packages = getPackagesFromURL(url +
- "/api/packages/?type=mod&type=game&type=txp&protocol_version="
- LATEST_PROTOCOL_VERSION_STRING "&nonfree=" +
- (show_nonfree ? "true" : "false"));
-
- // Make table
- lua_newtable(L);
- int top = lua_gettop(L);
- unsigned int index = 1;
-
- // Fill table
- for (const auto &package : packages) {
- lua_pushnumber(L, index);
- lua_newtable(L);
-
- int top_lvl2 = lua_gettop(L);
-
- lua_pushstring(L, "author");
- lua_pushstring(L, package.author.c_str());
- lua_settable (L, top_lvl2);
-
- lua_pushstring(L, "name");
- lua_pushstring(L, package.name.c_str());
- lua_settable (L, top_lvl2);
-
- lua_pushstring(L, "title");
- lua_pushstring(L, package.title.c_str());
- lua_settable (L, top_lvl2);
-
- lua_pushstring(L, "type");
- lua_pushstring(L, package.type.c_str());
- lua_settable (L, top_lvl2);
-
- lua_pushstring(L, "short_description");
- lua_pushstring(L, package.shortDesc.c_str());
- lua_settable (L, top_lvl2);
-
- lua_pushstring (L, "release");
- lua_pushinteger(L, package.release);
- lua_settable (L, top_lvl2);
-
- if (package.thumbnail != "") {
- lua_pushstring(L, "thumbnail");
- lua_pushstring(L, package.thumbnail.c_str());
- lua_settable (L, top_lvl2);
- }
-
- lua_pushstring(L, "url");
- lua_pushstring(L, package.getDownloadURL(url).c_str());
- lua_settable (L, top_lvl2);
-
- lua_settable(L, top);
- index++;
- }
-
- return 1;
-}
-
/******************************************************************************/
int ModApiMainMenu::l_get_min_supp_proto(lua_State *L)
{
@@ -1123,7 +1061,6 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
API_FCT(get_video_drivers);
API_FCT(get_video_modes);
API_FCT(get_screen_info);
- API_FCT(get_package_list);
API_FCT(get_min_supp_proto);
API_FCT(get_max_supp_proto);
API_FCT(do_async_callback);
@@ -1147,5 +1084,4 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
//API_FCT(extract_zip); //TODO remove dependency to GuiEngine
API_FCT(download_file);
//API_FCT(gettext); (gettext lib isn't threadsafe)
- API_FCT(get_package_list);
}