updater fixed

This commit is contained in:
NuklearRabbit
2026-07-28 00:03:33 +02:00
parent f990c26014
commit d4d77c827a
18 changed files with 451 additions and 71 deletions
+14 -3
View File
@@ -279,7 +279,7 @@ class UpdateService {
));
if (!release || release.draft || release.prerelease) {
const error = new Error(
`ForgeFlow ${update.remoteVersion} has no published binary release yet.`,
`ForgeFlow ${update.remoteVersion} has no published binary release yet. The source branch was updated, but the matching Windows installer/portable assets were not published. Run Publish-Missing-Binary-Release.ps1 from the release source or publish the four required assets in Gitea.`,
);
error.code = "BINARY_RELEASE_NOT_FOUND";
throw error;
@@ -305,18 +305,29 @@ class UpdateService {
update.repo,
release.id,
asset.id,
{ downloadUrl: asset.browser_download_url },
),
this.gitea.downloadReleaseAsset(
update.owner,
update.repo,
release.id,
checksumAsset.id,
{ downloadUrl: checksumAsset.browser_download_url },
),
]);
if (binary.length < 1_000_000 || binary[0] !== 0x4d || binary[1] !== 0x5a) {
throw new Error(
"The downloaded Windows update is not a valid executable.",
const preview = binary.subarray(0, 200).toString("utf8").trim();
const looksLikeMetadata =
/^\s*[{[]/.test(preview) || /browser_download_url/i.test(preview);
const error = new Error(
looksLikeMetadata
? "Gitea returned release-asset metadata instead of the Windows executable. Upgrade ForgeFlow with the 0.9.1 installer once; later in-app updates use the actual browser download URL."
: "The downloaded Windows update is not a valid executable.",
);
error.code = looksLikeMetadata
? "RELEASE_ASSET_METADATA_RECEIVED"
: "INVALID_WINDOWS_UPDATE";
throw error;
}
const expectedSha256 = checksumBytes
.toString("utf8")