aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
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)