From 7df3590fe3cabd7372a739f7f70057c5d9185c23 Mon Sep 17 00:00:00 2001 From: FChannel <=> Date: Mon, 1 Feb 2021 23:39:32 -0800 Subject: changed to base 36 for post ids --- OutboxPost.go | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'OutboxPost.go') diff --git a/OutboxPost.go b/OutboxPost.go index f509b04..a51d509 100644 --- a/OutboxPost.go +++ b/OutboxPost.go @@ -97,7 +97,7 @@ func ParseOutboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { var verify Verify verify.Identifier = "admin" - verify.Board = Domain + verify.Board = activity.Actor.Id verify = GetVerificationCode(db, verify) @@ -105,6 +105,16 @@ func ParseOutboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { code = CreateTripCode(code) code = CreateTripCode(code) + if code != auth[1] { + verify.Identifier = "admin" + verify.Board = Domain + + verify = GetVerificationCode(db, verify) + code = verify.Code + code = CreateTripCode(code) + code = CreateTripCode(code) + } + var rActivity Activity if validActor && validLocalActor && code == auth[1] || verify.Board == Domain { rActivity = AcceptFollow(activity) @@ -500,6 +510,11 @@ func GetActivityFromJson(r *http.Request, db *sql.DB) Activity { func CheckCaptcha(db *sql.DB, captcha string) bool { parts := strings.Split(captcha, ":") + + if strings.Trim(parts[0], " ") == "" { + return false + } + path := "public/" + parts[0] + ".png" code := GetCaptchaCodeDB(db, path) @@ -529,9 +544,11 @@ func ParseInboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { } if !RemoteActorHasAuth(activity.Actor.Id, auth[1]) { - response := RejectActivity(activity) - MakeActivityRequest(db, response) - return + if !RemoteActorHasAuth(Domain, auth[1]) { + response := RejectActivity(activity) + MakeActivityRequest(db, response) + return + } } switch(activity.Type) { -- cgit v1.2.3