fix(report): recommend by measured skin age and align admin results

This commit is contained in:
xsl
2026-10-12 00:23:57 +08:00
parent 7518dc2307
commit 0ec5e5dc32
21 changed files with 3010 additions and 1875 deletions
+9 -1
View File
@@ -157,5 +157,13 @@ module.exports = function createAccounts(root, env = process.env) {
.concat(user.reports.filter(r => r.id !== snapshot.id)).slice(0, 5);
save();
}
return { route, session, storeReport, sameOrigin, wechatAvailable: available };
// Internal admin use only: reuse historical copy, never regenerate it.
// Not a public route; validate the stored owner and report ID before reading.
function reportPresentation(ownerId, id) {
const user = db.users.find(u => u.id === ownerId);
if (!user || !/^R[\w-]+$/.test(id)) return null;
try { return JSON.parse(fs.readFileSync(path.join(snapshots, user.id, id + '.json'), 'utf8')).presentation || null; }
catch (_) { return null; }
}
return { route, session, storeReport, reportPresentation, sameOrigin, wechatAvailable: available };
};