Switch to MultiCraft server list (#43)
Co-authored-by: Maksim <MoNTE48@mail.ua>
This commit is contained in:
parent
3b200d6e48
commit
5722b9ad23
@ -72,9 +72,11 @@ function serverlistmgr.sync()
|
|||||||
core.handle_async(
|
core.handle_async(
|
||||||
function(param)
|
function(param)
|
||||||
local http = core.get_http_api()
|
local http = core.get_http_api()
|
||||||
local url = ("%s/list%s?proto_version_min=%d&proto_version_max=%d"):format(
|
local serverlist = core.settings:get("serverlist_url")
|
||||||
core.settings:get("serverlist_url"),
|
local address = ("%s/list%s"):format(serverlist,
|
||||||
(PLATFORM == "Android" or PLATFORM == "iOS" or PLATFORM == "OSX") and "_prod" or "",
|
serverlist == minetest.decode_base64("c2VydmVycy5tdWx0aWNyYWZ0Lndvcmxk") and "_prod" or "")
|
||||||
|
local url = ("%s?proto_version_min=%d&proto_version_max=%d"):format(
|
||||||
|
address,
|
||||||
core.get_min_supp_proto(),
|
core.get_min_supp_proto(),
|
||||||
core.get_max_supp_proto())
|
core.get_max_supp_proto())
|
||||||
|
|
||||||
|
@ -972,7 +972,7 @@ enable_remote_media_server (Connect to external media server) bool true
|
|||||||
enable_client_modding (Client modding) bool false
|
enable_client_modding (Client modding) bool false
|
||||||
|
|
||||||
# URL to the server list displayed in the Multiplayer Tab.
|
# URL to the server list displayed in the Multiplayer Tab.
|
||||||
serverlist_url (Serverlist URL) string servers.minetest.net
|
serverlist_url (Serverlist URL) string servers.multicraft.world
|
||||||
|
|
||||||
# File in client/serverlist/ that contains your favorite servers displayed in the
|
# File in client/serverlist/ that contains your favorite servers displayed in the
|
||||||
# Multiplayer Tab.
|
# Multiplayer Tab.
|
||||||
@ -1016,7 +1016,10 @@ server_url (Server URL) string https://minetest.net
|
|||||||
server_announce (Announce server) bool false
|
server_announce (Announce server) bool false
|
||||||
|
|
||||||
# Announce to this serverlist.
|
# Announce to this serverlist.
|
||||||
serverlist_url (Serverlist URL) string servers.minetest.net
|
serverlist_url (Serverlist URL) string servers.multicraft.world
|
||||||
|
|
||||||
|
# Announce to MT serverlist.
|
||||||
|
# announce_mt (Announce to MT) bool true
|
||||||
|
|
||||||
# Remove color codes from incoming chat messages
|
# Remove color codes from incoming chat messages
|
||||||
# Use this to stop players from being able to use color in their messages
|
# Use this to stop players from being able to use color in their messages
|
||||||
|
@ -1153,7 +1153,7 @@
|
|||||||
|
|
||||||
# URL to the server list displayed in the Multiplayer Tab.
|
# URL to the server list displayed in the Multiplayer Tab.
|
||||||
# type: string
|
# type: string
|
||||||
# serverlist_url = servers.minetest.net
|
# serverlist_url = servers.multicraft.world
|
||||||
|
|
||||||
# File in client/serverlist/ that contains your favorite servers displayed in the
|
# File in client/serverlist/ that contains your favorite servers displayed in the
|
||||||
# Multiplayer Tab.
|
# Multiplayer Tab.
|
||||||
@ -1211,7 +1211,11 @@
|
|||||||
|
|
||||||
# Announce to this serverlist.
|
# Announce to this serverlist.
|
||||||
# type: string
|
# type: string
|
||||||
# serverlist_url = servers.minetest.net
|
# serverlist_url = servers.multicraft.world
|
||||||
|
|
||||||
|
# Announce to MT serverlist.
|
||||||
|
# type: bool
|
||||||
|
# announce_mt = true
|
||||||
|
|
||||||
# Remove color codes from incoming chat messages
|
# Remove color codes from incoming chat messages
|
||||||
# Use this to stop players from being able to use color in their messages
|
# Use this to stop players from being able to use color in their messages
|
||||||
|
@ -48,7 +48,7 @@ void set_default_settings()
|
|||||||
settings->setDefault("language", "");
|
settings->setDefault("language", "");
|
||||||
settings->setDefault("name", "");
|
settings->setDefault("name", "");
|
||||||
settings->setDefault("bind_address", "");
|
settings->setDefault("bind_address", "");
|
||||||
settings->setDefault("serverlist_url", "servers.minetest.net");
|
settings->setDefault("serverlist_url", "servers.multicraft.world");
|
||||||
|
|
||||||
// Client
|
// Client
|
||||||
settings->setDefault("address", "");
|
settings->setDefault("address", "");
|
||||||
@ -374,6 +374,7 @@ void set_default_settings()
|
|||||||
settings->setDefault("compat_send_original_model", "true");
|
settings->setDefault("compat_send_original_model", "true");
|
||||||
settings->setDefault("disable_escape_sequences", "false");
|
settings->setDefault("disable_escape_sequences", "false");
|
||||||
settings->setDefault("strip_color_codes", "false");
|
settings->setDefault("strip_color_codes", "false");
|
||||||
|
settings->setDefault("announce_mt", "true");
|
||||||
#if USE_PROMETHEUS
|
#if USE_PROMETHEUS
|
||||||
settings->setDefault("prometheus_listener_address", "127.0.0.1:30000");
|
settings->setDefault("prometheus_listener_address", "127.0.0.1:30000");
|
||||||
#endif
|
#endif
|
||||||
@ -506,8 +507,6 @@ void set_default_settings()
|
|||||||
|
|
||||||
// Shaders work but may reduce performance on iGPU
|
// Shaders work but may reduce performance on iGPU
|
||||||
settings->setDefault("enable_shaders", "false");
|
settings->setDefault("enable_shaders", "false");
|
||||||
|
|
||||||
settings->setDefault("serverlist_url", "servers.multicraft.world");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREENGUI
|
#ifdef HAVE_TOUCHSCREENGUI
|
||||||
@ -526,7 +525,6 @@ void set_default_settings()
|
|||||||
settings->setDefault("pause_on_lost_focus", "true");
|
settings->setDefault("pause_on_lost_focus", "true");
|
||||||
settings->setDefault("max_objects_per_block", "16");
|
settings->setDefault("max_objects_per_block", "16");
|
||||||
settings->setDefault("doubletap_jump", "true");
|
settings->setDefault("doubletap_jump", "true");
|
||||||
settings->setDefault("serverlist_url", "servers.multicraft.world");
|
|
||||||
settings->setDefault("gui_scaling_filter_txr2img", "false");
|
settings->setDefault("gui_scaling_filter_txr2img", "false");
|
||||||
settings->setDefault("autosave_screensize", "false");
|
settings->setDefault("autosave_screensize", "false");
|
||||||
|
|
||||||
|
@ -32,6 +32,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
namespace ServerList
|
namespace ServerList
|
||||||
{
|
{
|
||||||
#if USE_CURL
|
#if USE_CURL
|
||||||
|
static const char *aa_names[] = {"start", "update", "delete"};
|
||||||
|
|
||||||
|
void sendAnnounceInner(const AnnounceAction action, const std::string &json,
|
||||||
|
const std::string &serverlist_url) {
|
||||||
|
if (action == AA_START) {
|
||||||
|
actionstream << "Announcing " << aa_names[action] << " to " <<
|
||||||
|
serverlist_url << std::endl;
|
||||||
|
} else {
|
||||||
|
infostream << "Announcing " << aa_names[action] << " to " <<
|
||||||
|
serverlist_url << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
HTTPFetchRequest fetch_request;
|
||||||
|
fetch_request.url = serverlist_url + std::string("/announce");
|
||||||
|
fetch_request.method = HTTP_POST;
|
||||||
|
fetch_request.fields["json"] = json;
|
||||||
|
fetch_request.multipart = true;
|
||||||
|
httpfetch_async(fetch_request);
|
||||||
|
}
|
||||||
|
|
||||||
void sendAnnounce(AnnounceAction action,
|
void sendAnnounce(AnnounceAction action,
|
||||||
const u16 port,
|
const u16 port,
|
||||||
const std::vector<std::string> &clients_names,
|
const std::vector<std::string> &clients_names,
|
||||||
@ -43,7 +63,6 @@ void sendAnnounce(AnnounceAction action,
|
|||||||
const std::vector<ModSpec> &mods,
|
const std::vector<ModSpec> &mods,
|
||||||
bool dedicated)
|
bool dedicated)
|
||||||
{
|
{
|
||||||
static const char *aa_names[] = {"start", "update", "delete"};
|
|
||||||
Json::Value server;
|
Json::Value server;
|
||||||
server["action"] = aa_names[action];
|
server["action"] = aa_names[action];
|
||||||
server["port"] = port;
|
server["port"] = port;
|
||||||
@ -52,7 +71,6 @@ void sendAnnounce(AnnounceAction action,
|
|||||||
}
|
}
|
||||||
if (action != AA_DELETE) {
|
if (action != AA_DELETE) {
|
||||||
bool strict_checking = g_settings->getBool("strict_protocol_version_checking");
|
bool strict_checking = g_settings->getBool("strict_protocol_version_checking");
|
||||||
#define y base64_decode("c2VydmVycy5tdWx0aWNyYWZ0Lndvcmxk")
|
|
||||||
server["name"] = g_settings->get("server_name");
|
server["name"] = g_settings->get("server_name");
|
||||||
server["description"] = g_settings->get("server_description");
|
server["description"] = g_settings->get("server_description");
|
||||||
server["version"] = g_version_string;
|
server["version"] = g_version_string;
|
||||||
@ -90,24 +108,10 @@ void sendAnnounce(AnnounceAction action,
|
|||||||
server["lag"] = lag;
|
server["lag"] = lag;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == AA_START) {
|
const std::string json = fastWriteJson(server);
|
||||||
actionstream << "Announcing " << aa_names[action] << " to " <<
|
sendAnnounceInner(action, json, g_settings->get("serverlist_url"));
|
||||||
g_settings->get("serverlist_url") << std::endl;
|
if (g_settings->getBool("announce_mt"))
|
||||||
} else {
|
sendAnnounceInner(action, json, base64_decode("c2VydmVycy5taW5ldGVzdC5uZXQ"));
|
||||||
infostream << "Announcing " << aa_names[action] << " to " <<
|
|
||||||
g_settings->get("serverlist_url") << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTPFetchRequest fetch_request;
|
|
||||||
#define ANNOUNCESERVER(serverlist_url) \
|
|
||||||
fetch_request.url = serverlist_url + std::string("/announce"); \
|
|
||||||
fetch_request.method = HTTP_POST; \
|
|
||||||
fetch_request.fields["json"] = fastWriteJson(server); \
|
|
||||||
fetch_request.multipart = true; \
|
|
||||||
httpfetch_async(fetch_request);
|
|
||||||
|
|
||||||
ANNOUNCESERVER(g_settings->get("serverlist_url"));
|
|
||||||
ANNOUNCESERVER(y);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user