fix wrong note about unofficial build when it wasn't yet outdated

This commit is contained in:
13xforever
2025-08-07 16:08:49 +05:00
parent 39597427f2
commit 133521ae57
2 changed files with 8 additions and 7 deletions

View File

@@ -439,12 +439,13 @@ internal static partial class LogParserResult
if (items["game_mod"] is string mod)
notes.Add($"⚠️ Game files modification present: `{mod.Trim(20)}`");
var updateInfo = await CheckForUpdateAsync(items).ConfigureAwait(false);
var buildBranch = items["build_branch"]?.ToLowerInvariant();
var (updateInfo, isTooOld) = await CheckForUpdateAsync(items).ConfigureAwait(false);
if (updateInfo is not null
&& isTooOld
&& (buildBranch is "master" or "head" or "spu_perf"
|| buildBranch is not {Length: >0}
&& (updateInfo.X64?.CurrentBuild is not null || updateInfo.Arm?.CurrentBuild is not null)))
&& (updateInfo.X64?.CurrentBuild is not null || updateInfo.Arm?.CurrentBuild is not null)))
{
string prefix = "⚠️";
string timeDeltaStr;

View File

@@ -775,10 +775,10 @@ internal static partial class LogParserResult
}
}
private static async ValueTask<UpdateInfo?> CheckForUpdateAsync(NameValueCollection items)
private static async ValueTask<(UpdateInfo? updateInfo, bool isTooOld)> CheckForUpdateAsync(NameValueCollection items)
{
if (string.IsNullOrEmpty(items["build_and_specs"]))
return null;
return default;
var currentBuildCommit = items["build_commit"];
if (string.IsNullOrEmpty(currentBuildCommit))
@@ -793,13 +793,13 @@ internal static partial class LogParserResult
?? updateInfo.Arm?.LatestBuild.Linux?.Download
?? updateInfo.Arm?.LatestBuild.Mac?.Download;
if (updateInfo.ReturnCode is not StatusCode.UpdatesAvailable || link is null)
return null;
return default;
var latestBuildInfo = BuildInfoInUpdate().Match(link.ToLowerInvariant());
if (latestBuildInfo.Success && VersionIsTooOld(items, latestBuildInfo, updateInfo))
return updateInfo;
return (updateInfo, true);
return null;
return (updateInfo, false);
}
private static bool VersionIsTooOld(NameValueCollection items, Match update, UpdateInfo updateInfo)