diff options
author | FChannel <> | 2021-10-04 20:13:00 -0700 |
---|---|---|
committer | FChannel <> | 2021-10-04 20:13:00 -0700 |
commit | e490998c196e5c7a64e8903a500078f5c98e3dad (patch) | |
tree | 6efb333b5d2e58c6e8ac5ee21fa9850807a34862 | |
parent | 51b00e294280b44010736f9afd4b250e9a372340 (diff) | |
parent | 36c63daa85818488055edf8ae63af58058e4efb2 (diff) |
Merge branch 'development'
-rw-r--r-- | client.go | 2 | ||||
-rw-r--r-- | main.go | 22 | ||||
-rw-r--r-- | outboxPost.go | 9 | ||||
-rw-r--r-- | static/bottom.html | 2 | ||||
-rw-r--r-- | static/js/posts.js | 8 |
5 files changed, 26 insertions, 17 deletions
@@ -257,7 +257,7 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co "parseReplyLink": func(actorId string, op string, id string, content string) template.HTML { actor := FingerActor(actorId) title := strings.ReplaceAll(ParseLinkTitle(actor.Id, op, content), `/\<`, ">") - link := "<a href=\"" + actor.Name + "/" + shortURL(actor.Outbox, op) + "#" + shortURL(actor.Outbox, id) + "\" title=\"" + title + "\" class=\"replyLink\">>>" + shortURL(actor.Outbox, id) + "</a>" + link := "<a href=\"/" + actor.Name + "/" + shortURL(actor.Outbox, op) + "#" + shortURL(actor.Outbox, id) + "\" title=\"" + title + "\" class=\"replyLink\">>>" + shortURL(actor.Outbox, id) + "</a>" return template.HTML(link) }, "add": func(i, j int) int { @@ -2778,27 +2778,31 @@ func AddInstanceToIndex(actor string) { func AddInstanceToIndexDB(db *sql.DB, actor string) { + //sleep to be sure the webserver is fully initialized + //before making finger request time.Sleep(15 * time.Second) + nActor := FingerActor(actor) + + if nActor.Id == "" { + return + } + followers := GetCollectionFromID("https://fchan.xyz/followers") var alreadyIndex = false for _, e := range followers.Items { - if e.Id == actor { + if e.Id == nActor.Id { alreadyIndex = true } } - checkActor := GetActor(actor) - - if checkActor.Id == actor { - if !alreadyIndex { - query := `insert into follower (id, follower) values ($1, $2)` + if !alreadyIndex { + query := `insert into follower (id, follower) values ($1, $2)` - _, err := db.Exec(query, "https://fchan.xyz", actor) + _, err := db.Exec(query, "https://fchan.xyz", nActor.Id) - CheckError(err, "Error with add to index query") - } + CheckError(err, "Error with add to index query") } } diff --git a/outboxPost.go b/outboxPost.go index cb48d3e..65b9929 100644 --- a/outboxPost.go +++ b/outboxPost.go @@ -537,14 +537,23 @@ func ParseInboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { switch activity.Type { case "Create": + for _, e := range activity.To { if IsActorLocal(db, e) { if !IsActorLocal(db, activity.Actor.Id) { + + col := GetCollectionFromID(activity.Object.Id) + + if len(col.OrderedItems) < 1 { + break + } + WriteObjectToCache(db, *activity.Object) ArchivePosts(db, GetActorFromDB(db, e)) } } } + break case "Delete": diff --git a/static/bottom.html b/static/bottom.html index 023deeb..ab8d88d 100644 --- a/static/bottom.html +++ b/static/bottom.html @@ -4,7 +4,7 @@ <form onsubmit="sessionStorage.setItem('element-closed-reply', true)" id="reply-post" action="/post" method="post" enctype="multipart/form-data"> <input id="reply-name" name="name" size="43" type="text" placeholder="Name" maxlength="100"> <input id="reply-options" name="options" size="43" type="text" placeholder="Options" maxlength="100"> - <textarea id="reply-comment" name="comment" rows="12" cols="54" maxlength="2000" oninput="sessionStorage.setItem('element-reply-comment', document.getElementById('reply-comment').value)"></textarea> + <textarea id="reply-comment" name="comment" rows="12" cols="54" style="width: 396px;" maxlength="2000" oninput="sessionStorage.setItem('element-reply-comment', document.getElementById('reply-comment').value)"></textarea> <input id="reply-file" name="file" type="file"> <input id="reply-submit" type="submit" value="Reply" style="float: right;"> <input type="hidden" id="inReplyTo-box" name="inReplyTo" value="{{ .Board.InReplyTo }}"> diff --git a/static/js/posts.js b/static/js/posts.js index 29541c0..b9e9706 100644 --- a/static/js/posts.js +++ b/static/js/posts.js @@ -164,11 +164,7 @@ function quote(actorName, opid, id) var inReplyTo = document.getElementById("inReplyTo-box"); var w = window.innerWidth / 2 - 200; - if(id == "reply") { - var h = document.getElementById(id + "-content").offsetTop - 548; - } else { - var h = document.getElementById(id + "-content").offsetTop - 348; - } + var h = 300; //document.getElementById(id + "-content").offsetTop - 348; const boxStyle = "top: " + h + "px; left: " + w + "px;"; box.setAttribute("style", boxStyle); @@ -201,7 +197,7 @@ function report(actorName, id) var inReplyTo = document.getElementById("report-inReplyTo-box"); var w = window.innerWidth / 2 - 200; - var h = document.getElementById(id + "-content").offsetTop - 348; + var h = 300; //document.getElementById(id + "-content").offsetTop - 348; const boxStyle = "top: " + h + "px; left: " + w + "px;"; box.setAttribute("style", boxStyle); |