Commit 205691a7a9

205691a7a927584711bdb5f424d033d7565c86af

parent: 3f9f6ba925

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-18 04:11 UTC

httpd: drop the always-true landing picture gate

landingPicture checked fs.Stat against images the //go:embed directive
already guarantees exist, so the gate was always true. Remove the var,
the Picture field, and the template's {{if}}; the embed failing to
compile is the only way the images would be missing.

Ref #221
internal/httpd/web.go +1 −11
@@ -8,7 +8,6 @@ import (
88 "fmt"
99 "hash/fnv"
1010 "io"
11 "io/fs"
1211 "log"
1312 "math"
1413 "os"
@@ -177,21 +176,12 @@ func (s *Server) index(w http.ResponseWriter, r *http.Request) {
177176 Host string
178177 Accounts bool
179178 Signup bool
180 Picture bool
181179 EmailLogin bool
182180 }{basePage{Site: s.siteName(), Host: s.cfg.SiteHost()}, host, s.cfg.Web.Mode == "accounts",
183181 s.cfg.Web.Mode == "accounts" && s.cfg.Registration.Mode != "closed",
184 landingPicture, s.emailLoginEnabled()})
182 s.emailLoginEnabled()})
185183}
186184
187// landingPicture says whether the landing page's screenshot images exist to
188// show, checked once against the embedded images.
189var landingPicture = func() bool {
190 _, e1 := fs.Stat(web.ImageFS, "static/img/mr-dark.png")
191 _, e2 := fs.Stat(web.ImageFS, "static/img/mr-light.png")
192 return e1 == nil && e2 == nil
193}()
194
195185func (s *Server) dashboard(w http.ResponseWriter, r *http.Request, viewer store.User) {
196186 mrs, _ := s.st.DashboardMRs(viewer.ID)
197187 issues, _ := s.st.DashboardIssues(viewer.ID)
internal/web/templates/landing.html +2 −2
@@ -6,10 +6,10 @@
66<p class="lede">A git forge you drive from the terminal. Repositories, issues, merge requests and CI over SSH, with a fast, readable web view of the same state.</p>
77<pre class="quickstart">ssh git@{{.Host}} help # every command, no client to install
88git clone ssh://git@{{.Host}}/owner/repo.git</pre>
9{{if .Picture}}<div class="shot"><picture>
9<div class="shot"><picture>
1010 <source srcset="/static/img/mr-dark.png" media="(prefers-color-scheme: dark)">
1111 <img src="/static/img/mr-light.png" width="1280" height="900" alt="A merge request page: the conversation on the left, checks and reviewers on the right.">
12</picture></div>{{end}}
12</picture></div>
1313<div class="facets">
1414 <section><h2>Read</h2><p>Browse and clone any public repository over HTTPS or <code>git://</code>, no account. Every commit shows whether its signature verified.</p></section>
1515 <section><h2>Write</h2><p>Push over SSH with the key you already have. Create a repository, file an issue, open and merge a request, all as commands.</p></section>