diff --git a/internal/api/routes_studio.go b/internal/api/routes_studio.go index a77763e8d..85c66e199 100644 --- a/internal/api/routes_studio.go +++ b/internal/api/routes_studio.go @@ -3,10 +3,12 @@ package api import ( "context" "errors" + "io" "net/http" "strconv" "github.com/go-chi/chi" + "github.com/stashapp/stash/internal/static" "github.com/stashapp/stash/pkg/logger" "github.com/stashapp/stash/pkg/models" "github.com/stashapp/stash/pkg/studio" @@ -55,7 +57,14 @@ func (rs studioRoutes) Image(w http.ResponseWriter, r *http.Request) { } if len(image) == 0 { - image, _ = utils.ProcessBase64Image(models.DefaultStudioImage) + const defaultStudioImage = "studio/studio.svg" + + // fall back to static image + f, _ := static.Studio.Open(defaultStudioImage) + defer f.Close() + stat, _ := f.Stat() + http.ServeContent(w, r, "studio.svg", stat.ModTime(), f.(io.ReadSeeker)) + return } if err := utils.ServeImage(image, w, r); err != nil { diff --git a/internal/api/routes_tag.go b/internal/api/routes_tag.go index e3ee439e9..4c0ff43b8 100644 --- a/internal/api/routes_tag.go +++ b/internal/api/routes_tag.go @@ -3,10 +3,12 @@ package api import ( "context" "errors" + "io" "net/http" "strconv" "github.com/go-chi/chi" + "github.com/stashapp/stash/internal/static" "github.com/stashapp/stash/pkg/logger" "github.com/stashapp/stash/pkg/models" "github.com/stashapp/stash/pkg/tag" @@ -55,7 +57,14 @@ func (rs tagRoutes) Image(w http.ResponseWriter, r *http.Request) { } if len(image) == 0 { - image = models.DefaultTagImage + const defaultTagImage = "tag/tag.svg" + + // fall back to static image + f, _ := static.Tag.Open(defaultTagImage) + defer f.Close() + stat, _ := f.Stat() + http.ServeContent(w, r, "tag.svg", stat.ModTime(), f.(io.ReadSeeker)) + return } if err := utils.ServeImage(image, w, r); err != nil { diff --git a/internal/static/embed.go b/internal/static/embed.go index bc49aec12..9be76afa4 100644 --- a/internal/static/embed.go +++ b/internal/static/embed.go @@ -13,3 +13,9 @@ var Scene embed.FS //go:embed image var Image embed.FS + +//go:embed tag +var Tag embed.FS + +//go:embed studio +var Studio embed.FS diff --git a/internal/static/studio/studio.svg b/internal/static/studio/studio.svg new file mode 100644 index 000000000..bea97aa9f --- /dev/null +++ b/internal/static/studio/studio.svg @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/internal/static/tag/tag.svg b/internal/static/tag/tag.svg new file mode 100644 index 000000000..3e5eb4999 --- /dev/null +++ b/internal/static/tag/tag.svg @@ -0,0 +1,67 @@ + + + + + + + + image/svg+xml + + + + + + + + + \ No newline at end of file diff --git a/pkg/models/model_studio.go b/pkg/models/model_studio.go index 989415293..fed4fafa3 100644 --- a/pkg/models/model_studio.go +++ b/pkg/models/model_studio.go @@ -37,8 +37,6 @@ type StudioPartial struct { IgnoreAutoTag *bool `db:"ignore_auto_tag" json:"ignore_auto_tag"` } -var DefaultStudioImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4wgVBQsJl1CMZAAAASJJREFUeNrt3N0JwyAYhlEj3cj9R3Cm5rbkqtAP+qrnGaCYHPwJpLlaa++mmLpbAERAgAgIEAEBIiBABERAgAgIEAEBIiBABERAgAgIEAHZuVflj40x4i94zhk9vqsVvEq6AsQqMP1EjORx20OACAgQRRx7T+zzcFBxcjNDfoB4ntQqTm5Awo7MlqywZxcgYQ+RlqywJ3ozJAQCSBiEJSsQA0gYBpDAgAARECACAkRAgAgIEAERECACAmSjUv6eAOSB8m8YIGGzBUjYbAESBgMkbBkDEjZbgITBAClcxiqQvEoatreYIWEBASIgJ4Gkf11ntXH3nS9uxfGWfJ5J9hAgAgJEQAQEiIAAERAgAgJEQAQEiIAAERAgAgJEQAQEiL7qBuc6RKLHxr0CAAAAAElFTkSuQmCC" - func NewStudio(name string) *Studio { currentTime := time.Now() return &Studio{ diff --git a/pkg/models/model_tag.go b/pkg/models/model_tag.go index b12574155..f57bf199e 100644 --- a/pkg/models/model_tag.go +++ b/pkg/models/model_tag.go @@ -58,132 +58,3 @@ func (t *TagPaths) Append(o interface{}) { func (t *TagPaths) New() interface{} { return &TagPath{} } - -// Original Tag image from: https://fontawesome.com/icons/tag?style=solid -// Modified to change color and rotate -// Licensed under CC Attribution 4.0: https://fontawesome.com/license -var DefaultTagImage = []byte(` - - - - - - image/svg+xml - - - - - - - - -`) - -// var DefaultTagImage = []byte(` -// -// -// -// -// -// image/svg+xml -// -// -// -// -// -// -// -// -// `) diff --git a/pkg/sqlite/setup_test.go b/pkg/sqlite/setup_test.go index 4300111cf..affe3cd72 100644 --- a/pkg/sqlite/setup_test.go +++ b/pkg/sqlite/setup_test.go @@ -1726,5 +1726,5 @@ func linkTagsParent(ctx context.Context, qb models.TagReaderWriter) error { } func addTagImage(ctx context.Context, qb models.TagWriter, tagIndex int) error { - return qb.UpdateImage(ctx, tagIDs[tagIndex], models.DefaultTagImage) + return qb.UpdateImage(ctx, tagIDs[tagIndex], []byte("image")) }