Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rubenwardy authored and paramat committed Nov 8, 2018
1 parent bd81b5e commit b1112f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/defaultsettings.cpp
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/script/lua_api/l_mainmenu.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit b1112f6

Please sign in to comment.