Add content policy and add abuse categories

This commit is contained in:
2021-01-05 00:00:46 +01:00
parent 96ca0ed90f
commit e074be4e19
15 changed files with 198 additions and 101 deletions

View File

@@ -4,7 +4,6 @@ import (
"net/http"
"time"
"fornaxian.tech/pixeldrain_server/api/restapi/apiclient"
"fornaxian.tech/pixeldrain_server/util"
"github.com/Fornaxian/log"
"github.com/julienschmidt/httprouter"
@@ -15,11 +14,9 @@ func (wc *WebController) serveAdClick(w http.ResponseWriter, r *http.Request, p
w.Header().Set("Referrer-Policy", "origin")
http.Redirect(w, r, r.URL.Query().Get("target"), http.StatusTemporaryRedirect)
api := apiclient.New(wc.apiURLInternal)
// The Real IP is used in the API server to determine that the view is not
// fake
api.RealIP = util.RemoteAddress(r)
var api = wc.api.RealIP(util.RemoteAddress(r))
// Log a view on the file
if err := api.PostFileView(p.ByName("id"), wc.viewTokenOrBust()); err != nil {