Add a handler for /download that directs you to the device-appropriate store
parent
71c427cea8
commit
09e1f0e9ae
|
@ -170,6 +170,9 @@ func serve(cctx *cli.Context) error {
|
||||||
// home
|
// home
|
||||||
e.GET("/", server.WebHome)
|
e.GET("/", server.WebHome)
|
||||||
|
|
||||||
|
// download
|
||||||
|
e.GET("/download", server.Download)
|
||||||
|
|
||||||
// generic routes
|
// generic routes
|
||||||
e.GET("/hashtag/:tag", server.WebGeneric)
|
e.GET("/hashtag/:tag", server.WebGeneric)
|
||||||
e.GET("/search", server.WebGeneric)
|
e.GET("/search", server.WebGeneric)
|
||||||
|
@ -271,6 +274,20 @@ func (srv *Server) errorHandler(err error, c echo.Context) {
|
||||||
c.Render(code, "error.html", data)
|
c.Render(code, "error.html", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handler for redirecting to the download page.
|
||||||
|
func (srv *Server) Download(c echo.Context) error {
|
||||||
|
ua := c.Request().UserAgent()
|
||||||
|
if strings.Contains(ua, "Android") {
|
||||||
|
return c.Redirect(http.StatusFound, "https://play.google.com/store/apps/details?id=xyz.blueskyweb.app")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.Contains(ua, "iPhone") || strings.Contains(ua, "iPad") || strings.Contains(ua, "iPod") {
|
||||||
|
return c.Redirect(http.StatusFound, "https://apps.apple.com/tr/app/bluesky-social/id6444370199")
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.Redirect(http.StatusFound, "/")
|
||||||
|
}
|
||||||
|
|
||||||
// handler for endpoint that have no specific server-side handling
|
// handler for endpoint that have no specific server-side handling
|
||||||
func (srv *Server) WebGeneric(c echo.Context) error {
|
func (srv *Server) WebGeneric(c echo.Context) error {
|
||||||
data := pongo2.Context{}
|
data := pongo2.Context{}
|
||||||
|
|
Loading…
Reference in New Issue