Start work on auth fetch middleware
All checks were successful
/ docker (push) Successful in 4m12s

This commit is contained in:
Melody Becker 2025-04-16 16:43:57 +02:00
parent b00f5e9777
commit 7eac1db475
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
4 changed files with 111 additions and 5 deletions

View file

@ -12,12 +12,14 @@ var errorDescriptions = map[string]string{
"db-failure": "The database query for this request failed for an undisclosed reason. This is often caused by bad input data conflicting with existing information. Try to submit different data or wait for some time",
"bad-request-data": "The data provided in the request doesn't match the requirements, see problem details' detail field for more information",
"bad-page": "The provided page number was not valid. See response details for more information",
"bad-accept-mime-type": "The requested mime type is not supported for the target url",
"invalid-auth-signature": "The requested URL requires verification via authorized fetch. See https://swicg.github.io/activitypub-http-signature/ and https://datatracker.ietf.org/doc/html/rfc9421 (not implemented yet) for details on how to verify your request",
}
func errorTypeHandler(w http.ResponseWriter, r *http.Request) {
errName := r.PathValue("name")
if description, ok := errorDescriptions[errName]; ok {
fmt.Fprint(w, description)
_, _ = fmt.Fprint(w, description)
} else {
webutils.ProblemDetailsStatusOnly(w, 404)
}