aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-11-08 21:59:56 +0000
committerParamat <paramat@users.noreply.github.com>2018-11-08 21:59:56 +0000
commitb1112f663b83cd745423e5dbef99461aed8dc329 (patch)
treef8b8fa72300ba9cc8152c3d90ec617442c3e6f8f
parentbd81b5e4c820716d7d7d039132002517cb27d699 (diff)
downloadminetest-b1112f663b83cd745423e5dbef99461aed8dc329.tar.gz
minetest-b1112f663b83cd745423e5dbef99461aed8dc329.tar.bz2
minetest-b1112f663b83cd745423e5dbef99461aed8dc329.zip
Content store: Add setting to filter non-free packages (#7766)
Defaulting to hiding in order to help with Debian/etc distribution. This could be changed at a later date.
-rw-r--r--src/defaultsettings.cpp1
-rw-r--r--src/script/lua_api/l_mainmenu.cpp6
2 files changed, 5 insertions, 2 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index e692424e0..9ae2daa0b 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -285,6 +285,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("font_size", font_size_str);
settings->setDefault("mono_font_size", font_size_str);
settings->setDefault("contentdb_url", "https://content.minetest.net");
+ settings->setDefault("show_nonfree_packages", "false");
// Server
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index c2f0f6e3a..39a3f3a62 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -993,10 +993,12 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L)
int ModApiMainMenu::l_get_package_list(lua_State *L)
{
- std::string url = g_settings->get("contentdb_url");
+ 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);
+ LATEST_PROTOCOL_VERSION_STRING "&nonfree=" +
+ (show_nonfree ? "true" : "false"));
// Make table
lua_newtable(L);