Harden root screen containment

This commit is contained in:
Drew Ritter
2026-06-10 18:25:03 -07:00
committed by Drew Ritter
parent 5f3b317741
commit c4cde1eed9
2 changed files with 89 additions and 2 deletions

View File

@@ -186,8 +186,10 @@ function getNewestScreen() {
.filter(f => !f.startsWith('.') && f.endsWith('.html'))
.map(f => {
const fp = path.join(CONTENT_DIR, f);
if (!isRegularFileInsideContentDir(fp)) return null;
return { path: fp, mtime: fs.statSync(fp).mtime.getTime() };
})
.filter(Boolean)
.sort((a, b) => b.mtime - a.mtime);
return files.length > 0 ? files[0].path : null;
}