refactor(manifest): restructure backend integrity manifest to include metadata and adjust file verification logic
This commit is contained in:
@@ -108,9 +108,12 @@ function verifyBackendIntegrity(exeDir) {
|
||||
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
||||
const issues = [];
|
||||
|
||||
const filesToVerify = manifest.files || manifest;
|
||||
const metadata = manifest._metadata || {};
|
||||
|
||||
// The exeDir is build/exe when running or unpacked
|
||||
// we only care about files in the manifest
|
||||
for (const [relPath, expectedHash] of Object.entries(manifest)) {
|
||||
for (const [relPath, expectedHash] of Object.entries(filesToVerify)) {
|
||||
const fullPath = path.join(exeDir, relPath);
|
||||
if (!fs.existsSync(fullPath)) {
|
||||
issues.push(`Missing: ${relPath}`);
|
||||
@@ -124,6 +127,10 @@ function verifyBackendIntegrity(exeDir) {
|
||||
}
|
||||
}
|
||||
|
||||
if (issues.length > 0 && metadata.date && metadata.time) {
|
||||
issues.unshift(`Backend build timestamp: ${metadata.date} ${metadata.time}`);
|
||||
}
|
||||
|
||||
return {
|
||||
ok: issues.length === 0,
|
||||
issues: issues,
|
||||
|
||||
Reference in New Issue
Block a user