aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcora <coradelamouche@gmx.ch>2024-03-06 03:32:53 +0100
committercora <coradelamouche@gmx.ch>2024-03-06 03:32:53 +0100
commitf91e61edb692950562b7f4e1cfccb5259e9939e8 (patch)
treea770dd737c40a3d914da0111c0a286376488f52d
parent6a77976740d3ffc1b14c04a7fe7cdc47c974d2ce (diff)
downloaddragonfireclient-simple_cheatdb.tar.xz
Add a "contentdb_url_static" setting to allow unparameterized requestssimple_cheatdb
-rw-r--r--builtin/mainmenu/dlg_contentstore.lua24
-rw-r--r--builtin/settingtypes.txt4
-rw-r--r--src/defaultsettings.cpp1
3 files changed, 20 insertions, 9 deletions
diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua
index 924e44524..e8918bd59 100644
--- a/builtin/mainmenu/dlg_contentstore.lua
+++ b/builtin/mainmenu/dlg_contentstore.lua
@@ -578,15 +578,21 @@ end
function store.load()
local version = core.get_version()
- local base_url = core.settings:get("contentdb_url")
- local url = base_url ..
- "/api/packages/?type=mod&type=game&type=txp&protocol_version=" ..
- core.get_max_supp_proto() .. "&engine_version=" .. urlencode(version.string)
-
- for _, item in pairs(core.settings:get("contentdb_flag_blacklist"):split(",")) do
- item = item:trim()
- if item ~= "" then
- url = url .. "&hide=" .. urlencode(item)
+ local static_url = core.settings:get("contentdb_url_static")
+ local url
+ if static_url and static_url ~= "" then
+ url = static_url
+ else
+ local base_url = core.settings:get("contentdb_url")
+ local url = base_url ..
+ "/api/packages/?type=mod&type=game&type=txp&protocol_version=" ..
+ core.get_max_supp_proto() .. "&engine_version=" .. urlencode(version.string)
+
+ for _, item in pairs(core.settings:get("contentdb_flag_blacklist"):split(",")) do
+ item = item:trim()
+ if item ~= "" then
+ url = url .. "&hide=" .. urlencode(item)
+ end
end
end
diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt
index 0bed1071c..e7acad597 100644
--- a/builtin/settingtypes.txt
+++ b/builtin/settingtypes.txt
@@ -2276,6 +2276,10 @@ num_emerge_threads (Number of emerge threads) int 1
# The URL for the content repository
contentdb_url (ContentDB URL) string https://content.minetest.net
+# The URL for static content repository
+# If this is set it will be used instead of the normal contentDB URL. It's purpose is to point to a static JSON file
+contentdb_url_static (Static ContentDB URL) string https://raw.githubusercontent.com/dragonfireclient/static_cheatdb/main/packages.json
+
# 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.
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index c3fe02038..d71890ab7 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -397,6 +397,7 @@ void set_default_settings()
// ContentDB
settings->setDefault("contentdb_url", "http://cheatdb.elidragon.com");
+ settings->setDefault("contentdb_url_static", "https://raw.githubusercontent.com/dragonfireclient/static_cheatdb/main/packages.json");
settings->setDefault("contentdb_max_concurrent_downloads", "3");
#ifdef __ANDROID__