aboutsummaryrefslogtreecommitdiff
path: root/route
diff options
context:
space:
mode:
Diffstat (limited to 'route')
-rw-r--r--route/routes/actor.go9
-rw-r--r--route/routes/admin.go16
-rw-r--r--route/structs.go2
3 files changed, 24 insertions, 3 deletions
diff --git a/route/routes/actor.go b/route/routes/actor.go
index 1072472..83cbca2 100644
--- a/route/routes/actor.go
+++ b/route/routes/actor.go
@@ -8,6 +8,7 @@ import (
"net/http"
"regexp"
"strconv"
+ "strings"
"github.com/FChannel0/FChannel-Server/activitypub"
"github.com/FChannel0/FChannel-Server/config"
@@ -238,7 +239,7 @@ func ActorPost(ctx *fiber.Ctx) error {
}
if ctx.FormValue("inReplyTo") == "" || file == nil {
- if ctx.FormValue("comment") == "" && ctx.FormValue("subject") == "" {
+ if strings.TrimSpace(ctx.FormValue("comment")) == "" && ctx.FormValue("subject") == "" {
return ctx.Render("403", fiber.Map{
"message": "Comment or Subject required",
})
@@ -251,6 +252,12 @@ func ActorPost(ctx *fiber.Ctx) error {
})
}
+ if strings.Count(ctx.FormValue("comment"), "\r\n") > 50 || strings.Count(ctx.FormValue("comment"), "\n") > 50 || strings.Count(ctx.FormValue("comment"), "\r") > 50 {
+ return ctx.Render("403", fiber.Map{
+ "message": "Too many new lines - try again.",
+ })
+ }
+
if len(ctx.FormValue("subject")) > 100 || len(ctx.FormValue("name")) > 100 || len(ctx.FormValue("options")) > 100 {
return ctx.Render("403", fiber.Map{
"message": "Name, Subject or Options limit 100 characters",
diff --git a/route/routes/admin.go b/route/routes/admin.go
index 31e8e8e..1576a3a 100644
--- a/route/routes/admin.go
+++ b/route/routes/admin.go
@@ -129,13 +129,19 @@ func AdminIndex(ctx *fiber.Ctx) error {
adminData.Board.Post.Actor = actor.Id
+ adminData.Instance, _ = activitypub.GetActorFromDB(config.Domain)
+
adminData.PostBlacklist, _ = util.GetRegexBlacklist()
+ adminData.Meta.Description = adminData.Title
+ adminData.Meta.Url = adminData.Board.Actor.Id
+ adminData.Meta.Title = adminData.Title
+
adminData.Themes = &config.Themes
return ctx.Render("admin", fiber.Map{
"page": adminData,
- })
+ }, "layouts/main")
}
func AdminFollow(ctx *fiber.Ctx) error {
@@ -255,6 +261,8 @@ func AdminActorIndex(ctx *fiber.Ctx) error {
data.Board.Post.Actor = actor.Id
+ data.Instance, _ = activitypub.GetActorFromDB(config.Domain)
+
data.AutoSubscribe, _ = actor.GetAutoSubscribe()
jannies, err := actor.GetJanitors()
@@ -263,6 +271,10 @@ func AdminActorIndex(ctx *fiber.Ctx) error {
return util.MakeError(err, "AdminActorIndex")
}
+ data.Meta.Description = data.Title
+ data.Meta.Url = data.Board.Actor.Id
+ data.Meta.Title = data.Title
+
data.Themes = &config.Themes
data.RecentPosts, _ = actor.GetRecentPosts()
@@ -274,7 +286,7 @@ func AdminActorIndex(ctx *fiber.Ctx) error {
return ctx.Render("manage", fiber.Map{
"page": data,
"jannies": jannies,
- })
+ }, "layouts/main")
}
func AdminAddJanny(ctx *fiber.Ctx) error {
diff --git a/route/structs.go b/route/structs.go
index 73371ae..601943c 100644
--- a/route/structs.go
+++ b/route/structs.go
@@ -44,6 +44,8 @@ type AdminPage struct {
PostBlacklist []util.PostBlacklist
AutoSubscribe bool
RecentPosts []activitypub.ObjectBase
+ Instance activitypub.Actor
+ Meta Meta
Themes *[]string
ThemeCookie string