From e358eb07ec4ce873f750c0b75d7b23df4da2fbb8 Mon Sep 17 00:00:00 2001 From: FChannel <=> Date: Thu, 28 Jan 2021 20:29:11 -0800 Subject: view individual post from url --- main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 41c0da4..30f3430 100644 --- a/main.go +++ b/main.go @@ -401,20 +401,28 @@ func main() { if follow || adminFollow { r.ParseForm() + var followActivity Activity followActivity.AtContext.Context = "https://www.w3.org/ns/activitystreams" followActivity.Type = "Follow" + var nactor Actor var obj ObjectBase followActivity.Actor = &nactor followActivity.Object = &obj followActivity.Actor.Id = r.FormValue("actor") + var mactor Actor followActivity.Object.Actor = &mactor followActivity.Object.Actor.Id = r.FormValue("follow") followActivity.To = append(followActivity.To, r.FormValue("follow")) + if followActivity.Actor.Id == Domain && !IsActorLocal(db, followActivity.Object.Actor.Id) { + w.Write([]byte("main board can only follow local boards. Create a new board and then follow outside boards from it.")) + return + } + enc, _ := json.Marshal(followActivity) req, err := http.NewRequest("POST", actor.Outbox, bytes.NewBuffer(enc)) @@ -423,6 +431,9 @@ func main() { _, pass := GetPasswordFromSession(r) + pass = CreateTripCode(pass) + pass = CreateTripCode(pass) + req.Header.Set("Authorization", "Basic " + pass) req.Header.Set("Content-Type", activitystreams) -- cgit v1.2.3