Skip to content

Commit

Permalink
Add setting to hide mature content from ContentDB
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Feb 3, 2019
1 parent 9a071d6 commit 626b0b7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
11 changes: 8 additions & 3 deletions builtin/mainmenu/dlg_contentstore.lua
Expand Up @@ -285,9 +285,14 @@ function store.load()
local show_nonfree = core.settings:get_bool("show_nonfree_packages")
local url = base_url ..
"/api/packages/?type=mod&type=game&type=txp&protocol_version=" ..
core.get_max_supp_proto() ..
"&nonfree=" ..
(show_nonfree and "true" or "false")
core.get_max_supp_proto()

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)

Expand Down
11 changes: 9 additions & 2 deletions builtin/settingtypes.txt
Expand Up @@ -1941,6 +1941,13 @@ num_emerge_threads (Number of emerge threads) int 0

[Content Store]

# Show packages in the content store that do not qualify as 'free software'
# 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.
show_nonfree_packages (Show non-free packages) bool false
# 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
6 changes: 5 additions & 1 deletion src/defaultsettings.cpp
Expand Up @@ -300,7 +300,11 @@ 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");
#ifdef __ANDROID__
settings->setDefault("contentdb_flag_blacklist", "nonfree, android_default");
#else
settings->setDefault("contentdb_flag_blacklist", "nonfree, desktop_default");
#endif


// Server
Expand Down

0 comments on commit 626b0b7

Please sign in to comment.