Skip to content

Commit

Permalink
no resolve app manifest scope (#986)
Browse files Browse the repository at this point in the history
* Update http.go

* fix test
  • Loading branch information
maxence-charriere authored Aug 22, 2024
1 parent 427b7b2 commit 2d546e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions pkg/app/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,6 @@ func (h *Handler) makeAppWorkerJS() []byte {
}

func (h *Handler) makeManifestJSON() []byte {
scope := h.Resources.Resolve("/")
if scope != "/" && !strings.HasSuffix(scope, "/") {
scope += "/"
}

var b bytes.Buffer
if err := template.
Must(template.New("manifest.webmanifest").Parse(manifestJSON)).
Expand All @@ -410,7 +405,7 @@ func (h *Handler) makeManifestJSON() []byte {
MaskableIcon: h.Resources.Resolve(h.Icon.Maskable),
BackgroundColor: h.BackgroundColor,
ThemeColor: h.ThemeColor,
Scope: scope,
Scope: "/",
StartURL: h.Resources.Resolve("/"),
}); err != nil {
panic(errors.New("initializing manifest.webmanifest failed").Wrap(err))
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func TestHandlerServeManifestJSONWithGitHubPages(t *testing.T) {
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/"`)
require.Contains(t, body, `"scope": "/"`)
require.Contains(t, body, `"start_url": "/go-app"`)
}

Expand Down

0 comments on commit 2d546e8

Please sign in to comment.