[feature] Use ETag for robots.txt to prevent mishaps

This commit is contained in:
tobi 2025-02-24 10:28:33 +01:00
commit 4e6874ac96
3 changed files with 10 additions and 1 deletions

View file

@ -49,9 +49,13 @@ func (m *Module) Route(attachHandler func(method string, path string, f ...gin.H
}
func (m *Module) robotsGETHandler(c *gin.Context) {
const ETag = "\"" + apiutil.RobotsTxtETag + "\""
c.Header("ETag", ETag)
c.String(http.StatusOK, apiutil.RobotsTxt)
}
func (m *Module) robotsGETHandlerDisallowNodeInfo(c *gin.Context) {
const ETag = "\"" + apiutil.RobotsTxtDisallowNodeInfoETag + "\""
c.Header("ETag", ETag)
c.String(http.StatusOK, apiutil.RobotsTxtDisallowNodeInfo)
}