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(
|
||||
function(param)
|
||||
local http = core.get_http_api()
|
||||
local url = ("%s/list%s?proto_version_min=%d&proto_version_max=%d"):format(
|
||||
core.settings:get("serverlist_url"),
|
||||
(PLATFORM == "Android" or PLATFORM == "iOS" or PLATFORM == "OSX") and "_prod" or "",
|
||||
local serverlist = core.settings:get("serverlist_url")
|
||||
local address = ("%s/list%s"):format(serverlist,
|
||||
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_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
|
||||
|
||||
# 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
|
||||
# Multiplayer Tab.
|
||||
@ -1016,7 +1016,10 @@ server_url (Server URL) string https://minetest.net
|
||||
server_announce (Announce server) bool false
|
||||
|
||||
# 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
|
||||
# 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.
|
||||
# type: string
|
||||
# serverlist_url = servers.minetest.net
|
||||
# serverlist_url = servers.multicraft.world
|
||||
|
||||
# File in client/serverlist/ that contains your favorite servers displayed in the
|
||||
# Multiplayer Tab.
|
||||
@ -1211,7 +1211,11 @@
|
||||
|
||||
# Announce to this serverlist.
|
||||
# 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
|
||||
# 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("name", "");
|
||||
settings->setDefault("bind_address", "");
|
||||
settings->setDefault("serverlist_url", "servers.minetest.net");
|
||||
settings->setDefault("serverlist_url", "servers.multicraft.world");
|
||||
|
||||
// Client
|
||||
settings->setDefault("address", "");
|
||||
@ -374,6 +374,7 @@ void set_default_settings()
|
||||
settings->setDefault("compat_send_original_model", "true");
|
||||
settings->setDefault("disable_escape_sequences", "false");
|
||||
settings->setDefault("strip_color_codes", "false");
|
||||
settings->setDefault("announce_mt", "true");
|
||||
#if USE_PROMETHEUS
|
||||
settings->setDefault("prometheus_listener_address", "127.0.0.1:30000");
|
||||
#endif
|
||||
@ -506,8 +507,6 @@ void set_default_settings()
|
||||
|
||||
// Shaders work but may reduce performance on iGPU
|
||||
settings->setDefault("enable_shaders", "false");
|
||||
|
||||
settings->setDefault("serverlist_url", "servers.multicraft.world");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
@ -526,7 +525,6 @@ void set_default_settings()
|
||||
settings->setDefault("pause_on_lost_focus", "true");
|
||||
settings->setDefault("max_objects_per_block", "16");
|
||||
settings->setDefault("doubletap_jump", "true");
|
||||
settings->setDefault("serverlist_url", "servers.multicraft.world");
|
||||
settings->setDefault("gui_scaling_filter_txr2img", "false");
|
||||
settings->setDefault("autosave_screensize", "false");
|
||||
|
||||
|
@ -32,6 +32,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
namespace ServerList
|
||||
{
|
||||
#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,
|
||||
const u16 port,
|
||||
const std::vector<std::string> &clients_names,
|
||||
@ -43,7 +63,6 @@ void sendAnnounce(AnnounceAction action,
|
||||
const std::vector<ModSpec> &mods,
|
||||
bool dedicated)
|
||||
{
|
||||
static const char *aa_names[] = {"start", "update", "delete"};
|
||||
Json::Value server;
|
||||
server["action"] = aa_names[action];
|
||||
server["port"] = port;
|
||||
@ -52,7 +71,6 @@ void sendAnnounce(AnnounceAction action,
|
||||
}
|
||||
if (action != AA_DELETE) {
|
||||
bool strict_checking = g_settings->getBool("strict_protocol_version_checking");
|
||||
#define y base64_decode("c2VydmVycy5tdWx0aWNyYWZ0Lndvcmxk")
|
||||
server["name"] = g_settings->get("server_name");
|
||||
server["description"] = g_settings->get("server_description");
|
||||
server["version"] = g_version_string;
|
||||
@ -90,24 +108,10 @@ void sendAnnounce(AnnounceAction action,
|
||||
server["lag"] = lag;
|
||||
}
|
||||
|
||||
if (action == AA_START) {
|
||||
actionstream << "Announcing " << aa_names[action] << " to " <<
|
||||
g_settings->get("serverlist_url") << std::endl;
|
||||
} else {
|
||||
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);
|
||||
const std::string json = fastWriteJson(server);
|
||||
sendAnnounceInner(action, json, g_settings->get("serverlist_url"));
|
||||
if (g_settings->getBool("announce_mt"))
|
||||
sendAnnounceInner(action, json, base64_decode("c2VydmVycy5taW5ldGVzdC5uZXQ"));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user