Merge pull request #59 from shocknet/feature/last-seen-middleware

Last seen middleware
This commit is contained in:
Daniel Lugo 2020-04-18 18:45:25 -04:00 committed by GitHub
commit 56ed910e69

View file

@ -147,6 +147,14 @@ module.exports = async (
return true;
};
const lastSeenMiddleware = (req, res, next) => {
const { authorization } = req.headers
const { path, method } = req
if (!unprotectedRoutes[method][path] && authorization && GunDB.isAuthenticated()) {
GunActions.setLastSeenApp()
}
}
const unlockWallet = password =>
new Promise((resolve, reject) => {
try {
@ -303,6 +311,8 @@ module.exports = async (
}
});
app.use(lastSeenMiddleware);
app.use(["/ping"], responseTime());
/**