mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
feat(master): UPDATE_STATUS from the dashboard, logged when it changes
Appended message ID 50 (dashboard -> master): the update check's state and a one-line summary. Master logs it whenever the summary changes, so the first one after master starts says when an update is out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
35
dNet/master/UpdateStatus.h
Normal file
35
dNet/master/UpdateStatus.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef __UPDATESTATUS__H__
|
||||
#define __UPDATESTATUS__H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include "BitStream.h"
|
||||
#include "BitStreamUtils.h"
|
||||
#include "DashboardMessages.h"
|
||||
#include "MessageType/Master.h"
|
||||
|
||||
/**
|
||||
* UPDATE_STATUS (dashboard -> master): what the dashboard's update check found, sent after each check and when the
|
||||
* link to master comes up, so master's log says when a newer release or newer commits are out. Nothing is updated.
|
||||
*/
|
||||
struct UpdateStatus : public LUBitStream {
|
||||
UpdateStatus() : LUBitStream(ServiceType::MASTER, MessageType::Master::UPDATE_STATUS) {}
|
||||
|
||||
static constexpr uint16_t MAX_SUMMARY = 1024;
|
||||
|
||||
// UpdateCheck::eState: 0 not checked, 1 up to date, 2 update available, 3 the check failed
|
||||
uint8_t state{};
|
||||
std::string summary; // one line for the log
|
||||
|
||||
void Serialize(RakNet::BitStream& stream) const override {
|
||||
stream.Write(state);
|
||||
DashboardMessages::WriteText(stream, summary, MAX_SUMMARY);
|
||||
}
|
||||
|
||||
bool Deserialize(RakNet::BitStream& stream) override {
|
||||
return stream.Read(state) && DashboardMessages::ReadText(stream, summary, MAX_SUMMARY);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //!__UPDATESTATUS__H__
|
||||
Reference in New Issue
Block a user