aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmelia <47868520+knotteye@users.noreply.github.com>2021-07-02 12:59:03 +0000
committerGitHub <noreply@github.com>2021-07-02 12:59:03 +0000
commit3a1e1090b31772908ceed43380cd09bc41019270 (patch)
treeeb675714319a0600e521f08cb6ee8c85e6036f43
parentd98441da108725a76d697e358d161c06783cb066 (diff)
parent97ce6d91545ec10f35d692ccbf60536d83f5debf (diff)
Merge branch 'master' into master
-rw-r--r--client.go1
-rw-r--r--main.go49
-rw-r--r--static/faq.html20
3 files changed, 39 insertions, 31 deletions
diff --git a/client.go b/client.go
index 074b645..be79cdd 100644
--- a/client.go
+++ b/client.go
@@ -90,6 +90,7 @@ func IndexGet(w http.ResponseWriter, r *http.Request, db *sql.DB) {
var data PageData
data.Title = "Welcome to " + actor.PreferredUsername
+
data.PreferredUsername = actor.PreferredUsername
data.Boards = Boards
data.Board.Name = ""
diff --git a/main.go b/main.go
index e63413f..69e8902 100644
--- a/main.go
+++ b/main.go
@@ -1141,29 +1141,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)
@@ -2475,6 +2455,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)
@@ -2500,3 +2506,4 @@ func GetCollectionFromReq(path string) Collection {
return respCollection
}
+
diff --git a/static/faq.html b/static/faq.html
index 9ce691a..ed7fed2 100644
--- a/static/faq.html
+++ b/static/faq.html
@@ -12,32 +12,32 @@
<h4>What is fchan</h4>
<p>fchan short for fchannel and is a federated image board based on activity pub. it removes the need for centeralized boards. many boards can be connected and feeds shared or followed. it draws likeness from other chans for ease of familiarity. you can get the source code here https://github.com/FChannel0 and modify how you choose, any help is appreciated.</p>
- <h4>Options</h4>
+ <h4 id="options">Options</h4>
<p>the options field when posting can be used for special options when posting. type noko in the options field to return to the thread you posting to. use sage to ignore updating the thread bump order. nokosage will do both.</p>
- <h4>Tripcode</h4>
+ <h4 id="tripcode">Tripcode</h4>
<p>you can identify yourself with a tripcode by adding a hash mark (#) after your name followed by your unique identifying string, example anon#myunique.</p>
- <h4>Quote</h4>
+ <h4 id="quote">Quote</h4>
<p>use a greater than symbols (>) to quote strings of text. use double (>>) followed by the url id of the post you are referencing (this will be changed later for better use).</p>
- <h4>No. Link</h4>
+ <h4 id="link">No. Link</h4>
<p>click on "No." next to a post to view its thread.</p>
- <h4>Uploading files</h4>
+ <h4 id="upload">Uploading files</h4>
<p>max file size is 7MB. the supported file types are "image/gif","image/jpeg","image/png","image/webp","image/apng","video/mp4","video/ogg","video/webm","audio/mpeg","audio/ogg","audio/wav","audio/wave","audio/x-wav". these were choosen based on browser support for embeding.</p>
- <h4>JavaScript why?</h4>
+ <h4 id="javascript">JavaScript why?</h4>
<p>a version of the client with no javascript will be made eventually. current version requires it, because of basic functionality needed. no libraries or frameworks for javascript is used besides ECMAScript, just basic selection of DOM elements and modifying their styling. maybe someone would be willing to make a client that uses no javascript.</p>
- <h4>Why are the posts not sequential numbers?</h4>
+ <h4 id="seqnum">Why are the posts not sequential numbers?</h4>
<p>sequential numbers have run their course. random base 16 (now base 36) is better.</p>
- <h4>Activitypub specific examples</h4>
+ <h4 id="pubexamp">Activitypub specific examples</h4>
<p>coming soon(tm).</p>
- <h4>Server Version</h4>
- <p>v0.0.5b</p>
+ <h4 id="version">Server Version</h4>
+ <p>v0.0.5c</p>
</div>
<div style="width: 500px; margin:0 auto; margin-top: 50px; text-align: center;">
<a href="/">[Home]</a><a href="/static/rules.html">[Rules]</a><a href="/static/faq.html">[FAQ]</a>