Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
maxence-charriere committed Aug 16, 2023
2 parents fc91330 + 6d74dd4 commit f5665d9
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 8 deletions.
74 changes: 74 additions & 0 deletions docs/web/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions pkg/app/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,18 @@ func (h *Handler) initCacheableResources() {

func (h *Handler) initIcon() {
if h.Icon.Default == "" {
h.Icon.Default = "https://github.com/maxence-charriere/go-app/blob/master/docs/web/icon.png"
h.Icon.Large = "https://github.com/maxence-charriere/go-app/blob/master/docs/web/icon.png"
h.Icon.Default = "https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.png"
h.Icon.Large = "https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.png"
}

if h.Icon.AppleTouch == "" {
h.Icon.AppleTouch = h.Icon.Default
}

if h.Icon.SVG == "" {
h.Icon.SVG = "https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.svg"
}

h.Icon.Default = h.resolveStaticPath(h.Icon.Default)
h.Icon.Large = h.resolveStaticPath(h.Icon.Large)
h.Icon.SVG = h.resolveStaticPath(h.Icon.SVG)
Expand Down
12 changes: 6 additions & 6 deletions pkg/app/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ func TestHandlerServeManifestJSONWithLocalDir(t *testing.T) {
require.Equal(t, "application/manifest+json", w.Header().Get("Content-Type"))
require.Contains(t, body, `"short_name": "foo"`)
require.Contains(t, body, `"name": "foobar"`)
require.Contains(t, body, `"src": "https://github.com/maxence-charriere/go-app/blob/master/docs/web/icon.png"`)
require.Contains(t, body, `"src": "https://github.com/maxence-charriere/go-app/blob/master/docs/web/icon.png"`)
require.Contains(t, body, `"src": "https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.png"`)
require.Contains(t, body, `"src": "https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.png"`)
require.Contains(t, body, `"background_color": "#0000f0"`)
require.Contains(t, body, `"theme_color": "#0000ff"`)
require.Contains(t, body, `"scope": "/"`)
Expand All @@ -383,8 +383,8 @@ func TestHandlerServeManifestJSONWithRemoteBucket(t *testing.T) {
require.Equal(t, "application/manifest+json", w.Header().Get("Content-Type"))
require.Contains(t, body, `"short_name": "foo"`)
require.Contains(t, body, `"name": "foobar"`)
require.Contains(t, body, `"src": "https://github.com/maxence-charriere/go-app/blob/master/docs/web/icon.png"`)
require.Contains(t, body, `"src": "https://github.com/maxence-charriere/go-app/blob/master/docs/web/icon.png"`)
require.Contains(t, body, `"src": "https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.png"`)
require.Contains(t, body, `"src": "https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.png"`)
require.Contains(t, body, `"background_color": "#0000f0"`)
require.Contains(t, body, `"theme_color": "#0000ff"`)
require.Contains(t, body, `"scope": "/"`)
Expand All @@ -410,8 +410,8 @@ func TestHandlerServeManifestJSONWithGitHubPages(t *testing.T) {
require.Equal(t, "application/manifest+json", w.Header().Get("Content-Type"))
require.Contains(t, body, `"short_name": "foo"`)
require.Contains(t, body, `"name": "foobar"`)
require.Contains(t, body, `"src": "https://github.com/maxence-charriere/go-app/blob/master/docs/web/icon.png"`)
require.Contains(t, body, `"src": "https://github.com/maxence-charriere/go-app/blob/master/docs/web/icon.png"`)
require.Contains(t, body, `"src": "https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.png"`)
require.Contains(t, body, `"src": "https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.png"`)
require.Contains(t, body, `"background_color": "#0000f0"`)
require.Contains(t, body, `"theme_color": "#0000ff"`)
require.Contains(t, body, `"scope": "/go-app/"`)
Expand Down

0 comments on commit f5665d9

Please sign in to comment.