diff options
author | FChannel <> | 2021-06-30 19:54:56 -0700 |
---|---|---|
committer | FChannel <> | 2021-06-30 19:54:56 -0700 |
commit | f9c47cfe6970a49c3d913ba029f67ebac1a623e4 (patch) | |
tree | a7abbbad718bca33dcce76a7e4385f0b38231d20 /main.go | |
parent | 26e38b0e9ac4a9dd2e01312818eba4e84b02f1ca (diff) |
fixed federation bug with the TO field for sending activity streams. Added delay in indexing so the indexing inpoint cant be abused by non federated actors
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -1120,12 +1120,19 @@ func main() { } } - if !alreadyIndex { - query := `insert into follower (id, follower) values ($1, $2)` + // delay to give instance time to boot up + time.Sleep(15 * time.Second) - _, err := db.Exec(query, "https://fchan.xyz", actor) + checkActor := FingerActor(actor) - CheckError(err, "Error with add to index query") + if checkActor.Id == actor { + if !alreadyIndex { + query := `insert into follower (id, follower) values ($1, $2)` + + _, err := db.Exec(query, "https://fchan.xyz", actor) + + CheckError(err, "Error with add to index query") + } } }) @@ -1350,9 +1357,7 @@ func CreateObject(objType string) ObjectBase { func AddFollowersToActivity(db *sql.DB, activity Activity) Activity{ - if len(activity.To) < 1 { - activity.To = append(activity.To, activity.Actor.Id) - } + activity.To = append(activity.To, activity.Actor.Id) for _, e := range activity.To { aFollowers := GetActorCollection(e + "/followers") |