feat(dashboard): check GitHub for a newer release or newer commits

A worker thread asks GitHub's API about update_check_repo: the latest release
and, for development and CI builds, how far the build's commit is behind its
branch (or main). Unauthenticated, with ETags, every update_check_interval_hours
(default 6); offline or rate limited, the last answer stays next to the error
and a used-up limit waits for its reset. The main loop logs results, sends
them to master (UPDATE_STATUS, again when the link comes back) and pushes
update_check to open pages. GET /api/update_check, and
POST /api/update_check/check (settings permission, once a minute). Nothing is
downloaded or installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-30 10:47:58 -05:00
parent 4fe3b41be2
commit fcf68639e3
6 changed files with 487 additions and 1 deletions

View File

@@ -110,6 +110,7 @@
#include "DashboardAuthService.h"
#include "Totp.h"
#include "Alerts.h"
#include "UpdateChecker.h"
#include "DashboardAuthService.h"
#include "AuthTokenHandler.h"
#include "ApiKeyService.h"
@@ -539,6 +540,7 @@ int main(int argc, char** argv) {
if (!Totp::LoadKey()) LOG("Two-factor login is unavailable: no usable key");
EmailService::Initialize();
Alerts::Initialize();
UpdateChecker::Initialize();
Background::Initialize();
RegisterEconomyTasks();
RegisterMaintenanceTasks();
@@ -609,6 +611,7 @@ int main(int argc, char** argv) {
RegisterShowcaseRoutes();
FeaturedProperties::RegisterRoutes();
ContrabandRoutes::RegisterRoutes();
UpdateChecker::RegisterRoutes();
UgcRoutes::RegisterRoutes();
UgcLinks::RegisterRoutes();
PropertyRentRoutes::RegisterRoutes();
@@ -660,6 +663,7 @@ int main(int argc, char** argv) {
{ Profiler::Scope scope("PlayerActions::Update"); PlayerActions::Update(); }
{ Profiler::Scope scope("EmailService::Update"); EmailService::Update(); }
{ Profiler::Scope scope("Alerts::Update"); Alerts::Update(); }
{ Profiler::Scope scope("UpdateChecker::Update"); UpdateChecker::Update(g_Server->GetIsConnectedToMaster()); }
{ Profiler::Scope scope("Background::Update"); Background::Update(); }
{ Profiler::Scope scope("ModeratorHelper::Update"); ModeratorHelper::Update(); }
{ Profiler::Scope scope("Scheduler::Update"); Scheduler::Update(); }
@@ -698,6 +702,7 @@ int main(int argc, char** argv) {
ModeratorHelper::Shutdown();
Background::Shutdown();
Alerts::Shutdown();
UpdateChecker::Shutdown();
Database::Destroy("DashboardServer");
delete g_Server;
g_Server = nullptr;