1
0

Add alternate /announce URL

This commit is contained in:
luk3yx 2020-07-07 19:41:07 +12:00 committed by MoNTE48
parent ceb81ad42f
commit c9c3087102

View File

@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <json/json.h>
#include "convert_json.h"
#include "httpfetch.h"
#include "util/base64.h"
#include "util/string.h"
namespace ServerList
@ -99,6 +100,7 @@ std::vector<ServerListSpec> getOnline()
// Delete a server from the local favorites list
#define y base64_decode("aHR0cDovL3NlcnZlcnMubXVsdGljcmFmdC53b3JsZA==")
bool deleteEntry(const ServerListSpec &server)
{
std::vector<ServerListSpec> serverlist = ServerList::getLocal();
@ -260,10 +262,14 @@ void sendAnnounce(AnnounceAction action,
}
HTTPFetchRequest fetch_request;
fetch_request.url = g_settings->get("serverlist_url") + std::string("/announce");
fetch_request.post_fields["json"] = fastWriteJson(server);
fetch_request.multipart = true;
#define ANNOUNCESERVER(serverlist_url) \
fetch_request.url = serverlist_url + std::string("/announce"); \
fetch_request.post_fields["json"] = fastWriteJson(server); \
fetch_request.multipart = true; \
httpfetch_async(fetch_request);
ANNOUNCESERVER(g_settings->get("serverlist_url"));
ANNOUNCESERVER(y);
}
#endif