dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 4b365e30b882f4a60e9a0f3dce6c8c2be5d01496
parent 7e843eedf36481255f9d5ec7fc86ef6c8f45830c
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Tue, 24 Jan 2023 18:02:19 -0800

reindex foum

Diffstat:
Mpkg/web/handlers/handlers.go | 10++++++++++
Mpkg/web/web.go | 1+
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -1380,6 +1380,16 @@ func LinksReindexHandler(c echo.Context) error { return c.Redirect(http.StatusFound, c.Request().Referer()) } +func ForumReindexHandler(c echo.Context) error { + if err := database.DB.Exec(`INSERT INTO fts5_forum_threads(fts5_forum_threads) VALUES('rebuild')`).Error; err != nil { + logrus.Error(err) + } + if err := database.DB.Exec(`INSERT INTO fts5_forum_messages(fts5_forum_messages) VALUES('rebuild')`).Error; err != nil { + logrus.Error(err) + } + return c.Redirect(http.StatusFound, c.Request().Referer()) +} + func NewLinkHandler(c echo.Context) error { authUser := c.Get("authUser").(*database.User) if !authUser.IsModerator() { diff --git a/pkg/web/web.go b/pkg/web/web.go @@ -210,6 +210,7 @@ func getMainServer() echo.HandlerFunc { authGroup.POST("/chat/:roomName/settings", handlers.RoomChatSettingsHandler) moderatorGroup := e.Group("", middlewares.IsModeratorMiddleware) moderatorGroup.POST("/links/reindex", handlers.LinksReindexHandler) + moderatorGroup.GET("/forum/reindex", handlers.ForumReindexHandler) moderatorGroup.GET("/settings/website", handlers.SettingsWebsiteHandler) moderatorGroup.POST("/settings/website", handlers.SettingsWebsiteHandler) moderatorGroup.GET("/settings/invitations", handlers.SettingsInvitationsHandler)