aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2019-02-03 17:54:56 +0000
committerGitHub <noreply@github.com>2019-02-03 17:54:56 +0000
commit626b0b7e6a61d329e2b94a0f1ca15db6625b5e5d (patch)
tree2911a4f2c6fe048f7b2c7b393268c8695442f0c0
parent9a071d66a59bd0db72d09a3ca75b2ab9247dda92 (diff)
downloadminetest-626b0b7e6a61d329e2b94a0f1ca15db6625b5e5d.tar.gz
minetest-626b0b7e6a61d329e2b94a0f1ca15db6625b5e5d.tar.bz2
minetest-626b0b7e6a61d329e2b94a0f1ca15db6625b5e5d.zip
Add setting to hide mature content from ContentDB
-rw-r--r--builtin/mainmenu/dlg_contentstore.lua11
-rw-r--r--builtin/settingtypes.txt11
-rw-r--r--src/defaultsettings.cpp6
3 files changed, 22 insertions, 6 deletions
diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua
index ab55e3848..655e596d4 100644
--- a/builtin/mainmenu/dlg_contentstore.lua
+++ b/builtin/mainmenu/dlg_contentstore.lua
@@ -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)
diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt
index 1586e1dd6..673f66181 100644
--- a/builtin/settingtypes.txt
+++ b/builtin/settingtypes.txt
@@ -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
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 95e03b1a9..1df6dccb6 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -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