mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2025-12-15 10:55:07 +00:00
Add dnt-policy.txt
This commit is contained in:
18
src/site/api/dnt_policy.js
Normal file
18
src/site/api/dnt_policy.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const fs = require("fs")
|
||||
const pj = require("path").join
|
||||
const {render} = require("pinski/plugins")
|
||||
const constants = require("../../lib/constants")
|
||||
|
||||
module.exports = [
|
||||
{route: "/\\.well-known/dnt-policy\\.txt", methods: ["GET"], code: async () => {
|
||||
if (constants.does_not_track) {
|
||||
return {
|
||||
statusCode: 200,
|
||||
contentType: "text/plain",
|
||||
stream: fs.createReadStream(pj(__dirname, "../html/.well-known/dnt-policy.txt"))
|
||||
}
|
||||
} else {
|
||||
return render(404, "pug/404.pug")
|
||||
}
|
||||
}}
|
||||
]
|
||||
Reference in New Issue
Block a user