From 25d2c1cbb68ca3e8917521213f68bd9e1ee58be3 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 3 Feb 2019 17:54:56 +0000 Subject: [PATCH] Add setting to hide mature content from ContentDB --- builtin/mainmenu/dlg_contentstore.lua | 11 ++++++++--- builtin/settingtypes.txt | 11 +++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index ab55e38..655e596 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 1586e1d..673f661 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