aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE2
-rw-r--r--client.go7
-rw-r--r--main.go14
3 files changed, 13 insertions, 10 deletions
diff --git a/LICENSE b/LICENSE
index 55791c5..ca010c7 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
- Copyright (C) <2021> <https://fchan.xyz>
+ Copyright (C) 2021 https://fchan.xyz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
diff --git a/client.go b/client.go
index f0a3ed7..9c9ce9c 100644
--- a/client.go
+++ b/client.go
@@ -7,7 +7,6 @@ import "database/sql"
import _ "github.com/lib/pq"
import "strings"
import "strconv"
-import "math"
import "sort"
import "regexp"
import "io/ioutil"
@@ -183,7 +182,7 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co
var orderedReplies []ObjectBase
for i := 0; i < 5; i++ {
cur := len(replies) - i - 1
- if cur > -1 {
+ if cur > - 1 {
orderedReplies = append(orderedReplies, replies[cur])
}
}
@@ -199,8 +198,8 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co
}
var pages []int
- pageLimit := math.Round(float64(len(mergeCollection.OrderedItems) / offset))
- for i := 0.0; i <= pageLimit; i++ {
+ pageLimit := (float64(len(mergeCollection.OrderedItems)) / float64(offset))
+ for i := 0.0; i < pageLimit; i++ {
pages = append(pages, int(i))
}
diff --git a/main.go b/main.go
index e4cf856..00884ef 100644
--- a/main.go
+++ b/main.go
@@ -94,6 +94,7 @@ func main() {
var actorFollowers bool
var actorReported bool
var actorVerification bool
+ var actorMainPage bool
var accept = r.Header.Get("Accept")
@@ -108,7 +109,7 @@ func main() {
mainFollowing = (path == "/following")
mainFollowers = (path == "/followers")
} else {
- actorMain = (path == "/" + actor.Name)
+ actorMain = (path == "/" + actor.Name)
actorInbox = (path == "/" + actor.Name + "/inbox")
actorCatalog = (path == "/" + actor.Name + "/catalog")
actorOutbox = (path == "/" + actor.Name + "/outbox")
@@ -116,9 +117,13 @@ func main() {
actorFollowers = (path == "/" + actor.Name + "/followers")
actorReported = (path == "/" + actor.Name + "/reported")
actorVerification = (path == "/" + actor.Name + "/verification")
+
+ re := regexp.MustCompile("/" + actor.Name + "/[0-9]{1,2}")
+
+ actorMainPage = re.MatchString(path)
- re := regexp.MustCompile("/" + actor.Name + "/\\w+")
- actorPost = re.MatchString(path)
+ re = regexp.MustCompile("/" + actor.Name + "/\\w+")
+ actorPost = re.MatchString(path)
}
if mainActor {
@@ -164,7 +169,7 @@ func main() {
return
}
- if actorMain {
+ if actorMain || actorMainPage {
if accept == activitystreams || accept == ldjson {
GetActorInfo(w, db, actor.Id)
return
@@ -810,7 +815,6 @@ func main() {
}
if !IsIDLocal(db, id) {
- fmt.Println("not local")
CreateLocalReportDB(db, id, board, reason)
http.Redirect(w, r, r.Header.Get("Referer"), http.StatusSeeOther)
return