Updates from Gitea, step 2: the connection (check and list work on the device)

The roots (ISRG X1 and X2), an HTTPS client that reads the answer as a
stream, GiteaReleases (the latest and a list of ten), the Update
Service's requests, install from Gitea through the existing install path,
the daily check's schedule, the Check for updates setting, and console
commands: update check | list | status | install <tag>.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-06 15:20:58 +02:00
co-authored by Claude Sonnet 5.5
parent b0e8226943
commit 5754ae5b57
12 changed files with 616 additions and 3 deletions
+47
View File
@@ -0,0 +1,47 @@
#pragma once
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include <string>
#include <vector>
#include "release_info.h"
namespace roro {
// What the device knows of the project's releases on Gitea (docs/milestones/R1.md, #6): the latest,
// and a list of the last ten. The fetching runs on the Update Service's task; the screens read what
// came out, from the main loop.
class GiteaReleases {
public:
enum class Status : uint8_t { Never, Busy, Done, Failed };
static constexpr size_t kListSize = 10;
GiteaReleases() : lock_(xSemaphoreCreateMutex()) {}
// On the Update Service's task. True when the answer was read; otherwise error() says why.
bool fetchLatest();
bool fetchList();
Status status() const;
std::string error() const;
uint32_t seq() const; // grows with every answer that changed something
bool latest(release::Release& out) const; // false: not fetched yet
std::vector<release::Release> list() const;
bool find(const std::string& tag, release::Release& out) const; // in the list, or the latest
private:
bool fetch(const std::string& path, size_t max, std::vector<release::Release>& out);
void finish(bool ok, const std::string& error);
mutable SemaphoreHandle_t lock_;
Status status_ = Status::Never;
std::string error_;
uint32_t seq_ = 0;
bool haveLatest_ = false;
release::Release latest_;
std::vector<release::Release> list_;
};
} // namespace roro