diff options
author | FChannel <> | 2021-07-02 02:05:58 -0700 |
---|---|---|
committer | FChannel <> | 2021-07-02 02:05:58 -0700 |
commit | 97ce6d91545ec10f35d692ccbf60536d83f5debf (patch) | |
tree | da65fbb40a3e936255d6af0b1313743b172bc2d3 /main.go | |
parent | a122d62f78e5f1fd66efc28994809d720a2841ab (diff) |
added anchor links for index.html and public instance indexing tweak
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 49 |
1 files changed, 28 insertions, 21 deletions
@@ -1115,29 +1115,9 @@ func main() { return } - followers := GetCollectionFromID("https://fchan.xyz/followers") - var alreadyIndex = false - for _, e := range followers.Items { - if e.Id == actor { - alreadyIndex = true - } - } - - // delay to give instance time to boot up - time.Sleep(15 * time.Second) - - checkActor := GetActor(actor) - 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") - } - } + go AddInstanceToIndexDB(db, actor) }) fmt.Println("Server for " + Domain + " running on port " + Port) @@ -2449,6 +2429,32 @@ func AddInstanceToIndex(actor string) { } } +func AddInstanceToIndexDB(db *sql.DB, actor string) { + + time.Sleep(15 * time.Second) + + followers := GetCollectionFromID("https://fchan.xyz/followers") + + var alreadyIndex = false + for _, e := range followers.Items { + if e.Id == actor { + alreadyIndex = true + } + } + + checkActor := GetActor(actor) + + 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") + } + } +} + func GetCollectionFromReq(path string) Collection { req, err := http.NewRequest("GET", path, nil) @@ -2474,3 +2480,4 @@ func GetCollectionFromReq(path string) Collection { return respCollection } + |