diff --git a/pkg/api/images.go b/pkg/api/images.go new file mode 100644 index 000000000..48b5d18d5 --- /dev/null +++ b/pkg/api/images.go @@ -0,0 +1,19 @@ +package api + +import ( + "math/rand" + + "github.com/gobuffalo/packr/v2" +) + +var performerBox *packr.Box + +func initialiseImages() { + performerBox = packr.New("Performer Box", "../../static/performer") +} + +func getRandomPerformerImage() ([]byte, error) { + imageFiles := performerBox.List() + index := rand.Intn(len(imageFiles)) + return performerBox.Find(imageFiles[index]) +} diff --git a/pkg/api/resolver_mutation_performer.go b/pkg/api/resolver_mutation_performer.go index 854e012f9..ab06dce10 100644 --- a/pkg/api/resolver_mutation_performer.go +++ b/pkg/api/resolver_mutation_performer.go @@ -19,10 +19,11 @@ func (r *mutationResolver) PerformerCreate(ctx context.Context, input models.Per var err error if input.Image == nil { - input.Image = &models.DefaultPerformerImage + imageData, err = getRandomPerformerImage() + } else { + _, imageData, err = utils.ProcessBase64Image(*input.Image) } - _, imageData, err = utils.ProcessBase64Image(*input.Image) if err != nil { return nil, err } diff --git a/pkg/api/server.go b/pkg/api/server.go index 65454f704..e75298540 100644 --- a/pkg/api/server.go +++ b/pkg/api/server.go @@ -36,6 +36,8 @@ func Start() { //legacyUiBox = packr.New("UI Box", "../../ui/v1/dist/stash-frontend") setupUIBox = packr.New("Setup UI Box", "../../ui/setup") + initialiseImages() + r := chi.NewRouter() r.Use(middleware.Recoverer) diff --git a/pkg/models/model_performer.go b/pkg/models/model_performer.go index e833a9598..8d3beb3db 100644 --- a/pkg/models/model_performer.go +++ b/pkg/models/model_performer.go @@ -27,5 +27,3 @@ type Performer struct { CreatedAt SQLiteTimestamp `db:"created_at" json:"created_at"` UpdatedAt SQLiteTimestamp `db:"updated_at" json:"updated_at"` } - -var DefaultPerformerImage string = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAC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CWRGVNsJoXwj9sOwVlLaqpoVrcJHS8/nxLFhD1i6bzIJUQjBGHIopLXEwbSzFdXcKbpKvaNJKuxlMxFwaAXm27csSCVIJ4lDR82BxR+LWMHO2sUka8hpBvMBVSdZmcLHJ3kcE0HK1aoJUQwGEMDzzyJpCY/IbGxvxO134wsusswS4Hm46D5ebT50JUg1pZaU4uAwejWoQgmFy0JgWFGaNag5cDzc/eSQiSDv+0+JNkHrgPhAGkZhKqW6f0RSllhjcdP5+IoCkkVyD3AWpBGvBt1dbDTutcF+2N4vAjZuqXnhi1JPVIUQoBCUIYCmvXr26tYDFjAHnmGQNnrhIxKiOYYhB4pD177kmOEEAF4Yo1ZZCECW3Z6Nos1oFQZkSqbXuwu8ihnQfuguCFAS4ofW+IxBhyPepfsl4EnH4HeohFtNwT7WmQ7AIdv+G5KYqCVYQ4IYSiLWm6LEuzunNO3A3ImhBEqhnmOLIWsskYA1sw6aAC51CCAJYC8UcC0lpO8tJBDi0hjO0XFX92hRGkErInIgRxBesJpmmIXNCBKpoYkxoGVQaCilIKxNGh0HJf5SCBEYpSFAY8zcMQ9XFKHJwbwAAAABJRU5ErkJggg==" diff --git a/static/performer/NoName01.png b/static/performer/NoName01.png new file mode 100644 index 000000000..6dba336ea Binary files /dev/null and b/static/performer/NoName01.png differ diff --git a/static/performer/NoName02.png b/static/performer/NoName02.png new file mode 100644 index 000000000..3e046bf4b Binary files /dev/null and b/static/performer/NoName02.png differ diff --git a/static/performer/NoName03.png b/static/performer/NoName03.png new file mode 100644 index 000000000..371b4a007 Binary files /dev/null and b/static/performer/NoName03.png differ diff --git a/static/performer/NoName04.png b/static/performer/NoName04.png new file mode 100644 index 000000000..dada3f88c Binary files /dev/null and b/static/performer/NoName04.png differ diff --git a/static/performer/NoName05.png b/static/performer/NoName05.png new file mode 100644 index 000000000..e84631a6f Binary files /dev/null and b/static/performer/NoName05.png differ diff --git a/static/performer/NoName06.png b/static/performer/NoName06.png new file mode 100644 index 000000000..3c46ac8f8 Binary files /dev/null and b/static/performer/NoName06.png differ diff --git a/static/performer/NoName07.png b/static/performer/NoName07.png new file mode 100644 index 000000000..c3845cf9c Binary files /dev/null and b/static/performer/NoName07.png differ diff --git a/static/performer/NoName08.png b/static/performer/NoName08.png new file mode 100644 index 000000000..46f84f340 Binary files /dev/null and b/static/performer/NoName08.png differ diff --git a/static/performer/NoName09.png b/static/performer/NoName09.png new file mode 100644 index 000000000..5a7a014df Binary files /dev/null and b/static/performer/NoName09.png differ diff --git a/static/performer/NoName10.png b/static/performer/NoName10.png new file mode 100644 index 000000000..9829b672a Binary files /dev/null and b/static/performer/NoName10.png differ diff --git a/static/performer/NoName11.png b/static/performer/NoName11.png new file mode 100644 index 000000000..43acea16c Binary files /dev/null and b/static/performer/NoName11.png differ diff --git a/static/performer/NoName12.png b/static/performer/NoName12.png new file mode 100644 index 000000000..0e6854491 Binary files /dev/null and b/static/performer/NoName12.png differ diff --git a/static/performer/NoName13.png b/static/performer/NoName13.png new file mode 100644 index 000000000..9872fdb66 Binary files /dev/null and b/static/performer/NoName13.png differ diff --git a/static/performer/NoName14.png b/static/performer/NoName14.png new file mode 100644 index 000000000..78684eec1 Binary files /dev/null and b/static/performer/NoName14.png differ diff --git a/static/performer/NoName15.png b/static/performer/NoName15.png new file mode 100644 index 000000000..1c2ee9550 Binary files /dev/null and b/static/performer/NoName15.png differ diff --git a/static/performer/NoName16.png b/static/performer/NoName16.png new file mode 100644 index 000000000..d87404095 Binary files /dev/null and b/static/performer/NoName16.png differ diff --git a/static/performer/NoName17.png b/static/performer/NoName17.png new file mode 100644 index 000000000..5abcf996d Binary files /dev/null and b/static/performer/NoName17.png differ diff --git a/static/performer/NoName18.png b/static/performer/NoName18.png new file mode 100644 index 000000000..bf5af3c94 Binary files /dev/null and b/static/performer/NoName18.png differ diff --git a/static/performer/NoName19.png b/static/performer/NoName19.png new file mode 100644 index 000000000..27463314a Binary files /dev/null and b/static/performer/NoName19.png differ diff --git a/static/performer/NoName20.png b/static/performer/NoName20.png new file mode 100644 index 000000000..ed4477a7a Binary files /dev/null and b/static/performer/NoName20.png differ diff --git a/static/performer/NoName21.png b/static/performer/NoName21.png new file mode 100644 index 000000000..242c1a31e Binary files /dev/null and b/static/performer/NoName21.png differ diff --git a/static/performer/NoName22.png b/static/performer/NoName22.png new file mode 100644 index 000000000..2337c6380 Binary files /dev/null and b/static/performer/NoName22.png differ diff --git a/static/performer/NoName23.png b/static/performer/NoName23.png new file mode 100644 index 000000000..1ec9ef310 Binary files /dev/null and b/static/performer/NoName23.png differ diff --git a/static/performer/NoName24.png b/static/performer/NoName24.png new file mode 100644 index 000000000..a5d760165 Binary files /dev/null and b/static/performer/NoName24.png differ diff --git a/static/performer/NoName25.png b/static/performer/NoName25.png new file mode 100644 index 000000000..2c0075adb Binary files /dev/null and b/static/performer/NoName25.png differ diff --git a/static/performer/NoName26.png b/static/performer/NoName26.png new file mode 100644 index 000000000..1208c6564 Binary files /dev/null and b/static/performer/NoName26.png differ diff --git a/static/performer/NoName27.png b/static/performer/NoName27.png new file mode 100644 index 000000000..78af4bf62 Binary files /dev/null and b/static/performer/NoName27.png differ diff --git a/static/performer/NoName28.png b/static/performer/NoName28.png new file mode 100644 index 000000000..ca6defc01 Binary files /dev/null and b/static/performer/NoName28.png differ diff --git a/static/performer/NoName29.png b/static/performer/NoName29.png new file mode 100644 index 000000000..fb71efb7e Binary files /dev/null and b/static/performer/NoName29.png differ diff --git a/static/performer/NoName30.png b/static/performer/NoName30.png new file mode 100644 index 000000000..62ca1f856 Binary files /dev/null and b/static/performer/NoName30.png differ diff --git a/static/performer/NoName31.png b/static/performer/NoName31.png new file mode 100644 index 000000000..cd69bce36 Binary files /dev/null and b/static/performer/NoName31.png differ diff --git a/static/performer/NoName32.png b/static/performer/NoName32.png new file mode 100644 index 000000000..2d14bb0ec Binary files /dev/null and b/static/performer/NoName32.png differ diff --git a/static/performer/NoName33.png b/static/performer/NoName33.png new file mode 100644 index 000000000..9c532dcb9 Binary files /dev/null and b/static/performer/NoName33.png differ diff --git a/static/performer/NoName34.png b/static/performer/NoName34.png new file mode 100644 index 000000000..5fb88c9c7 Binary files /dev/null and b/static/performer/NoName34.png differ diff --git a/static/performer/NoName35.png b/static/performer/NoName35.png new file mode 100644 index 000000000..3e3513a1e Binary files /dev/null and b/static/performer/NoName35.png differ diff --git a/static/performer/NoName36.png b/static/performer/NoName36.png new file mode 100644 index 000000000..eab1fd117 Binary files /dev/null and b/static/performer/NoName36.png differ diff --git a/static/performer/NoName37.png b/static/performer/NoName37.png new file mode 100644 index 000000000..5c6af0886 Binary files /dev/null and b/static/performer/NoName37.png differ diff --git a/static/performer/NoName38.png b/static/performer/NoName38.png new file mode 100644 index 000000000..9f969d9d9 Binary files /dev/null and b/static/performer/NoName38.png differ diff --git a/static/performer/NoName39.png b/static/performer/NoName39.png new file mode 100644 index 000000000..f94611b1a Binary files /dev/null and b/static/performer/NoName39.png differ diff --git a/static/performer/NoName40.png b/static/performer/NoName40.png new file mode 100644 index 000000000..62c703fa4 Binary files /dev/null and b/static/performer/NoName40.png differ