repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
1f86a2e
parent
0068695
author
Eric Bower
date
2024-05-31 14:43:05 +0000 UTC
chore(pastes): show unlisted tag
2 files changed,  +13, -5
M pastes/api.go
+7, -0
 1@@ -55,6 +55,7 @@ type PostPageData struct {
 2 	PublishAtISO string
 3 	PublishAt    string
 4 	ExpiresAt    string
 5+	Unlisted     bool
 6 }
 7 
 8 type TransparencyPageData struct {
 9@@ -190,6 +191,11 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
10 			expiresAt = post.ExpiresAt.Format("02 Jan, 2006")
11 		}
12 
13+		unlisted := false
14+		if post.Hidden {
15+			unlisted = true
16+		}
17+
18 		data = PostPageData{
19 			Site:         *cfg.GetSiteData(),
20 			PageTitle:    post.Filename,
21@@ -204,6 +210,7 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
22 			BlogName:     blogName,
23 			Contents:     template.HTML(parsedText),
24 			ExpiresAt:    expiresAt,
25+			Unlisted:     unlisted,
26 		}
27 	} else {
28 		logger.Info("post not found", "user", username, "slug", slug)
M pastes/html/post.page.tmpl
+6, -5
 1@@ -27,11 +27,12 @@
 2 <header>
 3     <h1 class="text-2xl font-bold">{{.Title}}</h1>
 4     <p class="font-bold m-0">
 5-        <time datetime="{{.PublishAtISO}}">{{.PublishAt}}</time>
 6-        <span> on </span>
 7-        <a href="{{.BlogURL}}">{{.BlogName}}</a>
 8-        <span> | </span>
 9-        <a href="{{.RawURL}}">raw</a>
10+      {{if .Unlisted}} <code>unlisted</code>{{end}}
11+      <time datetime="{{.PublishAtISO}}">{{.PublishAt}}</time>
12+      <span> &middot; <span>
13+      <a href="{{.BlogURL}}">{{.BlogName}}</a>
14+      <span> &middot; <span>
15+      <a href="{{.RawURL}}">raw</a>
16     </p>
17     <p class="font-bold m-0">expires: {{.ExpiresAt}}</p>
18 </header>