From 08cfcaf5d4062adc37079430b83c741a1f355ae9 Mon Sep 17 00:00:00 2001 From: FChannel <=> Date: Fri, 15 Jan 2021 14:47:57 -0800 Subject: fixed double post problem maybe..... --- OutboxPost.go | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'OutboxPost.go') diff --git a/OutboxPost.go b/OutboxPost.go index 772014a..90c30d7 100644 --- a/OutboxPost.go +++ b/OutboxPost.go @@ -25,9 +25,9 @@ func ParseOutboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { if(BoardHasAuthType(db, actor.Name, "captcha") && CheckCaptcha(db, r.FormValue("captcha"))) { f, header, _ := r.FormFile("file") if(header != nil) { - if(header.Size > (5 << 20)){ + if(header.Size > (7 << 20)){ w.WriteHeader(http.StatusRequestEntityTooLarge) - w.Write([]byte("5MB max file size")) + w.Write([]byte("7MB max file size")) return } @@ -43,7 +43,7 @@ func ParseOutboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { var nObj = CreateObject("Note") nObj = ObjectFromForm(r, db, nObj) - + var act Actor nObj.Actor = &act nObj.Actor.Id = Domain + "/" + actor.Name @@ -83,9 +83,6 @@ func ParseOutboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { w.WriteHeader(http.StatusOK) w.Write([]byte(id)) } - - - } else { activity = GetActivityFromJson(r, db) if IsActivityLocal(db, activity) { @@ -356,14 +353,19 @@ func ObjectFromForm(r *http.Request, db *sql.DB, obj ObjectBase) ObjectBase { obj.InReplyTo = append(obj.InReplyTo, originalPost) var activity Activity - - activity.To = append(activity.To, originalPost.Id) + + if !IsInStringArray(activity.To, originalPost.Id) { + activity.To = append(activity.To, originalPost.Id) + } + if originalPost.Id != "" { if !IsActivityLocal(db, activity) { id := GetActorFromID(originalPost.Id).Id - - obj.To = append(obj.To, GetActor(id).Id) + actor := GetActor(id) + if !IsInStringArray(obj.To, actor.Id) { + obj.To = append(obj.To, actor.Id) + } } } @@ -389,8 +391,10 @@ func ObjectFromForm(r *http.Request, db *sql.DB, obj ObjectBase) ObjectBase { if !IsActivityLocal(db, activity) { id := GetActorFromID(e.Id).Id - - obj.To = append(obj.To, GetActor(id).Id) + actor := GetActor(id) + if !IsInStringArray(obj.To, actor.Id) { + obj.To = append(obj.To, actor.Id) + } } } } -- cgit v1.2.3