diff options
author | FChannel <=> | 2021-01-15 14:47:57 -0800 |
---|---|---|
committer | FChannel <=> | 2021-01-15 14:47:57 -0800 |
commit | 08cfcaf5d4062adc37079430b83c741a1f355ae9 (patch) | |
tree | 94b9f1ef9adc7e8e69c6b4f41485efe3b35d99b5 /OutboxPost.go | |
parent | 83fccbfb4e6755662ef38d0a12fc073f38bf8bdf (diff) |
fixed double post problem maybe.....
Diffstat (limited to 'OutboxPost.go')
-rw-r--r-- | OutboxPost.go | 28 |
1 files changed, 16 insertions, 12 deletions
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) + } } } } |