Add setting to hide mature content from ContentDB

This commit is contained in:
rubenwardy 2019-02-03 17:54:56 +00:00 committed by luk3yx
parent fe8c9a7c3e
commit 2dd9bd9abd
3 changed files with 29 additions and 3 deletions

View File

@ -285,9 +285,14 @@ function store.load()
local show_nonfree = core.settings:get_bool("show_nonfree_packages") local show_nonfree = core.settings:get_bool("show_nonfree_packages")
local url = base_url .. local url = base_url ..
"/api/packages/?type=mod&type=game&type=txp&protocol_version=" .. "/api/packages/?type=mod&type=game&type=txp&protocol_version=" ..
core.get_max_supp_proto() .. core.get_max_supp_proto()
"&nonfree=" ..
(show_nonfree and "true" or "false") for _, item in pairs(core.settings:get("contentdb_flag_blacklist"):split(",")) do
item = item:trim()
if item ~= "" then
url = url .. "&hide=" .. item
end
end
core.download_file(url, target) core.download_file(url, target)

View File

@ -1515,3 +1515,16 @@ main_menu_mod_mgr (Main menu mod manager) int 1
# Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers. # Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers.
profiler_print_interval (Engine profiling data print interval) int 0 profiler_print_interval (Engine profiling data print interval) int 0
[Content Store]
# The URL for the content repository
contentdb_url (ContentDB URL) string https://content.minetest.net
# Comma-separated list of flags to hide in the content repository.
# "nonfree" can be used to hide packages which do not qualify as 'free software',
# as defined by the Free Software Foundation.
# You can also specify content ratings.
# These flags are independent from Minetest versions,
# so see a full list at https://content.minetest.net/help/content_flags/
contentdb_flag_blacklist (ContentDB Flag Blacklist) string nonfree, desktop_default

View File

@ -255,6 +255,14 @@ void set_default_settings(Settings *settings)
settings->setDefault("font_size", font_size_str); settings->setDefault("font_size", font_size_str);
settings->setDefault("mono_font_size", font_size_str); settings->setDefault("mono_font_size", font_size_str);
settings->setDefault("contentdb_url", "https://content.minetest.net"); settings->setDefault("contentdb_url", "https://content.minetest.net");
<<<<<<< HEAD
=======
#ifdef __ANDROID__
settings->setDefault("contentdb_flag_blacklist", "nonfree, android_default");
#else
settings->setDefault("contentdb_flag_blacklist", "nonfree, desktop_default");
#endif
>>>>>>> 626b0b7e... Add setting to hide mature content from ContentDB
// Server // Server