fix(report): recommend by measured skin age and align admin results
This commit is contained in:
+9
-1
@@ -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 };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user