aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorKushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com>2021-10-27 18:18:06 -0300
committerFChannel <>2022-06-19 12:53:29 -0700
commitd2277b1f9b17e61456cd312ef54542e1cfa81a40 (patch)
tree3f7f4b6dffe95c0f9909921dd47700e733b4ee47 /client.go
parent9f8195162295d2a789462e6b13394174a5745100 (diff)
restructuring, part 1 of many
Diffstat (limited to 'client.go')
-rw-r--r--client.go64
1 files changed, 0 insertions, 64 deletions
diff --git a/client.go b/client.go
index 274ad64..f5e56af 100644
--- a/client.go
+++ b/client.go
@@ -90,12 +90,6 @@ type Removed struct {
Board string
}
-type NewsItem struct {
- Title string
- Content template.HTML
- Time int
-}
-
type PostBlacklist struct {
Id int
Regex string
@@ -121,45 +115,6 @@ func timeToUnix(t time.Time) string {
return fmt.Sprint(t.Unix())
}
-func IndexGet(c *fiber.Ctx) error {
-
- actor := GetActorFromDB(DB, Domain)
-
- var data PageData
- data.Title = "Welcome to " + actor.PreferredUsername
- data.PreferredUsername = actor.PreferredUsername
- data.Boards = Boards
- data.Board.Name = ""
- data.Key = *Key
- data.Board.Domain = Domain
- data.Board.ModCred, _ = GetPasswordFromCtx(c)
- data.Board.Actor = actor
- data.Board.Post.Actor = actor.Id
- data.Board.Restricted = actor.Restricted
- //almost certainly there is a better algorithm for this but the old one was wrong
- //and I suck at math. This works at least.
- data.BoardRemainer = make([]int, 3-(len(data.Boards)%3))
- if len(data.BoardRemainer) == 3 {
- data.BoardRemainer = make([]int, 0)
- }
-
- col := GetCollectionFromReq("https://fchan.xyz/followers")
-
- if len(col.Items) > 0 {
- data.InstanceIndex = col.Items
- }
-
- data.NewsItems = getNewsFromDB(DB, 3)
-
- data.Themes = &Themes
-
- data.ThemeCookie = GetThemeCookie(c)
-
- return c.Render("index", fiber.Map{
- "page": data,
- }, "layouts/main")
-}
-
func NewsGet(w http.ResponseWriter, r *http.Request, db *sql.DB, timestamp int) {
t := template.Must(template.New("").Funcs(template.FuncMap{
"sub": sub,
@@ -1056,22 +1011,3 @@ func ShortExcerpt(post ObjectBase) string {
return returnString
}
-
-func IsOnion(url string) bool {
- re := regexp.MustCompile(`\.onion`)
- if re.MatchString(url) {
- return true
- }
-
- return false
-}
-
-func GetThemeCookie(c *fiber.Ctx) string {
- cookie := c.Cookies("theme")
- if cookie != "" {
- cookies := strings.SplitN(cookie, "=", 2)
- return cookies[0]
- }
-
- return "default"
-}