A vibe coded tangled fork which supports pijul.

appview/state: support `/favicon.ico`

apps like pdsls.dev expects favicon to exist in well-known path
Not including `favicon.svg` as I don't think apps expecting static
favicon path will care about svg icons.

Signed-off-by: Seongmin Lee <git@boltless.me>

+30
+29
appview/pages/pages.go
··· 1436 1436 return Cache(http.StripPrefix("/static/", http.FileServer(http.FS(sub)))) 1437 1437 } 1438 1438 1439 + func (p *Pages) StaticFile(path string) http.Handler { 1440 + if p.dev { 1441 + filePath := filepath.Join("appview/pages/static", path) 1442 + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 1443 + http.ServeFile(w, r, filePath) 1444 + }) 1445 + } 1446 + sub, err := fs.Sub(p.embedFS, "static") 1447 + if err != nil { 1448 + p.logger.Error("no static dir found? that's crazy", "err", err) 1449 + panic(err) 1450 + } 1451 + fsys := http.FS(sub) 1452 + return Cache(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 1453 + f, err := fsys.Open(path) 1454 + if err != nil { 1455 + http.NotFound(w, r) 1456 + return 1457 + } 1458 + defer f.Close() 1459 + stat, err := f.Stat() 1460 + if err != nil { 1461 + http.NotFound(w, r) 1462 + return 1463 + } 1464 + http.ServeContent(w, r, stat.Name(), stat.ModTime(), f.(io.ReadSeeker)) 1465 + })) 1466 + } 1467 + 1439 1468 func Cache(h http.Handler) http.Handler { 1440 1469 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 1441 1470 path := strings.Split(r.URL.Path, "?")[0]
+1
appview/state/router.go
··· 32 32 s.pages, 33 33 ) 34 34 35 + router.Get("/favicon.ico", s.pages.StaticFile("logos/dolly.ico").ServeHTTP) 35 36 router.Get("/pwa-manifest.json", s.WebAppManifest) 36 37 router.Get("/robots.txt", s.RobotsTxt) 37 38