chore: update Angular cache and TypeScript build info files

This commit is contained in:
2025-09-30 21:37:49 -04:00
parent 81d7f1f7c2
commit fe4c968367
29 changed files with 2719 additions and 98 deletions
+19 -2
View File
@@ -478,9 +478,26 @@ app.put('/api/vault/bookmarks', (req, res) => {
}
}
// Write bookmarks
// Create backup before writing
const backupPath = bookmarksPath + '.bak';
if (fs.existsSync(bookmarksPath)) {
fs.copyFileSync(bookmarksPath, backupPath);
}
// Atomic write: write to temp file, then rename
const tempPath = bookmarksPath + '.tmp';
const content = JSON.stringify(req.body, null, 2);
fs.writeFileSync(bookmarksPath, content, 'utf-8');
try {
fs.writeFileSync(tempPath, content, 'utf-8');
fs.renameSync(tempPath, bookmarksPath);
} catch (writeError) {
// If write failed, restore backup if it exists
if (fs.existsSync(backupPath)) {
fs.copyFileSync(backupPath, bookmarksPath);
}
throw writeError;
}
const newRev = calculateSimpleHash(content);
res.json({ rev: newRev });