forked from Mirrorlandia_minetest/minetest
Add protocol_version and supported package types to ContentDB urls
This commit is contained in:
parent
2b83af783b
commit
14011bdc7a
@ -25,6 +25,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "content/mods.h"
|
#include "content/mods.h"
|
||||||
#include "content/subgames.h"
|
#include "content/subgames.h"
|
||||||
|
|
||||||
|
std::string Package::getDownloadURL(const std::string &baseURL) const
|
||||||
|
{
|
||||||
|
return baseURL + "/packages/" + author + "/" + name + "/releases/" +
|
||||||
|
std::to_string(release) + "/download/";
|
||||||
|
}
|
||||||
|
|
||||||
#if USE_CURL
|
#if USE_CURL
|
||||||
std::vector<Package> getPackagesFromURL(const std::string &url)
|
std::vector<Package> getPackagesFromURL(const std::string &url)
|
||||||
{
|
{
|
||||||
@ -60,5 +66,4 @@ std::vector<Package> getPackagesFromURL(const std::string &url)
|
|||||||
|
|
||||||
return packages;
|
return packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,10 +39,7 @@ struct Package
|
|||||||
type.empty() || release <= 0);
|
type.empty() || release <= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getDownloadURL(const std::string &baseURL) const
|
std::string getDownloadURL(const std::string &baseURL) const;
|
||||||
{
|
|
||||||
return baseURL + "/packages/" + author + "/" + name + "/download/";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if USE_CURL
|
#if USE_CURL
|
||||||
|
@ -191,6 +191,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define LATEST_PROTOCOL_VERSION 36
|
#define LATEST_PROTOCOL_VERSION 36
|
||||||
|
#define LATEST_PROTOCOL_VERSION_STRING TOSTRING(LATEST_PROTOCOL_VERSION)
|
||||||
|
|
||||||
// Server's supported network protocol range
|
// Server's supported network protocol range
|
||||||
#define SERVER_PROTOCOL_VERSION_MIN 36
|
#define SERVER_PROTOCOL_VERSION_MIN 36
|
||||||
|
@ -39,6 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <IFileArchive.h>
|
#include <IFileArchive.h>
|
||||||
#include <IFileSystem.h>
|
#include <IFileSystem.h>
|
||||||
#include "client/renderingengine.h"
|
#include "client/renderingengine.h"
|
||||||
|
#include "network/networkprotocol.h"
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -993,7 +994,9 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L)
|
|||||||
int ModApiMainMenu::l_get_package_list(lua_State *L)
|
int ModApiMainMenu::l_get_package_list(lua_State *L)
|
||||||
{
|
{
|
||||||
std::string url = g_settings->get("contentdb_url");
|
std::string url = g_settings->get("contentdb_url");
|
||||||
std::vector<Package> packages = getPackagesFromURL(url + "/api/packages/");
|
std::vector<Package> packages = getPackagesFromURL(url +
|
||||||
|
"/api/packages/?type=mod&type=game&type=txp&protocol_version="
|
||||||
|
LATEST_PROTOCOL_VERSION_STRING);
|
||||||
|
|
||||||
// Make table
|
// Make table
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
Loading…
Reference in New Issue
Block a user