add/serve .well-known files

This commit is contained in:
Jake Gold 2023-05-26 17:49:58 -07:00
parent 7b6948e617
commit c98b65f6a9
4 changed files with 33 additions and 0 deletions

1
bskyweb/cmd/bskyweb/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
bskyweb

View file

@ -64,6 +64,7 @@ func serve(cctx *cli.Context) error {
staticHandler := http.FileServer(func() http.FileSystem {
if debug {
log.Debugf("serving static file from the local file system")
return http.FS(os.DirFS("static"))
}
fsys, err := fs.Sub(bskyweb.StaticFS, "static")
@ -100,9 +101,16 @@ func serve(cctx *cli.Context) error {
RedirectCode: http.StatusFound,
}))
//
// configure routes
//
// static files
e.GET("/robots.txt", echo.WrapHandler(staticHandler))
e.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", staticHandler)))
e.GET("/.well-known/assetlinks.json", echo.WrapHandler(staticHandler))
// home
e.GET("/", server.WebHome)
// generic routes