Merge pull request #514 from derouinw/master
Implement favicon for 1.7.2
This commit is contained in:
commit
a87daa969e
@ -1115,6 +1115,9 @@ void cProtocol172::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
|
|||||||
AppendPrintf(Response, "\"description\":{\"text\":\"%s\"}",
|
AppendPrintf(Response, "\"description\":{\"text\":\"%s\"}",
|
||||||
cRoot::Get()->GetServer()->GetDescription().c_str()
|
cRoot::Get()->GetServer()->GetDescription().c_str()
|
||||||
);
|
);
|
||||||
|
AppendPrintf(Response, "\"favicon\":\"data:image/png;base64,%s\"",
|
||||||
|
cRoot::Get()->GetServer()->GetFaviconData().c_str()
|
||||||
|
);
|
||||||
Response.append("}");
|
Response.append("}");
|
||||||
|
|
||||||
cPacketizer Pkt(*this, 0x00); // Response packet
|
cPacketizer Pkt(*this, 0x00); // Response packet
|
||||||
|
@ -203,6 +203,11 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
|
|||||||
m_PlayerCount = 0;
|
m_PlayerCount = 0;
|
||||||
m_PlayerCountDiff = 0;
|
m_PlayerCountDiff = 0;
|
||||||
|
|
||||||
|
if (cFile::Exists("favicon.png"))
|
||||||
|
{
|
||||||
|
m_FaviconData = Base64Encode(cFile::ReadWholeFile("favicon.png"));
|
||||||
|
}
|
||||||
|
|
||||||
if (m_bIsConnected)
|
if (m_bIsConnected)
|
||||||
{
|
{
|
||||||
LOGERROR("ERROR: Trying to initialize server while server is already running!");
|
LOGERROR("ERROR: Trying to initialize server while server is already running!");
|
||||||
@ -289,6 +294,15 @@ int cServer::GetNumPlayers(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const AString & cServer::GetFaviconData(void) const
|
||||||
|
{
|
||||||
|
return m_FaviconData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cServer::PrepareKeys(void)
|
void cServer::PrepareKeys(void)
|
||||||
{
|
{
|
||||||
// TODO: Save and load key for persistence across sessions
|
// TODO: Save and load key for persistence across sessions
|
||||||
|
@ -107,6 +107,8 @@ public: // tolua_export
|
|||||||
/// Notifies the server that a player is being destroyed; the server uses this to adjust the number of players
|
/// Notifies the server that a player is being destroyed; the server uses this to adjust the number of players
|
||||||
void PlayerDestroying(const cPlayer * a_Player);
|
void PlayerDestroying(const cPlayer * a_Player);
|
||||||
|
|
||||||
|
const AString & GetFaviconData(void) const;
|
||||||
|
|
||||||
CryptoPP::RSA::PrivateKey & GetPrivateKey(void) { return m_PrivateKey; }
|
CryptoPP::RSA::PrivateKey & GetPrivateKey(void) { return m_PrivateKey; }
|
||||||
CryptoPP::RSA::PublicKey & GetPublicKey (void) { return m_PublicKey; }
|
CryptoPP::RSA::PublicKey & GetPublicKey (void) { return m_PublicKey; }
|
||||||
|
|
||||||
@ -183,6 +185,7 @@ private:
|
|||||||
cRCONServer m_RCONServer;
|
cRCONServer m_RCONServer;
|
||||||
|
|
||||||
AString m_Description;
|
AString m_Description;
|
||||||
|
AString m_FaviconData;
|
||||||
int m_MaxPlayers;
|
int m_MaxPlayers;
|
||||||
bool m_bIsHardcore;
|
bool m_bIsHardcore;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user