From 6172ad463b63138106cb582d4757ef9d1068b474 Mon Sep 17 00:00:00 2001 From: Lukas Schulte Pelkum Date: Sat, 24 Jul 2021 17:03:40 +0200 Subject: [PATCH] Update paste report webhook request --- API.md | 8 +++++++- internal/report/report.go | 5 ++--- internal/web/controllers/v2/pastes.go | 5 ++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/API.md b/API.md index 109ae07..c5639a9 100644 --- a/API.md +++ b/API.md @@ -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. \ No newline at end of file diff --git a/internal/report/report.go b/internal/report/report.go index f147528..544b687 100644 --- a/internal/report/report.go +++ b/internal/report/report.go @@ -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 diff --git a/internal/web/controllers/v2/pastes.go b/internal/web/controllers/v2/pastes.go index 80100ef..fe363eb 100644 --- a/internal/web/controllers/v2/pastes.go +++ b/internal/web/controllers/v2/pastes.go @@ -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 {