dkforest

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

commit 20cd5de38268e40468e0ac03bd424c5467a11e42
parent 76f52325c73cf3b7ba2a02b0715fe609db2ccaf3
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu,  9 Mar 2023 09:55:06 -0800

memes

Diffstat:
Mpkg/web/handlers/api/v1/slashInterceptor.go | 10+++++++---
Mpkg/web/public/views/pages/chat-help.gohtml | 5+++++
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/pkg/web/handlers/api/v1/slashInterceptor.go b/pkg/web/handlers/api/v1/slashInterceptor.go @@ -85,6 +85,7 @@ func handleUserCmd(c *Command) (handled bool) { handleDiceCmd(c) || handleRandCmd(c) || handleChoiceCmd(c) || + handleListMemes(c) || handleSuccessCmd(c) || handleErrorCmd(c) } @@ -137,8 +138,7 @@ func handleAdminCmd(c *Command) (handled bool) { handleRename(c) || handleNewMeme(c) || handleRenameMeme(c) || - handleRemoveMeme(c) || - handleListMemes(c) + handleRemoveMeme(c) } return false } @@ -1660,7 +1660,11 @@ func handleListMemes(c *Command) (handled bool) { memes, _ := c.db.GetMemes() msg := "" for _, m := range memes { - msg += fmt.Sprintf(`<a href="/memes/%s" rel="noopener noreferrer" target="_blank">%s</a> (%s)<br />`, m.Slug, m.Slug, humanize.Bytes(uint64(m.FileSize))) + msg += fmt.Sprintf(`<a href="/memes/%s" rel="noopener noreferrer" target="_blank">%s</a>`, m.Slug, m.Slug) + if c.authUser.IsAdmin { + msg += fmt.Sprintf(` (%s)`, humanize.Bytes(uint64(m.FileSize))) + } + msg += "<br />" } c.zeroMsg(msg) c.err = ErrRedirect diff --git a/pkg/web/public/views/pages/chat-help.gohtml b/pkg/web/public/views/pages/chat-help.gohtml @@ -134,6 +134,11 @@ </div> {{ end }} + <div> + <div><code>/memes</code></div> + <p>List all memes</p> + </div> + <h4>Private room commands</h4> <h5>All users</h5>