summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2023-05-05 12:37:13 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2023-05-05 22:12:57 +0200
commitb398fedc0cfe7394ae8e9df59964620fa23a79c2 (patch)
treec05623f1a14c74ae89f72b31b0610a5432b184c3
parentad07c93e31ec9cf6ecc508bf8df79ab62c24823e (diff)
downloadmanaserv-b398fedc0cfe7394ae8e9df59964620fa23a79c2.tar.gz
manaserv-b398fedc0cfe7394ae8e9df59964620fa23a79c2.tar.bz2
manaserv-b398fedc0cfe7394ae8e9df59964620fa23a79c2.tar.xz
manaserv-b398fedc0cfe7394ae8e9df59964620fa23a79c2.zip
Added net_stellarLoginUrl configuration
The client needs to know the URL to open in the browser. The bare token is still sent as well, which might allow the client to directly interact with a Stellar wallet in the future.
-rw-r--r--src/account-server/accounthandler.cpp5
-rw-r--r--src/common/manaserv_protocol.h2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index a59e1aa1..2e4e5c04 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -134,6 +134,7 @@ private:
std::string mUpdateHost;
std::string mDataUrl;
+ std::string mStellarLoginUrl;
using IPsToTime = std::map<int, time_t>;
IPsToTime mLastLoginAttemptForIP;
@@ -154,7 +155,8 @@ AccountHandler::AccountHandler(const std::string &attributesFile):
mMaxCharacters(Configuration::getValue("account_maxCharacters", 3)),
mRegistrationAllowed(Configuration::getBoolValue("account_allowRegister", true)),
mUpdateHost(Configuration::getValue("net_defaultUpdateHost", std::string())),
- mDataUrl(Configuration::getValue("net_clientDataUrl", std::string()))
+ mDataUrl(Configuration::getValue("net_clientDataUrl", std::string())),
+ mStellarLoginUrl(Configuration::getValue("net_stellarLoginUrl", std::string()))
{
XML::Document doc(attributesFile);
xmlNodePtr node = doc.rootNode();
@@ -392,6 +394,7 @@ void AccountHandler::handleStellarLoginMessage(AccountClient &client, MessageIn
reply.writeInt8(ERRMSG_OK);
reply.writeString(client.stellarToken);
+ reply.writeString(mStellarLoginUrl + "?token=" + client.stellarToken);
client.send(reply);
}
diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h
index 77b8e5ac..7d5c694f 100644
--- a/src/common/manaserv_protocol.h
+++ b/src/common/manaserv_protocol.h
@@ -80,7 +80,7 @@ enum {
PAMSG_LOGIN_RNDTRGR = 0x0015, // S username
APMSG_LOGIN_RNDTRGR_RESPONSE = 0x0016, // S random seed
PAMSG_STELLAR_LOGIN = 0x0017, // D version
- APMSG_STELLAR_LOGIN_RESPONSE = 0x0018, // B error, S token
+ APMSG_STELLAR_LOGIN_RESPONSE = 0x0018, // B error, S token, S url
PAMSG_CHAR_CREATE = 0x0020, // S name, B hair style, B hair color, B gender, B slot, {W stats}*
APMSG_CHAR_CREATE_RESPONSE = 0x0021, // B error, on success: B slot, S name, B gender, B hair style, B hair color,
// W character points, W correction points, B amount of items equipped,