Archived
1
0

feat(securitytxt): add security.txt (#5827)

This commit is contained in:
Geoffrey Huntley
2022-12-06 08:43:00 +10:00
committed by GitHub
parent df49838739
commit b6adcf50c6
2 changed files with 13 additions and 0 deletions

View File

@ -81,6 +81,13 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
return res.redirect(`https://${req.headers.host}${req.originalUrl}`)
}
// Return security.txt.
if (req.originalUrl === "/security.txt" || req.originalUrl === "/.well-known/security.txt") {
const resourcePath = path.resolve(rootPath, "src/browser/security.txt")
res.set("Content-Type", getMediaMime(resourcePath))
return res.send(await fs.readFile(resourcePath))
}
// Return robots.txt.
if (req.originalUrl === "/robots.txt") {
const resourcePath = path.resolve(rootPath, "src/browser/robots.txt")