fix: Update nightly update detection logic to work with release changes

This commit is contained in:
WerWolv
2025-08-09 12:10:25 +02:00
parent 14ee688629
commit fd2d50508b
4 changed files with 29 additions and 6 deletions

View File

@@ -51,11 +51,16 @@ namespace hex::plugin::builtin {
}
// Check if the response is valid
if (!releases.contains("published_at") || !releases["published_at"].is_string())
if (!releases.contains("assets") || !releases["assets"].is_array())
return;
const auto nightlyUpdateTime = hex::parseTime("%FT%TZ", releases["published_at"].get<std::string>());
if (nightlyUpdateTime.has_value() && *nightlyUpdateTime > std::chrono::system_clock::now()) {
const auto firstAsset = releases["assets"].front();
if (!firstAsset.is_object() || !firstAsset.contains("updated_at"))
return;
const auto nightlyUpdateTime = hex::parseTime("%Y-%m-%dT%H:%M:%SZ", firstAsset["updated_at"].get<std::string>());
const auto imhexBuildTime = ImHexApi::System::getBuildTime();
if (nightlyUpdateTime.has_value() && imhexBuildTime.has_value() && *nightlyUpdateTime > *imhexBuildTime) {
updateString = "Nightly";
}
} else {