mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Support multiple content folders. Closes #2
This commit is contained in:
32
pkg/api/resolver_query_configuration.go
Normal file
32
pkg/api/resolver_query_configuration.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/stashapp/stash/pkg/manager/config"
|
||||
"github.com/stashapp/stash/pkg/models"
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
)
|
||||
|
||||
func (r *queryResolver) Configuration(ctx context.Context) (models.ConfigResult, error) {
|
||||
return makeConfigResult(), nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) Directories(ctx context.Context, path *string) ([]string, error) {
|
||||
var dirPath = ""
|
||||
if path != nil {
|
||||
dirPath = *path
|
||||
}
|
||||
return utils.ListDir(dirPath), nil
|
||||
}
|
||||
|
||||
func makeConfigResult() models.ConfigResult {
|
||||
return models.ConfigResult{
|
||||
General: makeConfigGeneralResult(),
|
||||
}
|
||||
}
|
||||
|
||||
func makeConfigGeneralResult() models.ConfigGeneralResult {
|
||||
return models.ConfigGeneralResult{
|
||||
Stashes: config.GetStashPaths(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user