Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into prs/4065
Browse files Browse the repository at this point in the history
  • Loading branch information
WithoutPants committed Oct 10, 2023
2 parents b038aff + 623dc83 commit 573d21f
Show file tree
Hide file tree
Showing 3,072 changed files with 10,121 additions and 1,266,650 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
23 changes: 15 additions & 8 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: docker exec -t build /bin/bash -c "make generate-backend"

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
Expand All @@ -42,19 +42,26 @@ jobs:
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: --modules-download-mode=vendor --timeout=5m
#
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
args: --timeout=5m

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go.
# skip-go-installation: true
# Optional: if set to true, then all caching functionality will be completely disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
skip-pkg-cache: true
# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
skip-build-cache: true
# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
# skip-build-cache: true

# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"

- name: Cleanup build container
run: docker rm -f -v build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Go
####

# Vendored dependencies
vendor

# Binaries for programs and plugins
*.exe
*.exe~
Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# options for analysis running
run:
timeout: 5m
modules-download-mode: vendor

linters:
disable-all: true
Expand Down
4 changes: 4 additions & 0 deletions .mockery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dir: ./pkg/models
name: ".*ReaderWriter"
outpkg: mocks
output: ./pkg/models/mocks
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ cross-compile-linux-arm64v8: build
cross-compile-linux-arm32v7: export GOOS := linux
cross-compile-linux-arm32v7: export GOARCH := arm
cross-compile-linux-arm32v7: export GOARM := 7
cross-compile-linux-arm32v7: export CC := arm-linux-gnueabihf-gcc
cross-compile-linux-arm32v7: export CC := arm-linux-gnueabi-gcc -march=armv7-a
cross-compile-linux-arm32v7: STASH_OUTPUT := -o dist/stash-linux-arm32v7
cross-compile-linux-arm32v7: PHASHER_OUTPUT := -o dist/phasher-linux-arm32v7
cross-compile-linux-arm32v7: flags-release
Expand Down Expand Up @@ -319,7 +319,7 @@ it:
# generates test mocks
.PHONY: generate-test-mocks
generate-test-mocks:
go run github.com/vektra/mockery/v2 --dir ./pkg/models --name '.*ReaderWriter' --outpkg mocks --output ./pkg/models/mocks
go run github.com/vektra/mockery/v2

# runs server
# sets the config file to use the local dev config
Expand Down
6 changes: 3 additions & 3 deletions cmd/phasher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

flag "github.com/spf13/pflag"
"github.com/stashapp/stash/pkg/ffmpeg"
"github.com/stashapp/stash/pkg/file"
"github.com/stashapp/stash/pkg/hash/videophash"
"github.com/stashapp/stash/pkg/models"
)

func customUsage() {
Expand All @@ -28,8 +28,8 @@ func printPhash(ff *ffmpeg.FFMpeg, ffp ffmpeg.FFProbe, inputfile string, quiet *
// videoFile.Path (from BaseFile)
// videoFile.Duration
// The rest of the struct isn't needed.
vf := &file.VideoFile{
BaseFile: &file.BaseFile{Path: inputfile},
vf := &models.VideoFile{
BaseFile: &models.BaseFile{Path: inputfile},
Duration: ffvideoFile.FileDuration,
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/stash/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:generate go run -mod=vendor github.com/99designs/gqlgen
//go:generate go run github.com/99designs/gqlgen
package main

import (
Expand Down
1 change: 0 additions & 1 deletion docker/build/x86_64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ RUN apk add --no-cache make alpine-sdk
WORKDIR /stash
COPY ./go* ./*.go Makefile gqlgen.yml .gqlgenc.yml /stash/
COPY ./scripts /stash/scripts/
COPY ./vendor /stash/vendor/
COPY ./pkg /stash/pkg/
COPY ./cmd /stash/cmd
COPY ./internal /stash/internal
Expand Down
1 change: 0 additions & 1 deletion docker/build/x86_64/Dockerfile-CUDA
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ RUN apt update && apt install -y build-essential golang
WORKDIR /stash
COPY ./go* ./*.go Makefile gqlgen.yml .gqlgenc.yml /stash/
COPY ./scripts /stash/scripts/
COPY ./vendor /stash/vendor/
COPY ./pkg /stash/pkg/
COPY ./cmd /stash/cmd
COPY ./internal /stash/internal
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require (
github.com/99designs/gqlgen v0.17.2
github.com/Yamashou/gqlgenc v0.0.6
github.com/anacrolix/dms v1.2.2
github.com/antchfx/htmlquery v1.2.5-0.20211125074323-810ee8082758
github.com/antchfx/htmlquery v1.3.0
github.com/chromedp/cdproto v0.0.0-20210622022015-fe1827b46b84
github.com/chromedp/chromedp v0.7.3
github.com/corona10/goimagehash v1.0.3
Expand Down Expand Up @@ -66,7 +66,7 @@ require (

require (
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/antchfx/xpath v1.2.0 // indirect
github.com/antchfx/xpath v1.2.3 // indirect
github.com/asticode/go-astikit v0.20.0 // indirect
github.com/asticode/go-astits v1.8.0 // indirect
github.com/chromedp/sysutil v1.0.0 // indirect
Expand Down
13 changes: 8 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNg
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/andybalholm/brotli v1.0.3 h1:fpcw+r1N1h0Poc1F/pHbW40cUm/lMEQslZtCkBQ0UnM=
github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/antchfx/htmlquery v1.2.5-0.20211125074323-810ee8082758 h1:Ldjwcl7T8VqCKgQQ0TfPI8fNb8O/GtMXcYaHlqOu99s=
github.com/antchfx/htmlquery v1.2.5-0.20211125074323-810ee8082758/go.mod h1:2xO6iu3EVWs7R2JYqBbp8YzG50gj/ofqs5/0VZoDZLc=
github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8=
github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/antchfx/htmlquery v1.3.0 h1:5I5yNFOVI+egyia5F2s/5Do2nFWxJz41Tr3DyfKD25E=
github.com/antchfx/htmlquery v1.3.0/go.mod h1:zKPDVTMhfOmcwxheXUsx4rKJy8KEY/PU6eXr/2SebQ8=
github.com/antchfx/xpath v1.2.3 h1:CCZWOzv5bAqjVv0offZ2LVgVYFbeldKQVuLNbViZdes=
github.com/antchfx/xpath v1.2.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0=
github.com/apache/arrow/go/arrow v0.0.0-20210521153258-78c88a9f517b/go.mod h1:R4hW3Ug0s+n4CUsWHKOj00Pu01ZqU4x/hSF5kXUcXKQ=
Expand Down Expand Up @@ -909,7 +909,6 @@ golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
Expand All @@ -935,6 +934,7 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -1064,10 +1064,12 @@ golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -1079,6 +1081,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
32 changes: 32 additions & 0 deletions gqlgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ autobind:

models:
# Scalars
ID:
model:
- github.com/99designs/gqlgen/graphql.ID
- github.com/99designs/gqlgen/graphql.IntID
- github.com/stashapp/stash/pkg/models.FileID
- github.com/stashapp/stash/pkg/models.FolderID
Int64:
model: github.com/99designs/gqlgen/graphql.Int64
Timestamp:
Expand All @@ -33,6 +39,30 @@ models:
fields:
title:
resolver: true
# override models, from internal/api/models.go
BaseFile:
model: github.com/stashapp/stash/internal/api.BaseFile
GalleryFile:
model: github.com/stashapp/stash/internal/api.GalleryFile
fields:
# override fingerprint field
fingerprints:
fieldName: FingerprintSlice
VideoFile:
fields:
# override fingerprint field
fingerprints:
fieldName: FingerprintSlice
# override float fields - #1572
duration:
fieldName: DurationFinite
frame_rate:
fieldName: FrameRateFinite
ImageFile:
fields:
# override fingerprint field
fingerprints:
fieldName: FingerprintSlice
# autobind on config causes generation issues
BlobsStorageType:
model: github.com/stashapp/stash/internal/manager/config.BlobsStorageType
Expand Down Expand Up @@ -118,4 +148,6 @@ models:
model: github.com/stashapp/stash/internal/identify.MetadataOptions
ScraperSourceInput:
model: github.com/stashapp/stash/pkg/scraper.Source
SavedFindFilterType:
model: github.com/stashapp/stash/pkg/models.FindFilterType

10 changes: 9 additions & 1 deletion graphql/documents/data/filter.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@ fragment SavedFilterData on SavedFilter {
id
mode
name
filter
find_filter {
q
page
per_page
sort
direction
}
object_filter
ui_options
}
2 changes: 1 addition & 1 deletion graphql/documents/data/gallery-slim.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fragment SlimGalleryData on Gallery {
id
title
date
url
urls
details
rating100
organized
Expand Down
2 changes: 1 addition & 1 deletion graphql/documents/data/gallery.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fragment GalleryData on Gallery {
updated_at
title
date
url
urls
details
rating100
organized
Expand Down
2 changes: 1 addition & 1 deletion graphql/documents/data/image-slim.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fragment SlimImageData on Image {
id
title
date
url
urls
rating100
organized
o_counter
Expand Down
2 changes: 1 addition & 1 deletion graphql/documents/data/image.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fragment ImageData on Image {
title
rating100
date
url
urls
organized
o_counter
created_at
Expand Down
2 changes: 0 additions & 2 deletions graphql/documents/data/scene-marker.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ fragment SceneMarkerData on SceneMarker {
primary_tag {
id
name
aliases
}

tags {
id
name
aliases
}
}
8 changes: 7 additions & 1 deletion graphql/documents/data/scrapers.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ fragment ScrapedSceneMovieData on ScrapedMovie {
director
url
synopsis
front_image
back_image

studio {
...ScrapedMovieStudioData
}
}

fragment ScrapedSceneStudioData on ScrapedStudio {
Expand Down Expand Up @@ -179,7 +185,7 @@ fragment ScrapedSceneData on ScrapedScene {
fragment ScrapedGalleryData on ScrapedGallery {
title
details
url
urls
date

studio {
Expand Down
2 changes: 2 additions & 0 deletions graphql/documents/data/tag-slim.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ fragment SlimTagData on Tag {
name
aliases
image_path
parent_count
child_count
}
31 changes: 27 additions & 4 deletions graphql/schema/types/filters.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ input FindFilterType {
direction: SortDirectionEnum
}

type SavedFindFilterType {
q: String
page: Int
"""
use per_page = -1 to indicate all results. Defaults to 25.
"""
per_page: Int
sort: String
direction: SortDirectionEnum
}

enum ResolutionEnum {
"144p"
VERY_LOW
Expand Down Expand Up @@ -604,15 +615,24 @@ type SavedFilter {
name: String!
"JSON-encoded filter string"
filter: String!
@deprecated(reason: "use find_filter and object_filter instead")
find_filter: SavedFindFilterType
# maps to any of the AnyFilterInput types
# using a generic Map instead of creating and maintaining match types for inputs
object_filter: Map
# generic map for ui options
ui_options: Map
}

input SaveFilterInput {
"provide ID to overwrite existing filter"
id: ID
mode: FilterMode!
name: String!
"JSON-encoded filter string"
filter: String!
find_filter: FindFilterType
object_filter: Map
# generic map for ui options
ui_options: Map
}

input DestroyFilterInput {
Expand All @@ -621,6 +641,9 @@ input DestroyFilterInput {

input SetDefaultFilterInput {
mode: FilterMode!
"JSON-encoded filter string - null to clear"
filter: String
"null to clear"
find_filter: FindFilterType
object_filter: Map
# generic map for ui options
ui_options: Map
}
Loading

0 comments on commit 573d21f

Please sign in to comment.