mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
* Add funscript route to scenes Adds a /scene/:id/funscript route which serves a funscript file, if present. Current convention is that these are files stored with the same path, but with the extension ".funscript". * Look for funscript during scan This is stored in the Scene record and used to drive UI changes for funscript support. Currently, that's limited to a funscript link in the Scene's file info. * Add filtering and sorting for interactive * Add Handy connection key to interface config * Add Handy client and placeholder component. Uses defucilis/thehandy, but not thehandy-react as I had difficulty integrating the context with the existing components. Instead, the expensive calculation for the server time offset is put in localStorage for reuse. A debounce was added when scrubbing the video, as otherwise it spammed the Handy API with updates to the current offset.
125 lines
4.4 KiB
Go
125 lines
4.4 KiB
Go
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) Directory(ctx context.Context, path *string) (*models.Directory, error) {
|
|
var dirPath = ""
|
|
if path != nil {
|
|
dirPath = *path
|
|
}
|
|
currentDir := utils.GetDir(dirPath)
|
|
|
|
return &models.Directory{
|
|
Path: currentDir,
|
|
Parent: utils.GetParent(currentDir),
|
|
Directories: utils.ListDir(currentDir),
|
|
}, nil
|
|
}
|
|
|
|
func makeConfigResult() *models.ConfigResult {
|
|
return &models.ConfigResult{
|
|
General: makeConfigGeneralResult(),
|
|
Interface: makeConfigInterfaceResult(),
|
|
Dlna: makeConfigDLNAResult(),
|
|
}
|
|
}
|
|
|
|
func makeConfigGeneralResult() *models.ConfigGeneralResult {
|
|
config := config.GetInstance()
|
|
logFile := config.GetLogFile()
|
|
|
|
maxTranscodeSize := config.GetMaxTranscodeSize()
|
|
maxStreamingTranscodeSize := config.GetMaxStreamingTranscodeSize()
|
|
|
|
scraperUserAgent := config.GetScraperUserAgent()
|
|
scraperCDPPath := config.GetScraperCDPPath()
|
|
|
|
return &models.ConfigGeneralResult{
|
|
Stashes: config.GetStashPaths(),
|
|
DatabasePath: config.GetDatabasePath(),
|
|
GeneratedPath: config.GetGeneratedPath(),
|
|
ConfigFilePath: config.GetConfigFilePath(),
|
|
ScrapersPath: config.GetScrapersPath(),
|
|
CachePath: config.GetCachePath(),
|
|
CalculateMd5: config.IsCalculateMD5(),
|
|
VideoFileNamingAlgorithm: config.GetVideoFileNamingAlgorithm(),
|
|
ParallelTasks: config.GetParallelTasks(),
|
|
PreviewSegments: config.GetPreviewSegments(),
|
|
PreviewSegmentDuration: config.GetPreviewSegmentDuration(),
|
|
PreviewExcludeStart: config.GetPreviewExcludeStart(),
|
|
PreviewExcludeEnd: config.GetPreviewExcludeEnd(),
|
|
PreviewPreset: config.GetPreviewPreset(),
|
|
MaxTranscodeSize: &maxTranscodeSize,
|
|
MaxStreamingTranscodeSize: &maxStreamingTranscodeSize,
|
|
APIKey: config.GetAPIKey(),
|
|
Username: config.GetUsername(),
|
|
Password: config.GetPasswordHash(),
|
|
MaxSessionAge: config.GetMaxSessionAge(),
|
|
LogFile: &logFile,
|
|
LogOut: config.GetLogOut(),
|
|
LogLevel: config.GetLogLevel(),
|
|
LogAccess: config.GetLogAccess(),
|
|
VideoExtensions: config.GetVideoExtensions(),
|
|
ImageExtensions: config.GetImageExtensions(),
|
|
GalleryExtensions: config.GetGalleryExtensions(),
|
|
CreateGalleriesFromFolders: config.GetCreateGalleriesFromFolders(),
|
|
Excludes: config.GetExcludes(),
|
|
ImageExcludes: config.GetImageExcludes(),
|
|
ScraperUserAgent: &scraperUserAgent,
|
|
ScraperCertCheck: config.GetScraperCertCheck(),
|
|
ScraperCDPPath: &scraperCDPPath,
|
|
StashBoxes: config.GetStashBoxes(),
|
|
}
|
|
}
|
|
|
|
func makeConfigInterfaceResult() *models.ConfigInterfaceResult {
|
|
config := config.GetInstance()
|
|
menuItems := config.GetMenuItems()
|
|
soundOnPreview := config.GetSoundOnPreview()
|
|
wallShowTitle := config.GetWallShowTitle()
|
|
wallPlayback := config.GetWallPlayback()
|
|
maximumLoopDuration := config.GetMaximumLoopDuration()
|
|
autostartVideo := config.GetAutostartVideo()
|
|
showStudioAsText := config.GetShowStudioAsText()
|
|
css := config.GetCSS()
|
|
cssEnabled := config.GetCSSEnabled()
|
|
language := config.GetLanguage()
|
|
slideshowDelay := config.GetSlideshowDelay()
|
|
handyKey := config.GetHandyKey()
|
|
|
|
return &models.ConfigInterfaceResult{
|
|
MenuItems: menuItems,
|
|
SoundOnPreview: &soundOnPreview,
|
|
WallShowTitle: &wallShowTitle,
|
|
WallPlayback: &wallPlayback,
|
|
MaximumLoopDuration: &maximumLoopDuration,
|
|
AutostartVideo: &autostartVideo,
|
|
ShowStudioAsText: &showStudioAsText,
|
|
CSS: &css,
|
|
CSSEnabled: &cssEnabled,
|
|
Language: &language,
|
|
SlideshowDelay: &slideshowDelay,
|
|
HandyKey: &handyKey,
|
|
}
|
|
}
|
|
|
|
func makeConfigDLNAResult() *models.ConfigDLNAResult {
|
|
config := config.GetInstance()
|
|
|
|
return &models.ConfigDLNAResult{
|
|
ServerName: config.GetDLNAServerName(),
|
|
Enabled: config.GetDLNADefaultEnabled(),
|
|
WhitelistedIPs: config.GetDLNADefaultIPWhitelist(),
|
|
Interfaces: config.GetDLNAInterfaces(),
|
|
}
|
|
}
|