flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 9bb0cc3423e0dad05b3400a78f99029b6070efd4
parent 1d4b96b3233ee566a3f0538c01c172ad08bef3e5
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Mon, 29 Nov 2021 22:50:08 -0800

Change from files to pages on homepage

Diffstat:
MREADME.md | 2++
Mdb.go | 16++++++++--------
Mtemplates/index.html | 5+----
3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md @@ -60,6 +60,8 @@ require manual admin approval. Use [git-send-email](https://git-scm.com/docs/git-send-email) to send a patch to my [mailing list](https://lists.sr.ht/~aw/patches): [~aw/patches@lists.sr.ht](mailto:~aw/patches@lists.sr.ht) +Note that this code base is pretty bad. Don't worry about it. + ## Donate If you'd like to support Flounder development, consider making a [Donation](https://www.buymeacoffee.com/alexwennerberg) diff --git a/db.go b/db.go @@ -207,19 +207,19 @@ func getUpdatedFiles(admin bool, user string) ([]*File, error) { // TODO cache t }) // if many in a row, truncate if user == "" { - maxConsecutive := 3 newResult := []*File{} - var count int - var user string for _, f := range result { - if user != f.Creator { - user = f.Creator - count = 1 + var already bool + // slow hack + for _, ff := range newResult { + if ff.Creator == f.Creator { + already = true + break + } } - if count <= maxConsecutive { + if !already { newResult = append(newResult, f) } - count += 1 } result = newResult } diff --git a/templates/index.html b/templates/index.html @@ -4,15 +4,12 @@ <br> <p> Welcome to {{.Config.SiteTitle}}, a <a href="/register">free</a> web interface for <a href="https://gemini.circumlunar.space/">Gemini</a> capsules. For more information and site updates, check out the <a href="//admin.{{$.Config.Host}}">admin page</a>.</p> -<h2>Recently updated files:</h2> +<h2>Recently updated pages:</h2> {{ range .Files }} <div class="indent-wrap"> <a href="//{{$.Config.Host}}/updates/{{.Creator}}" class='person-link'> {{ .Creator }}</a> <em>{{.TimeAgo}}</em> - <a href="//{{.Creator}}.{{$.Config.Host}}/{{.Name}}"> - {{ .Name}} - </a> {{ if eq .Creator $.AuthUser.Username }} (<a href="//{{$.Config.Host}}/edit/{{.Name}}">edit</a>){{ end}} </div> {{end}} <br>