OTA bypass gitea local ip
All checks were successful
Build Release / build (push) Successful in 1m20s

This commit is contained in:
2026-08-16 19:46:29 +02:00
parent d80600863a
commit 2949e8c110
4 changed files with 214 additions and 140 deletions

View File

@@ -92,24 +92,15 @@ CheckInfo checkForUpdate() {
strncpy(info.latestVersion, (tag[0] == 'v' || tag[0] == 'V') ? tag + 1 : tag,
sizeof(info.latestVersion) - 1);
// Use browser_download_url from the API response — this contains the
// external proxy URL (https://git.rasmusbendtsen.dk/...) which the
// ESP32 can reach through the proxy.
JsonArray assets = doc["assets"];
for (JsonObject asset : assets) {
const char* name = asset["name"] | "";
if (strcmp(name, "firmware.bin") == 0) {
const char* dlUrl = asset["browser_download_url"] | "";
strncpy(info.downloadUrl, dlUrl, sizeof(info.downloadUrl) - 1);
break;
}
}
// Construct download URL from the tag name using Gitea's standard
// release asset pattern. browser_download_url from the API contains
// the internal IP (http://192.168.0.37:3000/...) which the ESP32
// cannot use — it needs the external proxy URL.
String dlUrl = String("https://git.rasmusbendtsen.dk/rasmus/flyradar/releases/download/")
+ String(tag) + "/firmware.bin";
strncpy(info.downloadUrl, dlUrl.c_str(), sizeof(info.downloadUrl) - 1);
if (!info.downloadUrl[0]) {
Serial.printf("[OTA] Check failed: Release v%s has no firmware.bin attachment.\n",
info.latestVersion);
return info;
}
Serial.printf("[OTA] Download URL: %s\n", info.downloadUrl);
int cmp = compareVersions(info.latestVersion, Config::APP_VERSION);
info.result = (cmp > 0) ? CheckResult::UpdateAvailable : CheckResult::UpToDate;