aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorFChannel <=>2021-01-28 20:29:11 -0800
committerFChannel <=>2021-01-28 20:29:11 -0800
commite358eb07ec4ce873f750c0b75d7b23df4da2fbb8 (patch)
tree1cd9eb8854255e6ed3cd4ab0a8a69bfc1ff7279f /main.go
parent0d4cd485b5225cfa737842de6ba0e96d6d21722b (diff)
view individual post from url
Diffstat (limited to 'main.go')
-rw-r--r--main.go11
1 files changed, 11 insertions, 0 deletions
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)