Update paste report webhook request

This commit is contained in:
Lukas Schulte Pelkum 2021-07-24 17:03:40 +02:00
parent e8f7fa239e
commit 6172ad463b
No known key found for this signature in database
GPG Key ID: 408DA7CA81DB885C
3 changed files with 11 additions and 7 deletions

8
API.md
View File

@ -180,5 +180,11 @@ POST /api/v2/pastes/{paste_id}/report
**Notes:**
* The endpoint is only available if the report system is enabled. Otherwise it will return a `404 Not Found` error.
* The request for this endpoint is the exact same that will reach the webhook.
* The request that will reach the report webhook looks like this:
```json
{
"paste": "paste_id",
"reason": "reason"
}
```
* The response from this endpoint is the exact same that pasty expects from the webhook.

View File

@ -10,9 +10,8 @@ import (
// ReportRequest represents a report request sent to the report webhook
type ReportRequest struct {
Paste string `json:"paste"`
Reason string `json:"reason"`
Timestamp int64 `json:"timestamp"`
Paste string `json:"paste"`
Reason string `json:"reason"`
}
// ReportResponse represents a report response received from the report webhook

View File

@ -255,9 +255,8 @@ func endpointReportPaste(ctx *fasthttp.RequestCtx) {
}
request := &report.ReportRequest{
Paste: ctx.UserValue("_paste").(*shared.Paste).ID,
Reason: payload.Reason,
Timestamp: time.Now().Unix(),
Paste: ctx.UserValue("_paste").(*shared.Paste).ID,
Reason: payload.Reason,
}
response, err := report.SendReport(request)
if err != nil {