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 ( |
| 8 | 8 | "fmt" |
| 9 | 9 | "hash/fnv" |
| 10 | 10 | "io" |
| 11 | | "io/fs" |
| 12 | 11 | "log" |
| 13 | 12 | "math" |
| 14 | 13 | "os" |
| @@ -177,21 +176,12 @@ func (s *Server) index(w http.ResponseWriter, r *http.Request) { |
| 177 | 176 | Host string |
| 178 | 177 | Accounts bool |
| 179 | 178 | Signup bool |
| 180 | | Picture bool |
| 181 | 179 | EmailLogin bool |
| 182 | 180 | }{basePage{Site: s.siteName(), Host: s.cfg.SiteHost()}, host, s.cfg.Web.Mode == "accounts", |
| 183 | 181 | s.cfg.Web.Mode == "accounts" && s.cfg.Registration.Mode != "closed", |
| 184 | | landingPicture, s.emailLoginEnabled()}) |
| 182 | s.emailLoginEnabled()}) |
| 185 | 183 | } |
| 186 | 184 | |
| 187 | | // landingPicture says whether the landing page's screenshot images exist to |
| 188 | | // show, checked once against the embedded images. |
| 189 | | var 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 | | |
| 195 | 185 | func (s *Server) dashboard(w http.ResponseWriter, r *http.Request, viewer store.User) { |
| 196 | 186 | mrs, _ := s.st.DashboardMRs(viewer.ID) |
| 197 | 187 | issues, _ := s.st.DashboardIssues(viewer.ID) |
internal/web/templates/landing.html
+2 −2
| @@ -6,10 +6,10 @@ |
| 6 | 6 | <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> |
| 7 | 7 | <pre class="quickstart">ssh git@{{.Host}} help # every command, no client to install |
| 8 | 8 | git clone ssh://git@{{.Host}}/owner/repo.git</pre> |
| 9 | | {{if .Picture}}<div class="shot"><picture> |
| 9 | <div class="shot"><picture> |
| 10 | 10 | <source srcset="/static/img/mr-dark.png" media="(prefers-color-scheme: dark)"> |
| 11 | 11 | <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> |
| 13 | 13 | <div class="facets"> |
| 14 | 14 | <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> |
| 15 | 15 | <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> |