diff --git a/core/http/app.go b/core/http/app.go index 319a400ad..2dd9fe55e 100644 --- a/core/http/app.go +++ b/core/http/app.go @@ -389,6 +389,16 @@ func API(application *application.Application) (*echo.Echo, error) { return c.Blob(http.StatusOK, "image/svg+xml", data) }) + // iOS draws the home-screen icon from an apple-touch-icon PNG and ignores + // the SVG favicon, so it falls back to the first letter of the page title. + e.GET("/apple-touch-icon.png", func(c echo.Context) error { + data, err := embedDirStatic.ReadFile("static/apple-touch-icon.png") + if err != nil { + return c.NoContent(http.StatusNotFound) + } + return c.Blob(http.StatusOK, "image/png", data) + }) + // Static files - use fs.Sub to create a filesystem rooted at "static" staticFS, err := fs.Sub(embedDirStatic, "static") if err != nil { @@ -671,6 +681,7 @@ func API(application *application.Application) (*echo.Echo, error) { html := string(indexHTML) html = strings.ReplaceAll(html, `="/assets/`, `="`+safePrefix+`assets/`) html = strings.ReplaceAll(html, `="/favicon.svg"`, `="`+safePrefix+`favicon.svg"`) + html = strings.ReplaceAll(html, `="/apple-touch-icon.png"`, `="`+safePrefix+`apple-touch-icon.png"`) indexHTML = []byte(html) } return c.HTMLBlob(http.StatusOK, indexHTML) diff --git a/core/http/app_test.go b/core/http/app_test.go index 36072b96e..e3080161f 100644 --- a/core/http/app_test.go +++ b/core/http/app_test.go @@ -469,6 +469,7 @@ var _ = Describe("API test", func() { Expect(string(body)).To(ContainSubstring(``), "body") Expect(string(body)).ToNot(ContainSubstring(`="/assets/`), "asset URLs must include the prefix") Expect(string(body)).ToNot(ContainSubstring(`="/favicon.svg"`), "favicon URL must include the prefix") + Expect(string(body)).ToNot(ContainSubstring(`="/apple-touch-icon.png"`), "touch icon URL must include the prefix") }) // X-Forwarded-Prefix is attacker controllable on misconfigured diff --git a/core/http/react-ui/index.html b/core/http/react-ui/index.html index 080dd9124..c1ad282ba 100644 --- a/core/http/react-ui/index.html +++ b/core/http/react-ui/index.html @@ -5,6 +5,7 @@ LocalAI +