Opt out of Google Chrome tracking everything you do
Add `Permissions-Policy: interest-cohort=()` header to all responses.
This commit is contained in:
parent
391f2734d8
commit
523e43d26d
|
@ -81,7 +81,7 @@ if (!fastify.siteConfig.email_host || !fastify.siteConfig.email_username) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Every request, check to see if a valid token exists
|
// Every request, check to see if a valid token exists
|
||||||
fastify.addHook('onRequest', async (request, reply) => {
|
fastify.addHook('onRequest', async (request, reply, done) => {
|
||||||
request.isLoggedInUser = false;
|
request.isLoggedInUser = false;
|
||||||
if (typeof request.cookies.token !== 'undefined' && fastify.jwt.verify(request.cookies.token)) {
|
if (typeof request.cookies.token !== 'undefined' && fastify.jwt.verify(request.cookies.token)) {
|
||||||
const { id } = fastify.jwt.verify(request.cookies.token);
|
const { id } = fastify.jwt.verify(request.cookies.token);
|
||||||
|
@ -101,6 +101,12 @@ fastify.addHook('onRequest', async (request, reply) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
request.language = typeof request.cookies.lang !== 'undefined' ? request.cookies.lang : 'en';
|
request.language = typeof request.cookies.lang !== 'undefined' ? request.cookies.lang : 'en';
|
||||||
|
|
||||||
|
// Opt out of Google Chrome tracking everything you do.
|
||||||
|
// For more info, see: https://plausible.io/blog/google-floc
|
||||||
|
reply.header('Permissions-Policy', 'interest-cohort=()');
|
||||||
|
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Store i18n files in fastify object and register locales routes
|
// Store i18n files in fastify object and register locales routes
|
||||||
|
@ -119,4 +125,4 @@ fastify.listen(fastify.siteConfig.port, function (err, address) {
|
||||||
fastify.log.error(err);
|
fastify.log.error(err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue