* Add sorting to sub-group UI
- Implemented sorting functionality for sub-groups based on their descriptions in the database queries.
- Updated the GroupList component to allow sorting regardless of the view.
- Added localization for sub-group description in en-GB.json.
- Included sub-group description in the list of sortable options in the groups filter model.
* Implement view filtering and saving.
- Refactor GroupList and GroupSubGroupsPanel components for consistency with general models.
- Removed unused defaultFilter from GroupList and GroupSubGroupsPanel.
- Simplified FilteredGroupList by eliminating unnecessary state variables.
- Fixed dropdown alignment issue in FilteredListToolbar by setting menuPortalTarget to document.body.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Add defaultSort and manualSortBy FilteredGroupList fields.
manualSortBy indicates which sort by value allows manual reordering.
Sets both fields to "sub_group_order" in GroupSubGroupsPanel.
* Revert getSort changes
This function needs to be refactored separately
* Handle sub_group_description without getSort
Eliminates the need to poke group-specific logic into getSort.
---------
Co-authored-by: KennyG <kennyg@kennyg.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Configure fields when batch tagging performers
Added a "Configure fields" button that allows you to select which fields
get refreshed when you do "batch update performers"
This field allows you to sync all data with exceptions, or merging your
local edits with stashbox data
* feat(schema): add scene_filter to findDuplicateScenes
Expands the findDuplicateScenes query to accept a full SceneFilterType. This enables filtering out specific directories or tags from the duplication matching process.
* feat(backend): update SceneReaderWriter interface to accept filter
Modifies the FindDuplicates signature to take a SceneFilterType pointer, allowing the underlying repository to filter the pool of scenes before duplicate checking.
* test(backend): update SceneReaderWriter mock
Updates the mock definition to match the new FindDuplicates method signature.
* feat(api): pass scene filter to duplicate checking repository
Modifies the FindDuplicateScenes GraphQL resolver to pass the newly added scene_filter schema argument into the database repository layer.
* feat(sqlite): dynamically build FindDuplicates query
Refactors the FindDuplicates implementation to use the internal qb.makeQuery tool instead of static raw SQL. This enables the duplicate checker to utilize the provided SceneFilterType, natively supporting advanced filtering like path exclusions.
* test(sqlite): update duplicate checking tests
Updates the unit tests to pass a nil scene filter, matching the new FindDuplicates method signature.
* test: add comprehensive scene_filter tests for FindDuplicates
- Add TestSceneStore_FindDuplicatesWithFilter with 5 test cases:
* nil filter baseline
* tag filter includes only tagged duplicate pair
* non-existent tag filter returns empty
* fuzzy matching + tag filter
- Move intPtr helper to setup_test.go
Add data-rating100, data-rating-system, and a --rating-100 CSS custom
property to the .rating-banner element so CSS themes can style ratings
without parsing class names or separately querying the rating-system config.
Purely additive: the existing rating-banner / rating-100-N / rating-N
classes are unchanged, so no existing styles break. No API/schema change;
both values are already available in the component.
Image URLs appended a cache-buster derived from updated_at, which bumps
on any metadata edit (rating, o-counter, tags, etc.). Since none of those
change the image bytes, the URL changed needlessly, forcing the browser
to re-download the image and remount it - most visibly as a reload/flicker
in the gallery lightbox when setting a rating.
Key the cache-buster on the primary file's checksum instead, so the URL
is stable across metadata edits and only changes when the file content
changes. Fall back to updated_at when no primary file is present. Scenes
and galleries use separate builders and are intentionally left on
updated_at, since their thumbnails can change without the underlying
content changing.
Co-authored-by: void-function865 <void-function865@users.noreply.github.com>
* Add data-action attributes to interactive controls for theme targeting
Add stable data-action attributes so CSS themes and plugins can target these
controls without matching on localized text, which breaks under i18n:
- OCounterButton (scene details) and the shared CountButton: data-action
"o-counter" on the o-counter button group (ViewCountButton is left untouched)
- SceneDuplicateChecker per-row action buttons: data-action "merge" and
"delete"
Additive only: existing classes, titles, icons, and behavior are unchanged.
No API/schema change.
* MainNavbar: add data-action="new" to the create button
Gives the navbar New button a stable, locale-independent hook so themes and
plugins can target it without matching on Bootstrap variant classes
(btn-primary) or the localized New label.
Wraps the three remaining detail-page components in PatchComponent so
plugins can use PluginApi.patch.{before,instead,after} on them, matching
the pattern already used for PerformerPage and ScenePage.
Requested in #4510.
Safari has a rendering bug where `transform: scale` applied to an
`<img>` element with very large intrinsic dimensions (e.g. 10246×13662)
renders the image content distorted, even though the element's
bounding box reports the correct portrait size. The lightbox computed
`defaultZoom` to fit natural-size images into view via `transform:
scale` on the `<picture>` wrapping the img, triggering this bug on
macOS and iOS Safari.
Move the `transform` from the `<picture>` element onto a wrapping
`<div>` so the scale never targets a `<picture>`/`<img>` chain. The
img keeps its natural dimensions inside the wrapper, and Safari
renders it correctly. Also drop the unused `<source srcSet>` (it
pointed at the same URL as the fallback `<img>` and provided no
responsive behavior) and the dead `picture > div` CSS rule that had
no matching element. Remove `object-fit: contain` on the img - it
interacted with the wrapper transform in Safari and was a no-op
anyway since the img has no CSS-constrained dimensions.
Verified in Safari, Chrome, and Firefox.
Co-authored-by: void-function865 <void-function865@users.noreply.github.com>
Co-authored-by: Gykes <24581046+Gykes@users.noreply.github.com>
* add only biome config
* purge eslint/prettier remnants
* Add biome dependency
* Add fix option
* Adjust rule inclusions
* Rename biome config to jsonc. Turn off many rules until fixed
* Cleanup eslint suppression comments.
Converted some to biome clauses with XX prefix to disable for now. Fixing of issues to be deferred to later.
* Fix pnpm targets
* fix github action error
---------
Co-authored-by: feederbox826 <feederbox826@users.noreply.github.com>
* Add reference to architecture document
* Update README badges and improve documentation structure
* Update link to metadata sources documentation in README
* Add AI usage policy
* Refactor CONTRIBUTING.md to enhance clarity and structure, link to AI usage policy
* Add pull request template
* Add checkmark to AI usage disclosure section
* Add that failure to discuss large PRs with devs might lead to closure
* feat: use signed urls for videos
When using authentication for stash accesss, cast urls for airplay will not have access to cookies - meaning that Airplay will fail to pass authorization for video stream access.
Updated code to sign urls for videos and streams.
* testing notes: airplay from localhost won’t work, since appletv’s perspective of localhost is different, try casting from IP address (192.168.0.x:9999) or other local DNS name.
* feat: Add signed URLs for scene streaming (AirPlay/Chromecast)
HMAC-signed URLs allow authenticated streaming to devices that cannot pass cookies (AirPlay, Chromecast). Signing is scoped to scene stream using a prefix-based approach so one signature covers all derivative segment URLs.
Credentialid hides username from public network.
When credentials are disabled, signing is bypassed entirely. API key takes precedence over signed params when both are present.
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* fix(scraper): prevent nil pointer dereference in scrapeScene
When scrapeScene finds no results, ret remains nil and is passed to
processSceneRelationships, which unconditionally dereferences it at
line 89 (ret.Performers = ...), causing a panic.
Initialize ret to an empty ScrapedScene so processSceneRelationships
always has a valid pointer. This also preserves the intent of #3953:
returning a scene with only relationship fields set when scraped
non-relationship data is absent.
Fixes panic: runtime error: invalid memory address or nil pointer
dereference at pkg/scraper/mapped.go:89 in processSceneRelationships
* Update mapped.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* test(scraper): add relationships-only scene regression test
Signed-off-by: Marco <130363067+dutchdevil-83@users.noreply.github.com>
* test(scraper): restore scene test and add relationships regression
---------
Signed-off-by: Marco <130363067+dutchdevil-83@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix HTTP body leaks, nil pointer panics, and file handle cleanup
* Extract unzipFile loop body into unzipFileEntry helper
The unzipFile function had defer o.Close() and defer i.Close() inside
a for loop, which is a Go antipattern — defers are function-scoped and
wouldn't execute until unzipFile returned, leaving file handles open
across iterations. Extracting the per-file logic into unzipFileEntry
ensures each defer fires when that function returns, at the end of each
loop iteration.
* Implement list view for Studios page
- Add StudioListTable component with columns for logo, name, aliases, rating, scene count, image count, gallery count, performer count, and related studios
- Update StudioList component to use StudioListTable for List display mode
- Add DisplayMode.List to StudioListFilterOptions to enable list view option in UI
* Remove aliases from NameCell in StudioListTable
* Update StudioListTable: conditional image rendering, intl labels, add related_studios key
* Add StudioListTable.scss and import it
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Remove invalid duplicate named objects from test setup
Studios and tags are enforced to have unique names, so it doesn't make sense to allow them in the datalayer tests
* Convert inner joins to left joins when using or sub-filter
The mutateDeleteFiles Apollo cache update evicted the plural list
queries (findScenes/findImages/findGalleries) but not the singular
detail queries, so the "File Info" counter on a scene/image/gallery
detail page stayed stale until a manual refresh.
Co-authored-by: dev-null-life <264850222+dev-null-life@users.noreply.github.com>
The x86_64 and CUDA backend stages still used golang:1.24.3 while go.mod requires Go 1.25, which broke make docker-build under GOTOOLCHAIN=local. Bump both images to golang:1.25.9 to match docker/compiler/Dockerfile and PR #6869.
Verified with: make docker-build
Fixes https://github.com/stashapp/stash/issues/6887
Co-authored-by: KennyG <kennyg@kennyg.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Fix WebSocket UTF-8 error for non-UTF-8 file paths in subscriptions
Sanitize log messages and job fields (description, subtasks, error)
before sending over WebSocket. File paths with non-UTF-8 characters
caused the browser to close the connection with "Could not decode a
text frame as UTF-8." Invalid bytes are replaced with U+FFFD.
Only the API response layer is affected — underlying stored data is
unchanged.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Replace direct ToValidUTF8 calls to new sanitiseWebsocketString function
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Let the stash ID pill shrink in tagger
On very narrow viewports (e.g. mobile), the stash ID pill will
overflow its container. With this PR, it will instead limit itself
to the width of the container and display with an ellipsis if
necessary.
Fixes#6786
* update postmigration to handle deduplicate folders.
* Split post-migration to perform some tasks before the schema migration
* Reparent files and delete duplicate folder if possible
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This is more consistent with other places that stash IDs are shown,
simplifies the code a bit, and lets you see at a glance which stash
box is being used.
* Add short cuts when only getting zip/folder ids
* Don't show zip folders when viewing scenes and galleries.
Zip folders have no results for scenes and galleries, but will for images.
* Add StudioLogo component
If no studio image is set, shows the studio icon with the studio name.
* Add option to always show studio text
* Implement studio as text option
* Add studio logo to image
* Clarify existing show studio as text option
* Make modal field/value styling consistent
Fixes URL list in studio list styling
* Add stash id pill to studio and tag modals
* Fix create parent check box
* Allow excluding parent studio
Disabled the create checkbox if parent studio is not excluded and does not exist.
* Don't render modal on every studio
* Show dialog when refreshing tags
* Add option to ignore zip file contents while cleaning
Speeds up the clean process with the assumption that files within zip files are not deleted.
* Add UI for new option
* Keep creatable select input focused after creating a new item
When onCreateOption fires, setLoading(true) sets isDisabled on
AsyncCreatableSelect, which triggers a blur and the user loses focus.
Remove isLoading from the isDisabled condition so the input stays
interactive during the async creation; the loading spinner still shows.
Fixes#3998
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Remove unused isLoading destructure in SelectComponent
isLoading flows through via ...props spread in componentProps and
no longer needs to be explicitly destructured.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Apply Prettier formatting to FilterSelect.tsx
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add scenes_size sort option for performers
Adds sorting performers by total file size of associated scenes.
Follows the existing scenes_duration pattern.
Ref: stashapp/stash#5530
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add scenes_size sort option for studios
Adds sorting studios by total file size of associated scenes.
Follows the existing scenes_duration pattern.
Ref: stashapp/stash#5530
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(ui): add Scenes Size sort option for performers and studios
Adds 'Scenes Size' to the sort dropdown for performer and studio
list views, with i18n label.
Ref: stashapp/stash#5530
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: extend scenes_size sort to tags
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Move reused functions/components to separate files
* Add alwaysShow field to ScrapedDialogRow
* Add stash ids to performer merge dialog
* Reuse StashIDsField in TagMergeDialog
* Always show stash ids when available on scene and tag merge dialogs
* Convert career start/end to date
* Update UI to accept dates for career length fields
* Fix date filtering
---------
Co-authored-by: Gykes <24581046+Gykes@users.noreply.github.com>
* feat: add image details to search filter
This change adds the image details field to the image search filter, allowing for better discovery of images based on their description.
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Add BulkUpdateDateInput
* Refactor edit scenes dialog
* Improve bulk date input styling
* Make fields inline in edit performers dialog
* Refactor edit images dialog
* Refactor edit galleries dialog
* Add date and synopsis to bulk update group input
* Refactor edit groups dialog
* Change edit dialog titles to 'Edit x entities'
* Update styling of bulk fields to be consistent with other UI
* Rename BulkUpdateTextInput to generic BulkUpdate
We'll collect other bulk inputs here
* Add and use BulkUpdateFormGroup
* Handle null dates correctly
* Add date clear button and validation
* fix: support string-based fingerprints in hashes filter
* Fix tests and add phash test
File fingerprints weren't using correct types. Filter test wasn't using correct types. Add phash to general files.
---------
Co-authored-by: hyper440 <hyper440@users.noreply.github.com>
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Show scene resolution and duration in tagger
A scene's duration and resolution is often useful to ensure you have
found the right scene. This PR adds the same resolution/duration
overlay from the grid view to the tagger view.
* Show the stash box for each stash ID in the scene merge dialog
Currently, this dialog only shows the ID but not the stash box it
corresponds to. This is not very useful because the ID does not mean
anything to a user.
This renders the ID as "Stashdb | 1234...", mimicing the StashIDPill.
* Use StashIDPill instead
Currently, this dialog just shows a text "Stash-Box Source".
This change instead re-uses the StashIDPill, with the main advantage
that you can immediately tell which stash box is being used.
* Add useDebouncedState hook
* Add basename to folder sort whitelist
* Add parent_folder criterion to gallery
* Add selection on enter if single result
* Fix stale thumbnails after file content changes
When a file's content changed (e.g. after renaming files in a gallery),
the scan handler updated fingerprints but did not bump the entity's
updated_at timestamp. Since thumbnail URLs use updated_at as a cache
buster and are served with immutable/1-year cache headers, browsers
would indefinitely serve the old cached thumbnail.
Update image, scene, and gallery scan handlers to call UpdatePartial
(which sets updated_at to now) whenever file content changes, not only
when a new file association is created.
Add missing .input-group-append .btn border-radius rule to zero out
the left-side radius, matching the existing .input-group-prepend rule.
Fixes#6518
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* Skip scanning zip contents when fingerprint is unchanged
When a zip-based gallery's modification time changes but its content
hash (oshash/md5) remains the same, skip walking and rescanning every
file inside the zip. This avoids expensive per-file fingerprint
recalculation when zip metadata changes without actual content changes.
Closes#6512
* Log a debug message when skipping a zip scan due to unchanged
fingerprint
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Fix edit modal not opening inside gallery view
The modal element was only rendered in the sidebar layout branch, but
gallery images use the non-sidebar path which returned content without
the modal. Also stabilize onEdit/onDelete with useCallback and add
missing dependency array to the Mousetrap useEffect.
Closes#6624
* Render modal once above sidebar conditional
Move {modal} above the withSidebar ternary so it is rendered
exactly once, avoiding the duplication that caused the original bug.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Replace panic with warning if creating a folder hierarchy where parent is equal to current
* Clean stash paths so that comparison works correctly when creating folder hierarchies
* Add basename field to folder
* Add parent_folders field to folder
* Add basename column to folder table
* Add basename filter field
* Create missing folder hierarchies during migration
* Treat files/folders in zips where path can't be made relative as not found
Addresses an issue during clean where corrupt folder entries in zip files could not be removed due to an error during the call to Rel.
* Add root paths parameter to GetOrCreateFolderHierarchy
Ensures that folders are only created up to the root library paths.
* Create full folder hierarchy when scanning a new folder
During a recursive scan, folders should be created as they are encountered (folders are handled in a single thread). This change applies only during a selective scan. Creates up to the root library folder.
* Create folder hierarchy on new file scan
This should only apply when scanning a specific file, as parent folders should be been created during a recursive scan.
* Fix existing folders with missing parents during scan
* Use effective filter for keybinds/view random
* Refactor ImageList to use sidebar
* Add performer age filter to gallery sidebar
* Port metadata info changes
* Fix incorrect patch component parameter
* Update plugin doc and types
* Show unsupported filter criteria in filter tags
Shows a warning coloured filter tag, with warning icon and text "<type> (unsupported) ...". Cannot be edited, can only be removed. Won't be saved to saved filters.
* Generalise filtered recommendation rows. Include warning popover for unsupported criteria
* Disable studio overlay link if selecting
* Prevent scene preview scrubber click navigating during selection
* Prevent gallery preview scrubber click navigating during selection
* Add reveal in file manager button to file info panel
Adds a folder icon button next to the path field in the Scene, Image,
and Gallery file info panels. Clicking it calls a new GraphQL mutation
that opens the file's enclosing directory in the system file manager
(Finder on macOS, Explorer on Windows, xdg-open on Linux).
Also fixes the existing revealInFileManager implementations which were
constructing exec.Command but never calling Run(), making them no-ops:
- darwin: add Run() to open -R
- windows: add Run() and fix flag from \select to /select,<path>
- linux: implement with xdg-open on the parent directory
- desktop.go: use os.Stat instead of FileExists so folders work too
* Disallow reveal operation if request not from loopback
---------
Co-authored-by: 1509x <1509x@users.noreply.github.com>
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Add group filter criteria to tag and studio
* Add sidebar to groups list
* Refactor ListOperations to accept buttons
* Move create new button back to navbar
Having the create new button with a plus icon conflicted with the add sub-group button in the sub-groups view.
* Simplify group-sub-groups view
* Fix custom field import/export for studio
* Update studio unit tests
* Add tag create and update unit tests
* Add custom fields to tag filter graphql
* Add unit tests for tag filtering
* Add filter unit tests for studio
* Make list operation utility component
* Add defaults for sidebar filters
* Refactor gallery list for sidebar
* Fix gallery styling
* Fix sidebar state issues
* Auto-populate query string into name on create
* Remove new gallery button from navbar
* Make components patchable
* Remove reflection from mapped value processing
* AI generated unit tests
* Move mappedConfig to separate file
* Rename group to configScraper
* Separate mapped post-processing code into separate file
* Update test after group rename
* Check map entry when returning scraper
* Refactor config into definition
* Support single string for string slice translation
* Rename config.go to definition.go
* Rename configScraper to definedScraper
* Rename config_scraper.go to defined_scraper.go
* refactor(ui): make ImageCard patchable for plugin extensibility
Refactor ImageCard component to use PatchComponent wrapper.
Changes:
- Wrap ImageCard and sub-components with PatchComponent
- Extract ImageCardPopovers, ImageCardDetails, ImageCardOverlays,
ImageCardImage as separate patchable components
* Add documentation
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Implement stash_ids_endpoint for the SceneFilterType
* Reduce code duplication by calling the stashIDsCriterionHandler from the stashIDCriterionHandler
* Mark stash_id_endpoint in SceneFilterType, StudioFilterType, and PerformerFilterType as deprecated
When scanning a zip archive duplicate images are being detected as renames rather than duplicates.
This is because in `scanJob.getFileFS` the size of the inner file (`my_archive.zip/001.png`) was being passed to `OpenZip` rather than the size of the zip archive (`my_archive.zip`), causing it to fail when opening the archive. This caused `handleRename` to incorrectly detect it as a rename.
The effects of that are:
- no info on duplicates in the file data
- the file will take the name/path of the final duplicate scanned rather than the first
* SceneCardsGrid plugin API patch
* GalleryCardGrid plugin API patch
* GroupCardGrid plugin API patch
* ImageGridCard plugin API patch
* PerformerCardGrid plugin API patch
* ImageGridCard name corrected
* SceneMarkerCardsGrid plugin API patch
* StudioCardGrid plugin API patch
* TagCardGrid plugin API patch
* GalleryGridCard.tsx renamed to GalleryCardGrid.tsx
* ImageGridCard renamed to ImageCardGrid
* SceneCardsGrid renamed to SceneCardGrid
* SceneMarkerCardsGrid renamed to SceneMarkerCardGrid
* fix(dlna): improve activity tracking accuracy and efficiency
- Remove play duration tracking: DLNA clients buffer aggressively and
don't report playback position, making duration estimates unreliable.
Saving inaccurate values corrupts analytics.
- Combine database transactions: Resume time and view count updates
now happen in a single transaction for atomicity and performance.
- Keep resume time tracking: While imprecise, it provides useful
"continue watching" hints. The cost of being wrong is low (user
just seeks).
* remove elasped time check
Create a new ListGroupData fragment that excludes expensive recursive
count fields (scene_count_all, sub_group_count_all, etc. with depth: -1).
These fields cause 10+ second queries on large databases when loading
the groups list page.
The full GroupData fragment is preserved for detail views where the
recursive counts are needed.
Add check to skip HTTP fetch for non-HTTP URLs in processImageField(),
matching the existing behavior in setPerformerImage() and setStudioImage().
This allows scrapers to return base64 data URIs (e.g.,
`data:image/jpeg;base64,...`) directly without triggering an HTTP fetch
error. Previously, processImageField() would attempt to create an HTTP
request with the data URI as the URL, causing "Could not set image using
URL" warnings.
Wrap the CustomFieldsInput component with PatchComponent to allow
plugins to modify custom field input behavior. This enables plugins
to inject default fields, modify the onChange handler, or customize
the component rendering.
Adds time-based activity tracking for scenes played via DLNA, enabling
play count, play duration, and resume time tracking similar to the
web frontend.
Key features:
- Uses existing 'trackActivity' UI setting (no new config needed)
- Time-based tracking (elapsed session time / video duration)
- 5-minute session timeout to handle aggressive client buffering
- Minimum thresholds before saving (1% watched or 5 seconds)
- Respects minimumPlayPercent setting for play count increment
Implementation:
- New ActivityTracker in internal/dlna/activity.go
- Session management with automatic expiration
- Integration via DLNA service initialization
Limitations:
- Cannot detect actual playback position (only elapsed time)
- Cannot detect seeking or pause state
- Designed for upstream compatibility (no complex dependencies)
* Implement merging of performers
* Make the tag merge UI consistent with other types of merges
* Add merge action in scene menu
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Change link button icon and separate into component
* Add create/link tag dialog
* Add titles to buttons
* Add ability to link existing tags in scrape dialogs
* Move create link dialog
* Allow tags to have multiple stash-ids from the same endpoint
* Remove month/year only formats from ParseDateStringAsTime
* Add precision field to Date and handle parsing year/month-only dates
* Add date precision columns for date columns
* Adjust UI to account for fuzzy dates
* Change queryStruct to use tx.Get instead of queryFunc
Using queryFunc meant that the performance logging was inaccurate due to the query actually being executed during the call to Scan.
* Only add join args if join was added
* Omit joins that are only used for sorting when skipping sorting
Should provide some marginal improvement on systems with a lot of items.
* Make all calls to the database pass context.
This means that long queries can be cancelled by navigating to another page. Previously the query would continue to run, impacting on future queries.
This was originally done for #3304. The ffmpeg code has been redone since and this is no longer necessary. It was also resulting in the scraper and plugin paths being absolute, despite all the others being relative to the provided config path.
Did not find this feature by myself. Had to have a forum discussion to realise this feature exists and is hidden in the advanced settings.
Added hint that this is an advanced setting.
* Revert scene list toolbar to use common filtered list toolbar
* Add unobtrusive sidebar toggle button
* Revert small device sidebar changes
* Minor styling fixes
* add WakeLockSentinel
prevents screen from sleeping ONLY in secure contexts (localhost, https)
closes#2884
* format, add types
* [wake-sentinel] add more releases, comments
release wakelock on dispose and end, call out secure contexts in error message
* Find existing files with case insensitivity if filesystem is case insensitive
* Handle case change in folders
* Optimise to only test file system case sensitivity if the first query found nothing
This limits the overhead to new paths, and adds an extra query for new paths to windows installs
* Refactor scraper post-processing and process related objects consistently
* Refactor image processing
* Scrape related studio fields consistently
* Don't set image on related objects
* Refactor list operation buttons into a single button group
* Refactor ListFilter into FilteredListToolbar and restyle
* Move zoom keybinds out of zoom control
* Use button group for display mode select
* Hide zoom slider on xs devices
Removes the components inside the formikUtils function, which was causing incorrect re-renders.
Adds data-field to renderField instead, which is a far more simple change.
* Use more neutral language for content
* Add sfw mode setting
* Make configuration context mandatory
* Add sfw class when sfw mode active
* Hide nsfw performer fields in sfw mode
* Hide nsfw sort options
* Hide nsfw filter/sort options in sfw mode
* Replace o-count with like counter in sfw mode
* Use sfw label for o-counter filter in sfw mode
* Use likes instead of o-count in sfw mode in other places
* Rename sfw mode to sfw content mode
* Use sfw image for default performers in sfw mode
* Document SFW content mode
* Add SFW mode setting to setup
* Clarify README
* Change wording of sfw mode description
* Handle configuration loading error correctly
* Hide age in performer cards
* Filter out empty alias strings in studio modal create
* Reject empty alias strings in backend
* Remove invalid ValidateAliases call from UpdatePartial
This was calling using the values which are not necessarily the final values.
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Backend support for studio URLs
* FrontEnd addition
* Support URLs in BulkStudioUpdate
* Update tagger modal for URLs
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Add keyboard shortcuts for screenshot generation
- Add 'c c' shortcut to generate screenshot at current time
- Add 'c d' shortcut to generate default screenshot
- Update keyboard shortcuts documentation
* Add external links display option for performer thumbnails
- Introduced a new setting to show links on performer thumbnails.
- Updated PerformerCard to conditionally render social media links (Twitter, Instagram) and other external links.
- Enhanced ExternalLinksButton to open single links directly if specified.
- Updated configuration and localization files to support the new feature.
* Remember the selected stash box in scene tagger
This stores the selected stash box in the config, the same way that
studio and performer tagger do (it uses the same setting).
If a non-stashbox source (scraper) is selected, this is not remembered.
* Save sidebar section open state in browser history state
This means that state is saved when going back, but not when navigating to the scenes page from elsewhere.
* Add saved filter button to toolbar
* Rearrange and add portal target
* Only overlap sidebar on sm viewports
* Hide dropdown button on smaller viewports when sidebar open
* Center operations during selection
* Restyle results header
* Add classname for sidebar pane content
* Move sidebar toggle to left during scene selection
If the backup directory is not the same directory as the database, then vacuum into the same directory then move it to its destination. This is to prevent issues vacuuming over a network share.
* refactored `Interactive` class to allow more HapticDevice devices
* simplified api hooks
* update creation of `interactive` to pass `stashConfig`
* updated UIPluginApi to mention `PluginApi.InteractiveUtils`
* Move sidebar toggle to right. Change icon
* Show sidebar button on selection
* Fix clicking toggle cycling visibility on smaller views
* Show more tags component when cutoff == 0
* Hide filter/filter icon buttons in certain situations
* Move sidebar toggle to left on xl viewports
* Add search term to filter tags on scene list page
Clicking on the tag selects all on the search term input. Clicking on the x erases it.
* Ensure clear criteria maintains consistent behaviour on other pages
* Hide search term tag when input is visible
* Add load/save buttons to edit filter dialog
* Add title to save filter dialog
* Change ExistingSavedFilterList parameters
* Add title to load/save buttons
* Show zoom slider when wall view active
* Add zoom functionality to scene wall
* Add zoom functionality to image wall
* Add zoom functionality to gallery wall
* Add zoom functionality for marker wall
* Add search term to filter tags on scene list page
Clicking on the tag selects all on the search term input. Clicking on the x erases it.
* Ensure clear criteria maintains consistent behaviour on other pages
* Add filter tags to toolbar
* Show overflow control if filter tags overflow
* Remove second set of filter tags from top of page
* Add border around filter area
* Add sticky query toolbar to scenes page
* Filter button accept count instead of filter
* Add play button
* Add create button functionality. Remove new scene button from navbar
* Separate toolbar into component
* Separate sort by select component
* Don't show filter tags control if no criteria
* Add utility setter methods to ListFilterModel
* Add results header with display options
* Use css for filter tag styling
* Add className to OperationDropdown and Item
* Increase size of sidebar controls on mobile
* Add findFile and findFiles
* Add parent folder and zip file fields to file graphql types
* Add parent_folder, zip_file fields to Folder graphql type
* Add format to ImageFile type
* Add format filter fields to image/video file filters
* Adjust main padding to be the same as navbar height
* Add LoadedContent component for loading and error display
* Add option for pagination popup placement
* Show results summary at top only. Add sticky bottom pagination
* Separate ZoomSlider into own component
* Turn ListViewOptions into dropdown
Also puts zoom slider in the dropdown
* Move ZoomSlider into separate file
* Add title
* Restyle slider
* Improve error messages when unable to contact server
* Improve error message presentation
* Catch errors when configuration can't be loaded
* Use ErrorMessage in PagedList
* Add icon to error message
The code looks like it does because it initially used string pointers; however, the version that landed used a regular string array, so we can just the = operator.
* Use gallery for scene wall
* Move into separate file
* Remove unnecessary class names
* Apply configuration
* Reuse styling
* Add Scene Marker wall panel
* Adjust target row height
* Use StashIDPill to show stash IDs in the tagger view
This is visually nicer, but more importantly, lets you see easily which stash-boxes are already associated with this scene.
* Move into separate component. Add key
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Remove accidental copypaste error
The apiKey ref was accidentally associated with the max_requests_per_minute field which made the "Test Credentials" button error out every time
* Fix error messages in stash-box validation
The message from err.Error() can start with any number of errors like NetworkError
so we can check for substrings instead
* Sort tags by name while scraping scenes
* TagStore.All should sort by sort_name first
* Sort tag by sort name/name in TagIDSelect
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Add fields to useListSelect
* Add more utility hooks
* Remove context from FilteredListToolbar
* Refactor SceneList to not use ItemList
* Move common logic into useFilteredListHook
* Move stashbox package under pkg
* Remove StashBox from method names
* Add fingerprint conversion methods to Fingerprint
Refactor Fingerprints methods
* Make FindSceneByFingerprints accept fingerprints not scene ids
* Refactor SubmitSceneDraft to not require readers
* Have SubmitFingerprints accept scenes
Remove SceneReader dependency
* Move ScrapedScene to models package
* Move ScrapedImage into models package
* Move ScrapedGallery into models package
* Move Scene relationship matching out of stashbox package
This is now expected to be done in the client code
* Remove TagFinder dependency from stashbox.Client
* Make stashbox scene find full hierarchy of studios
* Move studio resolution into separate method
* Move studio matching out of stashbox package
This is now client code responsibility
* Move performer matching out of FindPerformerByID and FindPerformerByName
* Refactor performer querying logic and remove unused stashbox models
Renames FindStashBoxPerformersByPerformerNames to QueryPerformers and accepts names instead of performer ids
* Refactor SubmitPerformerDraft to not load relationships
This will be the responsibility of the calling code
* Remove repository references
* Add hook for grid card width calculation
* Move card width calculation into grid instead of card
Now calculates once instead of per card
* Debounce resize observer
* Indicate while backing up database
* Close migrate connection to db before optimising
* Don't vacuum post-migration
In most cases is probably not needed and can be an optonal user-initiated step
* Ensure connection close on NewMigrator error
* Perform post-migration using migrator connection
Flush WAL file at end of migration
- use docker compose instead of deprecated docker-compose
- add note for package as docker-cli-compose
- add link for reverse proxy
- remove obselete version string
Co-authored-by: feederbox826 <feederbox826@users.noreply.github.com>
* Add ReactSelect to PluginApi.libraries
* Make Performer tabs patchable
* Make PerformerCard patchable
* Use registration pattern for HoverPopover, TagLink and LoadingIndicator
Initialising the components map to include these was causing an initialisation error.
* Add showZero property to PopoverCountButton
* Make TagCard patchable
* Make ScenePage and ScenePlayer patchable
* Pass properties to container components
* Add example for scene tabs
* Make FrontPage patchable
* Add FrontPage example
* Change wording of performer age at production
The Performer card had "x years old in this scene", regardless of what sort of media it was attached to. I have made both strings "x [years old] at production instead.
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Use playing event instead of play
* Remove unnecessary ensurePlaying() from timeupdate listener
Eliminates redundant API calls by only relying on playing and pause events. Handles edge cases for playback before script upload completion.
* Remove unnecessary video seeking event listener
We don't need it anymore, listening for playing and pause events is enough.
* Send second play event after a play event to adjust for video player issues
* Fix script being paused and played after 10 seconds because of activity tracker dependency change
* Update KeyboardShortcuts.md
- Added table of shortcuts for Image page
- Reorganized a few tables to include sub-headings
- Renamed `Edit Scene tab [...]` heading to `Scene Edit tab [...]` for logical consistency with other headings
- Moved Scene page rating shortcuts from vestigial location in *Edit Scene* section to global Scene page section
* Update edit header to be consitant with the others
---------
Co-authored-by: DogmaDragon <103123951+DogmaDragon@users.noreply.github.com>
* Move tag exclusion code back into scraper package
Reverts #2391
* Rearrange stash box client code
* Filter excluded tags in stashbox queries
Re-application of fix for #2379
* UI: Manifest changes and new square SVG to be used by PWA's
* UI: Fix manifest to include smaller sizes
* Make a maskable icon with a background so it can be seen on most platforms
* UI: Anti-Flashbang
Make the background colour the same as the background as stash
* override "name" sort with COALESCE
* tag sort_name frontend
adds `data-sort-name` attribute to tag links prioritizes sort_name value but will default to tag name if not present in the same way that COALESCE will prioritize the same values in the same way
* add sort_name filter, update locale per request
* Include sort name in anonymiser
* Add import/export support
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* generate marker previews using endSeconds value
* Limit marker preview duration to 20 seconds max
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Update Tasks.md
Denoted which task items are only accessible in advanced mode.
* Add note to transcodes
---------
Co-authored-by: DogmaDragon <103123951+DogmaDragon@users.noreply.github.com>
* Backend changes
* Show custom field values
* Add custom fields table input
* Add custom field filtering
* Add unit tests
* Include custom fields in import/export
* Anonymise performer custom fields
* Move json.Number handler functions to api
* Handle json.Number conversion in api
* Markers can have end time
Other metadata sources such as ThePornDB and timestamp.trade support end times for markers but Stash did not yet support saving those. This is a first step which only allows end time to be set either via API or via UI. Other aspects of Stash such as video player timeline are not yet updated to take end time into account.
- User can set end time when creating or editing markers in the UI or in the API.
- End time cannot be before start time. This is validated in the backend and for better UX also in the frontend.
- End time is shown in scene details view or markers wall view if present.
- GraphQL API does not require end_seconds.
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Add updated_at field to stash_id's
* Only set updated at on stash ids when actually updating in identify
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Upgrade gqlgenc and regenerate stash-box client
* Fix go version
* Don't generate resolvers
* Bump go version in compiler image. Bump freebsd version
* Update Scenes' 'Updated At' Date on Heatmap Gen & Expand Error Log
The UpdatedAt field of a scene is now correctly updated after Generate Task is run and a heatmap linked to a scene.. I thought it made more sense here in the generate heatmap compared to scan.go, owing to funscript data not being tracked/stored in a typical sense with the scan message "updating metadata".
I used a simplified error messaging as I did not think it was critcal but I do not know if did not use the correct code structure
If updating the UpdatedAt field should be done there when the file is marked as interactive I can try and do that?
This would fix this long-standing issue https://github.com/stashapp/stash/issues/3738
The error message change is useful as I could not tell which scripts were causing errors before but now it is clear in the logs
* Use single transaction
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* flippable images in expanded view
* adjust table title width
* cleanup
* eliminate bounce and other improvements
* expand support to non full-width option
* Don't play video when seeking non-started video
* Set initial time on load instead of play
* Continue playing from current position when switching sources on error
* Remove unnecessary ref
* Don't log context canceled error during live transcode
* Pause live transcode if still scrubbing
* Debounce loading live transcode source to avoid multiple ffmpeg instances
* Don't start from start or resume time if seeking before playing
* Play video when seeked before playing
* Move optimise out of RunAllMigrations
* Separate read and write database connections
* Enforce readonly connection constraint
* Fix migrations not using tx
* #5155 - allow setting cache size from environment
* Document new environment variable
Per convo with people on Discord. I have updated the Reload Scrapers UI. It now adds a button if the filter box appears and then the button extends and takes up the whole space if the filter box does not exist.
---------
Co-authored-by: CJ <tedabed@gmail.com>
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
I think was was happening is the browser was trying to do too much at once (Rendering the popup and focusing the input simultaneously). I believe it was triggering a reflow and setting the site back to default aka: back to the top.
I set the timeout to 0 which moves the execution to the next loop event. It gives the browser time to do one and then the other, not both at the same time.
I moved `onKeyPress` to `onKeyDown` due to the former being depreciated.
* Fix Tag and Alias odd spacing
As Echo6ix brough up the HTML Engine doesn't generate whitespace at the beginning of a string. Modifying it to use ` ` so that the spacing will be correct.
fixes https://github.com/stashapp/stash/issues/4997
* update for performerSelect and studioSelect
* Add default gallery image
* Add gallery cover URL path
* Use new cover URL in UI
* Hide gallery preview scrubber when gallery has no images
* Don't try to show lightbox for gallery without images
* Ignore unrelated lint issue
* Add UI support for setting containing groups
* Show containing groups in group details panel
* Move tag hierarchical filter code into separate type
* Add depth to scene_count and add sub_group_count
* Add sub-groups tab to groups page
* Add containing groups to edit groups dialog
* Show containing group description in sub-group view
* Show group scene number in group scenes view
* Add ability to drag move grid cards
* Add sub group order option
* Add reorder sub-groups interface
* Separate page size selector component
* Add interfaces to add and remove sub-groups to a group
* Separate MultiSet components
* Allow setting description while setting containing groups
* Show controls before video plays
* Allow interaction with controls while displaying error
* Source selector improvements
Don't auto-play next source if manually selected.
Don't remove errored sources
* Show errored sources in different style
* Support multiple calls to PluginApi.patch.instead for a component.
Allow calling the original/chained function from the hook function.
* Add example of new usage of instead
* Update documentation
* Fix filter reading from URL when not active
* Use alternative clone mechanism. Fixes weird filter hook behaviour
* Separate search term input component
* Refactor list filter to use contexts
* Refactor FilteredListToolbar
* Move components into separate files
* Convert ItemList hook into components
* Fix criteria clone functions
* Add toggle for sub-studio content
* Add toggle for sub-tag content
* Make LoadingIndicator height smaller and fade in.
* Copy apikey query parameter to DASH & HLS manifest
When an API key is provided to the DASH and HLS manifest endpoints, this
it will now be copied to the URLs inside the manifest. This allows for
clients that are only able to pass an URL to an (external) video player
to function in case authentication is set up on stash.
* Refactor repeated code into BackgroundImage
* Move BackgroundImage into Details folder
* Refactor performer tabs
* Refactor studio tabs
* Refactor tag tabs
* Refactor repeated code into DetailTitle
* Refactor repeated collapse button code into component
* Reuse FavoriteIcon in details pages
* Refactor performer urls into component
* Refactor alias list into component
* Refactor repeated image code into HeaderImage and LightboxLink components
* Replace render functions with inline conditional rendering
* Support new twitter hostname
* Rename Movie and MoviePartial to Group/GroupPartial
* Rename Movie interfaces
* Update movie url builders to use group
* Rename movieRoutes to groupRoutes
* Update dataloader
* Update names in sqlite package
* Rename in resolvers
* Add GroupByURL to scraper config
* Scraper backward compatibility hacks
* Refactor scraping settings panel
* Add max-height to scraper table
* Separate scraper section
* Add filter to scrapers section
* Add counters to scraper headings
* Show all urls with a scrollbar
* Sort URLs
* Move scene scraper menu into reusable component
* Reuse ScraperMenu for scene query menu
* Reuse scraper menu in GalleryEditPanel
* Add filter to scraper menu
* Add divider between stashboxes and scrapers
* Replace movies with groups in the UI
* Massage menu items
* Change view names
* Rename Movie components to Group
* Refactor movie to group variable names
* Rename movie class names to group
I think not including the scene_id meant that a date could be corrected earlier, meaning the rows affected would be 0. Adding scene_id means that each row should be migrated one by one.
* Fixes format in full hw encoding to nv12 for cuda, vaapi and qsv now
* Remove extra_hw_frames
* Add apple transcoder support
* Up the duration to discover decoding errors
* yuv420p is not supported on intel
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Fix makeTagFilter mode
* Remove studio_tags filter criterion
This is handled by studios_filter. The support for this still needs to be added in the UI, so I have removed the criterion options in the short-term.
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Make pagination more compact
Support entering page number or clicking from drop down
* Fix border radius in dropdown in btn group
* Separate page count control
* Move filter criterion handlers into separate file
* Add related filters for image filter
* Add related filters for scene filter
* Add related filters to gallery filter
* Add related filters to movie filter
* Add related filters to performer filter
* Add related filters to studio filter
* Add related filters to tag filter
* Add scene filter to scene marker filter
* Update to Go 1.22
Updates to Go 1.22 because 1.19 is un-supported and has some CVEs.
Also updates a small number of low-risk deps
* Explicitly install Go in CI
* Bump compiler version
* Add build tags to it target
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Fix return types for RegisterComponent and PatchFunction
* Add support for patching TagSelect.sort
* Add support for patching PerformerSelect.sort
* Patch other select component sort functions
* Document patchable functions/components
* Add scene detail header
* Make common count button and add view count
* Add titles to play count and o count buttons
* Move rating from edit panel
* Include frame rate in header
* Remove redundant title/studio
* Improve numeric rating presentation
* Add star where there is no rating header
* Set rating on blur when click to edit
* Add star to numeric rating on gallery wall card
* Apply click to rate on movie page
* Apply click to rate to performer page
* Apply click to rate to studio page
* Fix rating number presentation on list tables
* Add data-value attributes
* Make ffmpeg/ffprobe settable and remove auto download
* Detect when ffmpeg not present in setup
* Add download ffmpeg task
* Add download ffmpeg button in system settings
* Download ffmpeg during setup
* Sort Performers by Last O / View
Added 2 New Sorts 'Last O At' and 'Last Played At' for Performers
* Filter Performers by Play Count
Was not sure whether to label this 'views' as the code does, or 'plays' but chose the latter as it gives parity across the scenes and performers filters.
* Sort Performers by Play Count
Reutilised the prior selectPerformerLastOAtSQL code that was used to filter by play count to additionally provide useful sorting options.
* Replaced O-Counter with O Count
To better match other sort and filter options like Gallery Count, Image Count, Play Count, Scene Count, Tag Count, File Count, Performer Count and Play Count, we should really use O Count rather than O-Counter for increased legibility and coherence.
* Title Case on 'Interactive speed' and correct capitalization for 'phash'
Every other filter/sort option is using Title Case other than 'Interactive speed' which stands out as incorrect. Also, fixing the correct mid-word capitalization on phash to pHash.
* Formatting
Formatted source code and Ran all tests
* Support setting nested UI values
* Accept partial for configureUI
* Send partial UI
* Save scan, generate and auto-tag options on change
* Send partials in saveUI
* Save library task options on change
* Update StashDB details in README.md
- Directs users to new guide in the StashDB docs instead of Discord
- No longer necessary to join Discord/Matrix for new users of StashDB now that invite codes are multi-use
- Updates formatting of the same "Quickstart Guide" section a little
* Expands quickstart language based on DogmaDragon's suggestions
* Accept plain map for runPluginTask
* Support running plugin task without task name
* Add interface to run plugin operations
* Update RunPluginTask client mutation
* Add ids to findMovies input
* Use ids for other find interfaces
* Update client side
* Fix gallery select function
* Replace movie select
* Re-add creatable
* Overhaul movie table
* Remove and deprecated unused code
* Change default toast placement
* Position at bottom on mobile
* Show single toast message at a time
* Optionally show dialog for error messages
* Fix circular dependency
* Animate toast
* Add interface to load tags by id
* Use minimal data for tag select queries
* Center image/text in select list
* Overhaul tag select
* Support excludeIds. Comment out image in dropdown
* Replace existing selects
* Remove unused code
* Fix styling of aliases
* Add Plugins Path setting
* Fix/improve cache invalidation
* Hide load error when collapsing package source
* Package manager style tweaks
* Show error if installed packages query failed
* Prevent "No packages found" flicker
* Show <unknown> if empty version
* Always show latest version, highlight if new version available
* Fix issues with non-unique cross-source package ids
* Don't wrap id, version and date
* Decrease collapse button padding
* Display description for scraper packages
* Fix default packages population
* Change default package path to community
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Set PYTHONPATH environment variable for Python script scrapers
* Convert PYTHONPATH to absolute
* Generalise and apply to plugins
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Update vrmode.ts
Enabling the most common VR projection (180_LR) and an older but no longer used one (360_TB) in the UI.
* Downgrade videojs-vr
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Added Studio Code and Photographer to Galleries
* Fix gallery display on mobile
* Fixed potential panic when scraping with a bad configuration
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Log more when resolving Python
Users often have problems configuring their Python installations
* Convert if-else ladder to switch statement
* Consolidate Python resolution
Adds additional logging to plugin tasks to
align with the logging that scrapers output.
* Add assets for plugins
* Move plugin javascript and css into separate endpoints
* Allow loading external scripts
* Add csp overrides
* Only include enabled plugins
* Move URLMap to utils
* Use URLMap for assets
* Add documentation
* Fix macOS notifications
* Change CFBundleIdentifier to match domain
* Distribute Stash.app
* Also build universal phasher binary
* Fix binary name in check_version.go
* Expose GOOS, working dir and home dir in systemStatus endpoint
* Disable setup in working directory when running Stash.app
* More Makefile improvements, remove unused scripts
* Improve READMEs and documentation
* Update a number of dependencies (incl. CVE fixes)
Includes some dependencies that were upgraded in #4106 as well as a few more dependencies.
Some deps that have been upgraded had CVEs.
Notably, upgrades deprecated dependencies such as:
- `github.com/go-chi/chi` (replaced with `/v5`)
- `github.com/gofrs/uuid` (replaced with `/v5`)
- `github.com/hashicorp/golang-lru` (replaced with `/v2` which uses generics)
* Upgraded a few more deps
* lint
* reverted yaml library to v2
* remove unnecessary mod replace
* Update chromedp
Fixes#3733
* Update Lightbox.tsx to also change default delay here to 5 sec instead of 5000
* Update config.go to set default slideshow delay from 5000 sec to 5 sec
Testing indicated that the arm-linux-gnueabihf-gcc compiler was emitting a binary that used thumb2 directives that are illegal on raspberry pi. Using the arm-linux-gnueabi-gcc compiler appears to fix the issue. Added march directive to target v7.
* Fix false positive mismatch in Movie Scrape dialog
Scraping a movie by URL would show a difference in duration because the
persisted value of duration was converted to HH:MM:SS while the newly
scraped value was displayed without formatting: this makes sense because
the newly scraped value is just a string and so could be anything
This adds a check to see if the string is a number and converts it to
HH:MM:SS format if possible
* Fallback to original value if not a number
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Exclude value for is null/not null
Also includes changes to the error message in the migration to include the filter string.
* Ignore null when setting from encoded criterion
* UI Update to show which file is being deleted
Added Selection dropwdown
Added checkbox to ensure that the codecs are the same within the group
* Refactor size options
* Convert select box to dropdown
* Internationalisation
---------
Co-authored-by: Steve Enderby <vpn-enderbys@capitatflpp.onmicrosoft.com>
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Add mockery config file
* Move basic file/folder structs to models
* Fix hack due to import loop
* Move file interfaces to models
* Move folder interfaces to models
* Move scene interfaces to models
* Move scene marker interfaces to models
* Move image interfaces to models
* Move gallery interfaces to models
* Move gallery chapter interfaces to models
* Move studio interfaces to models
* Move movie interfaces to models
* Move performer interfaces to models
* Move tag interfaces to models
* Move autotag interfaces to models
* Regenerate mocks
* yarn add videojs-abloop
* add abLoop plugin to video player
* adding player keyboard shortcut 'l' for toggling a/b looping
copies mpv behavior:
if a/b loop start not yet set, sets start to current player time
elif a/b loop stop not yet set, sets end to current player time and enables loop
else, disables a/b loop
relates to #3264 (https://github.com/stashapp/stash/issues/3264)
* update help with keyboard shortcut
* Add plugin type definitions
* Make UI elements optional
---------
Co-authored-by: chickenwingavalanche <chickenwingavalanche@example.com>
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Move loadStickyHeader to src/hooks
* intl stashIDs
* Scroll to top on component mount
* Add id to gallery cover image and tweak merge functions
* Add useTitleProps hook
* Also scroll to top on list pages
* Refactor loaders and tabs
* Use classnames
* Add DetailImage
* mobile improvements to performer page
* updated remaining details pages
* fixes tag page on mobile
* implemented show hide for performer details
* fixes card width cutoff on mobile(not related to redesign)
* added background image option plus more improvements
* add tooltip for age field
* translate encoding message string
* Studio image and parent studio support in scene tagger
* Refactor studio backend and add studio tagger
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Fix scene marker NOT NULL constraint error
* similar changes to gallery chapters
* Fix NULL conversion error if names are NULL in DB
* Fix scene marker form resetting
* Add URLs scene relationship
* Update unit tests
* Update scene edit and details pages
* Update scrapers to use urls
* Post-process scenes during query scrape
* Update UI for URLs
* Change urls label
* Add `-v/--version` flag to print version string
- Created a new flag `-v/--version` in the command-line interface to display the version number and exit.
- Moved all version-related functions inside the config package to the new file `manager/config/version.go` to avoid circular dependencies.
- Added a new `GetVersionString()` function to generate a formatted version string.
- Updated references to the moved version functions.
- Updated references in the `Makefile`.
* Move version embeds to build package
* Remove githash var
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* add phasher
A simple `phasher` program that accepts a video file as a command line
argument and calculates and prints its PHASH.
The goal of this separate executable is to have a simple way to
calculate phashes that doesn't depend on a full stash instance so that
third-party systems and tools can independently generate PHASHes which
can be used for interacting with stash and stash-box APIs and data.
Currently `phasher` is built in the default make target along with
`stash` by simply running `make`.
Cross-platform targets have not been considered.
Concurrency is intentionally not implemented because it is simpler to
use [GNU Parallel](https://www.gnu.org/software/parallel/).
For example:
```
parallel phasher {} ::: *.mp4
```
* standard dir structure for phasher and separate make target
The make target still needs to be integrated into the rest of the
Makefile so it can be built as part of normal releases.
* phasher: basic usage output and quiet option
* phasher: allow and process multiple command line arguments
* phasher: camelCase identifiers
* phasher: initialize ffmpeg and ffprobe only once
* Update text.ts
Displayed resolutions in Stash were confusing as hell when it came to VR files - which are typically 2:1. Now I understand why, it's assuming 16:9 files/looking at height only.
* Remove ID from PerformerPartial
* Separate studio model from sqlite model
* Separate movie model from sqlite model
* Separate tag model from sqlite model
* Separate saved filter model from sqlite model
* Separate scene marker model from sqlite model
* Separate gallery chapter model from sqlite model
* Move ErrNoRows checks into sqlite, improve empty result error messages
* Move SQLiteDate and SQLiteTimestamp to sqlite
* Use changesetTranslator everywhere, refactor for consistency
* Make PerformerStore.DestroyImage private
* Fix rating on movie create
description:Create a report to help us fix the bug
labels:["bug report"]
body:
- type:markdown
attributes:
value:Thanks for taking the time to fill out this bug report! Make sure to read [Contributing](https://github.com/stashapp/stash/blob/develop/docs/CONTRIBUTING.md) document before submitting.
- type:checkboxes
id:confirm-troubleshooting
attributes:
label:Have you enabled troubleshooting mode?
description:|
To ensure the bug is not caused by custom modifications or plugins make sure to enable troubleshooting mode before filing the report. In Stash go to Settings and click **Troubleshooting mode** and then retest to see if the bug still occurs.
It's important to note that troubleshooting mode only affects UI modifications and plugins.
options:
- label:I confirm that the troubleshooting mode is enabled.
required:true
- type:textarea
id:description
attributes:
label:Describe the bug
description:Provide a clear and concise description of what the bug is.
validations:
required:true
- type:textarea
id:reproduction
attributes:
label:Steps to reproduce
description:Detail the steps that would replicate this issue.
placeholder:|
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
validations:
required:true
- type:textarea
id:expected
attributes:
label:Expected behaviour
description:Provide clear and concise description of what you expected to happen.
validations:
required:true
- type:textarea
id:context
attributes:
label:Screenshots or additional context
description:Provide any additional context and SFW screenshots here to help us solve this issue.
validations:
required:false
- type:input
id:stashversion
attributes:
label:Stash version
description:This can be found in Settings > About.
placeholder:(e.g. v0.28.1)
validations:
required:true
- type:textarea
id:devicedetails
attributes:
label:Device details
description:|
Please provide details about the device you are using, including the operating system and browser (if applicable).
placeholder:Firefox 97 (64-bit) on Windows 11
validations:
required:false
- type:textarea
id:logs
attributes:
label:Relevant log output
description:Please copy and paste any relevant log output from Settings > Logs. This will be automatically formatted into code, so no need for backticks.
about: This is for issues that will be discussed and won't necessarily result directly
in commits or pull requests.
title: "[RFC] Short Form Title"
labels: help wanted
assignees: ''
---
<!-- Update or delete the title if you need to delegate your title gore to something
# Title
*### Scope*
<!-- describe the scope of your topic and your goals ideally within a single paragraph or TL;DR kind of summary so its easier for people to determine if they can contribute at a glance. -->
## Long Form
<!-- Only required if your scope and titles can't cover everything. -->
## Examples
<!-- if you can show a picture or video examples post them here, please ensure that you respect people's time and attention and understand that people are volunteering their time, so concision is ideal and considerate. -->
## Reference Reading
<!-- if there is any reference reading or documentation, please refer to it here. -->
description:Request a new feature or idea to be added to Stash
labels:["feature request"]
body:
- type:markdown
attributes:
value:Thank you for taking the time to submit a feature request! Make sure to read [Contributing](https://github.com/stashapp/stash/blob/develop/docs/CONTRIBUTING.md) document before submitting.
- type:textarea
id:description
attributes:
label:Describe the feature you'd like
description:Provide a clear description of the feature you'd like implemented
validations:
required:true
- type:textarea
id:benefits
attributes:
label:Describe the benefits this would bring to existing users
description:|
Explain the measurable benefits this feature would achieve for existing users.
The benefits should be described in terms of outcomes for users, not specific implementations.
validations:
required:true
- type:textarea
id:already_possible
attributes:
label:Is there an existing way to achieve this goal?
description:|
Yes/No. If Yes, describe how your proposed feature differs from or improves upon the current method
validations:
required:true
- type:checkboxes
id:confirm-search
attributes:
label:Have you searched for an existing open/closed issue?
description:|
To help us keep these issues under control, please ensure you have first [searched our issue list](https://github.com/stashapp/stash/issues?q=is%3Aissue) for any existing issues that cover the core request or benefit of your proposal.
options:
- label:I have searched for existing issues and none cover the core request of my proposal
required:true
- type:textarea
id:context
attributes:
label:Additional context
description:Add any other context or screenshots about the feature request here.
title: "[Bug Fix] Short Form Title (50 chars or less.)"
labels: bug
assignees: 'WithoutPants, bnkai, Leopere'
---
<!-- Please make sure to read https://github.com/stashapp/stash/docs/CONTRIBUTING.md and check that you understand and have followed it as best as possible -->
<!-- Explain what your bugfix seeks to remedy in a short paragraph. -->
# Scope
<!-- Declare any issues by typing `fixes #1` or `closes #1` for example so that the automation can kick in when this is merged -->
## Closes/Fixes Issues
<!-- What have you tested specifically and what possible impacts/areas there are that may need retesting by others. -->
title: "[Feature] Short Form Title (50 chars or less.)"
labels: enhancement
assignees: 'WithoutPants, bnkai, Leopere'
---
<!-- Please make sure to read https://github.com/stashapp/stash/docs/CONTRIBUTING.md and check that you understand and have followed it as best as possible
Explain what your feature does in a short paragraph. -->
# Scope
<!-- Declare any issues by typing `fixes #1` or `closes #1` for example so that the automation can kick in when this is merged -->
## Closes/Fixes Issues
<!-- What have you tested specifically and what possible impacts/areas there are that may need retesting by others. -->
[](https://github.com/stashapp/stash/releases/latest)
### **Stash is a self-hosted webapp written in Go which organizes and serves your porn.**

<h3>Stash is a self-hosted webapp written in Go which organizes and serves your diverse content collection, catering to both your SFW and NSFW needs.</h3>
* Stash gathers information about videos in your collection from the internet, and is extensible through the use of community-built plugins for a large number of content producers and sites.
* Stash supports a wide variety of both video and image formats.
*You can tag videos and find them later.
* Stash provides statistics about performers, tags, studios and more.

-Stash gathers information about videos in your collection from the internet, and is extensible through the use of community-built plugins for a large number of content producers and sites.
- Stash supports a wide variety of both video and image formats.
- You can tag videos and find them later.
- Stash provides statistics about performers, tags, studios and more.
You can [watch a SFW demo video](https://vimeo.com/545323354) to see it in action.
For further information you can [read the in-app manual](ui/v2.5/src/docs/en).
For further information see [Support & Resources](#support--resources) section.
Running the app might present a security prompt since the binary isn't yet signed. Bypass this by clicking "more info" and then the "run anyway" button.
#### FFMPEG
Stash requires ffmpeg. If you don't have it installed, Stash will download a copy for you. It is recommended that Linux users install `ffmpeg` from their distro's package manager.
Download links for other platforms and architectures are available on the [Releases](https://github.com/stashapp/stash/releases) page.
# Usage
### First Run
## Quickstart Guide
Stash is a web-based application. Once the application is running, the interface is available (by default) from http://localhost:9999.
#### Windows/macOS Users: Security Prompt
On Windows or macOS, running the app might present a security prompt since the application binary isn't yet signed.
- On Windows, bypass this by clicking "more info" and then the "run anyway" button.
- On macOS, Control+Click the app, click "Open", and then "Open" again.
#### ffmpeg
Stash requires FFmpeg. If you don't have it installed, Stash will prompt you to download a copy during setup. It is recommended that Linux users install `ffmpeg` from their distro's package manager.
## Usage
### Quickstart Guide
Stash is a web-based application. Once the application is running, the interface is available (by default) from `http://localhost:9999`.
On first run, Stash will prompt you for some configuration options and media directories to index, called "Scanning" in Stash. After scanning, your media will be available for browsing, curating, editing, and tagging.
Stash can pull metadata (performers, tags, descriptions, studios, and more) directly from many sites through the use of [scrapers](https://github.com/stashapp/stash/tree/develop/ui/v2.5/src/docs/en/Scraping.md), which integrate directly into Stash.
Many community-maintained scrapers are available for download from [CommunityScrapers repository](https://github.com/stashapp/CommunityScrapers). The community also maintains StashDB, a crowd-sourced repository of scene, studio, and performer information, that can automatically identify much of a typical media collection. Inquire in the Discord for details. Identifying an entire collection will typically require a mix of multiple sources.
Stash can pull metadata (performers, tags, descriptions, studios, and more) directly from many sites through the use of [scrapers](https://github.com/stashapp/stash/blob/develop/ui/v2.5/src/docs/en/Manual/Scraping.md), which integrate directly into Stash. Identifying an entire collection will typically require a mix of multiple sources:
- The stashapp team maintains [StashDB](https://stashdb.org/), a crowd-sourced repository of scene, studio, and performer information. Connecting it to Stash will allow you to automatically identify much of a typical media collection. It runs on our stash-box software and is primarily focused on mainstream digital scenes and studios. Instructions, invite codes, and more can be found in this guide to [Accessing StashDB](https://guidelines.stashdb.org/docs/faq_getting-started/stashdb/accessing-stashdb/).
- Several community-managed stash-box databases can also be connected to Stash in a similar manner. Each one serves a slightly different niche and follows their own methodology. A rundown of each stash-box, their differences, and the information you need to sign up can be found in the [Metadata Sources](https://docs.stashapp.cc/metadata-sources/stash-box-instances/) section of the documentation.
- Many community-maintained scrapers can also be downloaded, installed, and updated from within Stash, allowing you to pull data from a wide range of other websites and databases. They can be found by navigating to `Settings → Metadata Providers → Available Scrapers → Community (stable)`. These can be trickier to use than a stash-box because every scraper works a little differently. For more information, please visit the [CommunityScrapers repository](https://github.com/stashapp/CommunityScrapers).
- All of the above methods of scraping data into Stash are also covered in more detail in our [Guide to Scraping](https://docs.stashapp.cc/beginner-guides/guide-to-scraping/).
<sub>[StashDB](http://stashdb.org) is the canonical instance of our open source metadata API, [stash-box](https://github.com/stashapp/stash-box).</sub>
Stash is available in 25 languages (so far!) and it could be in your language too. If you want to help us translate Stash into your language, you can make an accountat [translate.stashapp.cc](https://translate.stashapp.cc/projects/stash/stash-desktop-client/) to get started contributing new languages or improving existing ones. Thanks!
Need help or want to get involved? Start with the documentation, then reach out to the community if you need further assistance.
# Support (FAQ)
### Documentation
Check out our documentation on [Stash-Docs](https://docs.stashapp.cc) for information about the software, questions, guides, add-ons and more.
- [Official documentation](https://docs.stashapp.cc) - official guides guides and troubleshooting.
- [In-app manual](https://docs.stashapp.cc/in-app-manual) press <kbd>Shift</kbd> + <kbd>?</kbd> in the app or view the manual online.
- [FAQ](https://discourse.stashapp.cc/c/support/faq/28) - common questions and answers.
- [Community wiki](https://discourse.stashapp.cc/tags/c/community-wiki/22/stash) - guides, how-to’s and tips.
### Community & Discussion
For more help you can:
* Check the in-app documentation, in the top right corner of the app (it's also mirrored on [Stash-Docs](https://docs.stashapp.cc/in-app-manual))
*Join the [Matrix space](https://matrix.to/#/#stashapp:unredacted.org)
*Join the [Discord server](https://discord.gg/2TsNFKt), where the community can offer support.
* Start a [discussion on GitHub](https://github.com/stashapp/stash/discussions)
- [Community forum](https://discourse.stashapp.cc) - community support, feature requests and discussions.
- [Discord](https://discord.gg/2TsNFKt) - real-time chat and community support.
-[GitHub discussions](https://github.com/stashapp/stash/discussions) - community support and feature discussions.
-[Lemmy community](https://discuss.online/c/stashapp) - board-style community space.
# Customization
### Community Scrapers & Plugins
## Themes and CSS Customization
There is a [directory of community-created themes](https://docs.stashapp.cc/user-interface-ui/themes) on Stash-Docs, along with instructions on how to install them.
You can also change the Stash interface to fit your desired style with various snippets from [Custom CSS snippets](https://docs.stashapp.cc/user-interface-ui/custom-css-snippets).
## Architecture
# For Developers
You can find an overview of Stash's architecture in the [ARCHITECTURE.md](docs/ARCHITECTURE.md) document.
Pull requests are welcome!
## Contributing
See [Development](docs/DEVELOPMENT.md) and [Contributing](docs/CONTRIBUTING.md) for information on working with the codebase, getting a local development setup, and contributing changes.
We welcome contributions and help from all humans who want to improve the project.
Before contributing, please read the [Contributing](docs/CONTRIBUTING.md) document to understand our guidelines and processes for contributing to the project.
You can learn about setting up a local development environment in the [Development](docs/DEVELOPMENT.md) document.
## Translation
The widget below shows the current translation status of Stash across all supported languages. If you want to help us translate Stash, you can make an account at [Codeberg Translate](https://translate.codeberg.org/projects/stash/stash/) to contribute to new or existing languages. Thanks!
This dockerfile is used by travis to build the stash image. It must be run after cross-compiling - that is, `stash-linux` must exist in the `dist` directory. This image must be built from the `dist` directory.
This Dockerfile is used by CI to build the `stashapp/stash` Docker image. It must be run after cross-compiling - that is, `stash-linux` must exist in the `dist` directory. This image must be built from the `dist` directory.
Modified from https://github.com/bep/dockerfiles/tree/master/ci-goreleaser
When the dockerfile is changed, the version number should be incremented in the Makefile and the new version tag should be pushed to docker hub. The `scripts/cross-compile.sh` script should also be updated to use the new version number tag, and the githubworkflow files need to be updated to pull the correct image tag.
When the Dockerfile is changed, the version number should be incremented in [.github/workflows/build-compiler.yml](../../.github/workflows/build-compiler.yml) and the workflow [manually ran](). `env: COMPILER_IMAGE` in [.github/workflows/build.yml](../../.github/workflows/build.yml) also needs to be updated to pull the correct image tag.
# Docker Installation (for most 64-bit GNU/Linux systems)
StashApp is supported on most systems that support Docker and docker-compose. Your OS likely ships with or makes available the necessary packages.
StashApp is supported on most systems that support Docker. Your OS likely ships with or makes available the necessary packages.
## Dependencies
Only `docker`and `docker-compose` are required. For the most part your understanding of the technologies can be superficial. So long as you can follow commands and are open to reading a bit, you should be fine.
Only `docker`is required. For the most part your understanding of the technologies can be superficial. So long as you can follow commands and are open to reading a bit, you should be fine.
Installation instructions are available below, and if your distrobution's repository ships a current version of docker, you may use that.
Installation instructions are available below, and if your distributions's repository ships a current version of docker, you may use that.
https://docs.docker.com/engine/install/
On some distributions, `docker compose` is shipped separately, usually as `docker-cli-compose`. docker-compose is not recommended.
### Get the docker-compose.yml file
Now you can either navigate to the [docker-compose.yml](https://raw.githubusercontent.com/stashapp/stash/master/docker/production/docker-compose.yml) in the repository, or if you have curl, you can make your Linux console do it for you:
Now you can either navigate to the [docker-compose.yml](https://raw.githubusercontent.com/stashapp/stash/develop/docker/production/docker-compose.yml) in the repository, or if you have curl, you can make your Linux console do it for you:
Once you have that file where you want it, modify the settings as you please, and then run:
```
docker-compose up -d
dockercompose up -d
```
Installing StashApp this way will by default bind stash to port 9999. This is available in your web browser locally at http://localhost:9999 or on your network as http://YOUR-LOCAL-IP:9999
@@ -29,9 +31,9 @@ Good luck and have fun!
### Docker
Docker is effectively a cross-platform software package repository. It allows you to ship an entire environment in what's referred to as a container. Containers are intended to hold everything that is needed to run an application from one place to another, making it easy for everyone along the way to reproduce the environment.
The StashApp docker container ships with everything you need to automatically build and run stash, including ffmpeg.
The StashApp docker container ships with everything you need to automatically run stash, including ffmpeg.
### docker-compose
Docker Compose lets you specify how and where to run your containers, and to manage their environment. The docker-compose.yml file in this folder gets you a fully working instance of StashApp exactly as you would need it to have a reasonable instance for testing / developing on. If you are deploying a live instance for production, a reverse proxy (such as NGINX or Traefik) is recommended, but not required.
### dockercompose
Docker Compose lets you specify how and where to run your containers, and to manage their environment. The docker-compose.yml file in this folder gets you a fully working instance of StashApp exactly as you would need it to have a reasonable instance for testing / developing on. If you are deploying a live instance for production, a [reverse proxy](https://docs.stashapp.cc/guides/reverse-proxy/) (such as NGINX or Traefik) is recommended, but not required.
- AI agents are not welcome to contribute to this project.
- All issues, pull request descriptions and comments must be written by humans.
- Fully AI-generated contributions will be closed without comment.
## AI-Assisted Code Contributions
AI-assisted code contributions generated with the use of LLMs are permitted under the following conditions:
- AI usage and scope must be openly disclosed in the PR description.
- You must be able to explain any line of code and design decision during the review process.
- You must perform manual testing and describe the steps taken to sufficiently verify the changes.
- You must take full responsibility for the code, including license compliance.
We are not accepting large, complex features generated by LLMs by outside contributors at this time.
## Respect Maintainers Time
Reviewing PRs takes a significant amount of time. Anyone with zero effort can generate code with an LLM, but it takes a human to understand it, test it, and ensure it fits with the overall design of the project.
We ask that contributors respect this by ensuring their PRs meet these standards before submitting them for review.
This document provides an overview of the Stash codebase architecture for new contributors.
## Project Overview
Stash is a self-hosted web application written in Go that organizes and serves diverse media collections, catering to both SFW and NSFW needs. It gathers information about videos and images from the internet through extensible community-built plugins and scrapers, supports a wide variety of formats, enables tagging and filtering, and provides statistics about performers, tags, studios, and more.
**Core purpose**: Manage local media libraries with automatic metadata scraping, tagging, and organization.
**Key design philosophy**:
- Backend: Go with GraphQL API and SQLite database
- Frontend: React/TypeScript with Apollo Client
- Extensibility: Plugin and scraper systems for community contributions
- Self-hosted: Single binary deployment with embedded frontend assets
## Repository Structure
```
stash/
├── cmd/ # Application entry points
│ ├── phasher/ # Perceptual hash utility
│ └── stash/ # Main application (cmd/stash/main.go)
├── docker/ # Docker configuration
│ ├── build/ # Build configurations
│ ├── ci/ # CI configurations
│ ├── compiler/ # Compiler Docker setup
│ └── production/ # Production Docker setup
├── graphql/ # GraphQL schema definitions
│ ├── schema/ # Main schema files
│ │ └── types/ # GraphQL type definitions
│ └── stash-box/ # Stash-box integration schema
├── internal/ # Internal application code
│ ├── api/ # GraphQL API layer (resolvers, server)
│ ├── autotag/ # Auto-tagging functionality
│ ├── desktop/ # Desktop integration
│ ├── dlna/ # DLNA media server
│ ├── identify/ # Scene identification
│ ├── log/ # Implementation of log system
│ ├── manager/ # Core application manager and services
│ └── static/ # Static asset serving
├── pkg/ # Reusable Go packages
│ ├── ffmpeg/ # FFmpeg integration for media processing
Note: `gqlgen.yml` maps GraphQL types to Go structs and controls code generation. Update it when adding new types or fields.
### GraphQL Request Lifecycle
1.**Request**: Frontend sends GraphQL query to `/graphql` endpoint
2.**Routing**: `internal/api/server.go` routes to GraphQL handler (gqlgen)
3.**Parsing**: gqlgen parses the query and validates against schema
4.**Resolver Execution**: Appropriate resolver method in `internal/api/` is called
5.**Transaction**: Resolver wraps operation in read or write transaction via `withReadTxn()` or `withTxn()`
6.**Business Logic** (mutations only):
- Complex entities (Scene, Gallery, Image, Group): resolver delegates to service layer (`pkg/scene/`, `pkg/gallery/`, etc.)
- Simpler entities (Performer, Studio, Tag): resolver calls validation functions (`pkg/performer/`, `pkg/studio/`, etc.) then proceeds directly to repository
- Queries and model field resolvers skip this step entirely
7.**Repository Call**: Resolver or service calls repository method (e.g., `r.repository.Scene.Find()`)
8.**SQL Execution**: SQLite implementation executes SQL query using a mix of goqu and a custom query builder
9.**Response**: Data flows back through layers to frontend as JSON
### Plugin System
**Location**: `pkg/plugin/`
- Defines the plugin spec for UI-based plugins (including JavaScript), and supports executing external scripts, commands, and binaries via raw or RPC interface
- Plugins are configured via YAML files in the plugins directory
- Support for hooks that trigger on events (e.g., `Scene.Create.Post`)
- Plugin cache in manager for performance
- RPC communication between Go and JavaScript plugins
- Example hooks: `Scene.Create.Post`, `Scene.Update.Post`, `Scan.Post`
Key files:
-`plugins.go` - Plugin loading and execution
-`hooks.go` - Hook system implementation
-`config.go` - Plugin configuration parsing
### Scraper System
**Location**: `pkg/scraper/`
- YAML-configured scrapers for fetching metadata from websites
- Complex filtering via a custom query builder system (`query.go`, `filter.go`) that constructs raw SQL
- Criterion handlers in `criterion_handlers.go` dynamically build WHERE, HAVING, and WITH clauses
- Supports hierarchical filters (tags, studios) via recursive CTEs
- Simpler queries (CRUD, join-table lookups) use `goqu` via the `table` abstraction
## Key Data Flows
### Example 1: GraphQL Query (findScene)
**Flow**:
1. Frontend sends GraphQL query requesting scene data by ID
2. Request hits `internal/api/server.go` at `/graphql` endpoint
3. gqlgen routes to the appropriate resolver in `resolver_query_find_scene.go`
4. Resolver wraps the operation in a read transaction using `withReadTxn()` to ensure consistent database access
5. Repository calls the SQLite implementation in `pkg/sqlite/scene.go` to execute the query
6. SQLite generates and executes the SQL query (using goqu or the custom queryBuilder depending on operation) to fetch the scene record
7. Scene object flows back through layers: SQLite → Repository → Resolver → GraphQL → Frontend
8. Frontend receives JSON response with the requested scene data
### Example 2: Scanning a File
**Flow**:
1. User triggers scan via UI (Settings → Metadata → Scan)
2. Frontend sends GraphQL mutation to start the scan job
3. Mutation resolver in `internal/api/resolver_mutation_metadata.go` creates a background job
4. Job manager queues `ScanJob` from `internal/manager/task_scan.go`
5.`ScanJob.Execute()` runs the scan operation with progress tracking
6. Filesystem walk traverses configured paths using `file.SymWalk`, queues files for processing, and filters based on modification time and .stashignore
7. File handlers process each file type: videos become Scenes, images become Images, zip files become Galleries, and folders get Folder records
8. For each video file, the system calculates checksums (MD5, oshash, phash), extracts metadata via FFmpeg, creates File and Scene records, and generates thumbnails, sprites, previews, and interactive heatmaps
9. Progress updates flow via GraphQL subscription with real-time updates on files processed
10. Scan completes with updated statistics, subscription notifies completion, and UI refreshes with new content
**Key Files**:
-`internal/manager/task_scan.go` - Main scan logic
Please be sure to consider how heavily your contribution impacts the maintainability of the project long term, sometimes less is more. We don't want to merge collossal pull requests with hundreds of dependencies by a driveby contributor.
## AI Usage Policy
## Contributor Checklist
Please make sure that you've considered the following before you submit your Pull Requests as ready for merging.
* I've run Code linters and [gofmt](https://golang.org/cmd/gofmt/) to make sure that my code is readable.
* I have read through formerly submitted [pull requests](https://github.com/stashapp/stash/pulls) and [git issues](https://github.com/stashapp/stash/issues) to make sure that this contribution is required and isn't a duplicate. Also, so that I can manage to close any git Issues needing closed relating to this feature submission.
* I commented adequately on my code with the expectation in mind that anyone else should be able to look at this code I've submitted and know exactly what's happening and what the expectations are.
Please see our [AI Usage Policy](/docs/AI_POLICY.md) for guidelines on the use of AI in contributions to this project.
### Legal Agreements
* I acknowledge that if applicable to me, submitting and subsequent acceptance of this Pull Request I, the code contributor of this Pull Request, agree and acknowledge my understanding that the new code license has now been updated to [AGPL](/LICENSE.md). I agree that all code before this Pull Request, which I've previously submitted, is now to be re-licensed under the new license AGPL and no longer the former MIT license.
## Issues
**In case you were unable to follow any of the above include an explanation as to why not in your Pull Request.**
Bug reports and feature requests must use descriptive and concise titles and follow the provided templates. Please use the search function to make sure that you are not submitting duplicates, and that a similar report or request has not already been resolved or rejected.
All issues must be written by humans. Fully AI-generated issues will be closed without comment.
## Pull Requests
All pull requests must use descriptive and concise titles and follow the provided templates. In addition, they must follow the the following guidelines:
- You must link to an open issue that pull request addresses (see [GitHub documentation](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue) on how to do that).
- Pull requests must be focused on a single issue or feature. Large, multi-purpose pull requests will be rejected.
- Large features must be discussed with maintainers before submitting a pull request to ensure it fits with the overall design vision of the project. Failure to do so may result in the pull request being rejected.
- Pull requests must include code tests that sufficiently cover the changes made.
- You must detail the manual testing done and describe the steps taken to sufficiently verify the changes.
- You must be able to explain any line of code and design decision during the review process.
By submitting a pull request, you agree that you have read and understood and that you are in compliance with the guidelines outlined here, including the [AI Usage Policy](docs/AI_POLICY.md).
You also agree to license your contribution under the [AGPL](/LICENSE.md) license, and that all of your previous contributions to the project are also licensed under the AGPL.
## Goals and Design Vision
The goal of Stash is to be:
- An application for organising and viewing NSFW and SFW content - currently this is videos and images, in future this will be extended to include audio and text content
- Organising includes scraping of metadata from websites and metadata repositories
- Free and open-source
- Portable and offline - can be run on a USB stick without needing to install dependencies (with the exception of FFmpeg)
- Minimal, but highly extensible. The core feature set should be the minimum required to achieve the primary goal, while being extensible enough to extend via plugins
- Easy to learn and use, with minimal technical knowledge required
The core Stash system is not intended for:
- Managing downloading of content
- Managing content on external websites
- Publicly sharing content
Other requirements:
- Support as many video and image formats as possible
- Interfaces with external systems (for example stash-box) should be made as generic as possible.
Design considerations:
- Features are easy to add and difficult to remove. Large superfluous features should be scrutinised and avoided where possible (e.g. DLNA, filename parser). Such features should be considered for third-party plugins instead.
*corepack/[pnpm](https://pnpm.io/installation) - nodejs package manager (included with nodejs)
## Environment
### Windows
1. Download and install [Go for Windows](https://golang.org/dl/)
2. Download and extract [MingW64](https://sourceforge.net/projects/mingw-w64/files/) (scroll down and select x86_64-posix-seh, dont use the autoinstaller it doesnt work)
3. Search for "advanced system settings" and open the system properties dialog.
2. Download and extract [MinGW64](https://sourceforge.net/projects/mingw-w64/files/) (scroll down and select x86_64-posix-seh, don't use the autoinstaller, it doesn't work)
3. Search for "Advanced System Settings" and open the System Properties dialog.
1. Click the `Environment Variables` button
2. Under system variables find the `Path`. Edit and add `C:\MinGW\bin` (replace with the correct path to where you extracted MingW64).
2. Under System Variables find `Path`. Edit and add `C:\MinGW\bin` (replace with the correct path to where you extracted MingW64).
NOTE: The `make` command in Windows will be `mingw32-make` with MingW. For example `make pre-ui` will be `mingw32-make pre-ui`
NOTE: The `make` command in Windows will be `mingw32-make` with MinGW. For example,`make pre-ui` will be `mingw32-make pre-ui`.
### macOS
1. If you don't have it already, install the [Homebrew package manager](https://brew.sh).
2. Install dependencies: `brew install go git yarn gcc make node ffmpeg`
2. Install dependencies: `brew install go git gcc make node ffmpeg`
### Linux
#### Arch Linux
1. Install dependencies: `sudo pacman -S go git yarn gcc make nodejs ffmpeg --needed`
1. Install dependencies: `sudo pacman -S go git gcc make nodejs ffmpeg --needed`
2. Follow the instructions below to build a release, but replace the final step `make build-release` with `gmake flags-release stash`, to [avoid the PIE buildmode](https://github.com/golang/go/issues/59866).
NOTE: The `make` command in OpenBSD will be `gmake`. For example, `make pre-ui` will be `gmake pre-ui`.
## Commands
*`make pre-ui` - Installs the UI dependencies. Only needs to be run once before building the UI for the first time, or if the dependencies are updated
*`make generate` - Generate Go and UI GraphQL files
*`make fmt-ui` - Formats the UI source code
*`make ui` - Builds the frontend
*`make build` - Builds the binary (make sure to build the UI as well... see below)
*`make pre-ui` - Installs the UI dependencies. This only needs to be run once after cloning the repository, or if the dependencies are updated.
*`make generate` - Generates Go and UI GraphQL files. Requires `make pre-ui` to have been run.
*`make generate-stash-box-client` - Generate Go files for the Stash-box client code.
*`make ui` - Builds the UI. Requires `make pre-ui` to have been run.
*`make stash` - Builds the`stash` binary (make sure to build the UI as well... see below)
*`make stash-macapp` - Builds the `Stash.app` macOS app (only works when on macOS, for cross-compilation see below)
*`make phasher` - Builds the `phasher` binary
*`make build` - Builds both the `stash` and `phasher` binaries, alias for `make stash phasher`
*`make build-release` - Builds release versions (debug information removed) of both the `stash` and `phasher` binaries, alias for `make flags-release flags-pie build`
*`make docker-build` - Locally builds and tags a complete 'stash/build' docker image
*`make lint` - Run the linter on the backend
*`make fmt` - Run `go fmt`
*`make it` - Run the unit and integration tests
*`make validate` - Run all of the tests and checks required to submit a PR
*`make server-start` - Runs an instance of the server in the `.local` directory.
*`make server-clean` - Removes the `.local` directory and all of its contents.
*`make ui-start` - Runs the UI in development mode. Requires a running stash server to connect to. Stash server port can be changed from the default of `9999` using environment variable `VITE_APP_PLATFORM_PORT`. UI runs on port `3000` or the next available port.
*`make docker-cuda-build` - Locally builds and tags a complete 'stash/cuda-build' docker image
*`make validate` - Runs all of the tests and checks required to submit a PR
*`make lint` - Runs `golangci-lint` on the backend
*`make it` - Runs all unit and integration tests
*`make fmt` - Formats the Go source code
*`make fmt-ui` - Formats the UI source code
*`make validate-ui` - Runs tests and checks for the UI only
*`make fmt-ui-quick` - (experimental) Formats only changed UI source code
*`make validate-ui-quick` - (experimental) Runs tests and checks of changed UI code
*`make server-start` - Runs a development stash server in the `.local` directory
*`make server-clean` - Removes the `.local` directory and all of its contents
*`make ui-start` - Runs the UI in development mode. Requires a running Stash server to connect to - the server URL can be changed from the default of `http://localhost:9999` using the environment variable `VITE_APP_PLATFORM_URL`, but keep in mind that authentication cannot be used since the session authorization cookie cannot be sent cross-origin. The UI runs on port `3000` or the next available port.
When building, you can optionally prepend `flags-*` targets to the target list in your `make` command to use different build flags:
*`flags-release` (e.g. `make flags-release stash`) - Remove debug information from the binary.
*`flags-pie` (e.g. `make flags-pie build`) - Build a PIE (Position Independent Executable) binary. This provides increased security, but it is unsupported on some systems (notably 32-bit ARM and OpenBSD).
*`flags-static` (e.g. `make flags-static phasher`) - Build a statically linked binary (the default is a dynamically linked binary).
*`flags-static-pie` (e.g. `make flags-static-pie stash`) - Build a statically linked PIE binary (using `flags-static` and `flags-pie` separately will not work).
*`flags-static-windows` (e.g. `make flags-static-windows build`) - Identical to `flags-static-pie`, but does not enable the `netgo` build tag, which is not needed for static builds on Windows.
## Local development quickstart
@@ -59,13 +81,14 @@ NOTE: The `make` command in Windows will be `mingw32-make` with MingW. For examp
2. Run `make generate` to create generated files
3. In one terminal, run `make server-start` to run the server code
4. In a separate terminal, run `make ui-start` to run the UI in development mode
5. Open the UI in a browser `http://localhost:3000/`
5. Open the UI in a browser:`http://localhost:3000/`
Changes to the UI code can be seen by reloading the browser page.
Changes to the server code requires a restart (`CTRL-C` in the server terminal).
Changes to the backend code require a server restart (`CTRL-C` in the server terminal, followed by `make server-start` again) to be seen.
On first launch:
1. On the "Stash Setup Wizard" screen, choose a directory with some files to test with
2. Press "Next" to use the default locations for the database and generated content
3. Press the "Confirm" and "Finish" buttons to get into the UI
@@ -73,25 +96,34 @@ On first launch:
5. You're all set! Set any other configurations you'd like and test your code changes.
To start fresh with new configuration:
1. Stop the server (`CTRL-C` in the server terminal)
2. Run `make server-clean` to clear all config, database, and generated files (under `.local/`)
2. Run `make server-clean` to clear all config, database, and generated files (under `.local`)
3. Run `make server-start` to restart the server
4. Follow the "On first launch" steps above
## Building a release
Simply run `make` or `make release`, or equivalently:
1. Run `make pre-ui` to install UI dependencies
2. Run `make generate` to create generated files
3. Run `make ui` to compile the frontend
4. Run `make build` to build the executable for your current platform
3. Run `make ui` to build the frontend
4. Run `make build-release` to build a release executable for your current platform
## Crosscompiling
## Cross-compiling
This project uses a modification of the [CI-GoReleaser](https://github.com/bep/dockerfiles/tree/master/ci-goreleaser) docker container to create an environment
where the app can be cross-compiled. This process is kicked off by CI via the `scripts/cross-compile.sh` script. Run the following
command to open a bash shell to the container to poke around:
This project uses a modification of the [CI-GoReleaser](https://github.com/bep/dockerfiles/tree/master/ci-goreleaser) Docker container for cross-compilation, defined in `docker/compiler/Dockerfile`.
1. Run `make pre-ui`, `make generate` and `make ui` outside the container, to generate files and build the UI.
2. Pull the latest compiler image from GHCR: `docker pull ghcr.io/stashapp/compiler`
3. Run `docker run --rm --mount type=bind,source="$(pwd)",target=/stash -w /stash -it ghcr.io/stashapp/compiler /bin/bash` to open a shell inside the container.
4. From inside the container, run `make build-cc-all` to build for all platforms, or run `make build-cc-{platform}` to build for a specific platform (have a look at the `Makefile` for the list of targets).
5. You will find the compiled binaries in `dist/`.
NOTE: Since the container is run as UID 0 (root), the resulting binaries (and the `dist/` folder itself, if it had to be created) will be owned by root.
rating:Int@deprecated(reason:"Use 1-100 range with rating100")
code:String
# rating expressed as 1-100
rating100:Int
organized:Boolean
url:String
url:String@deprecated(reason:"Use urls")
urls:[String!]
date:String
details:String
photographer:String
studio_id:ID
performer_ids:[ID!]
tag_ids:[ID!]
gallery_ids:[ID!]
primary_file_id:ID
custom_fields:CustomFieldsInput
}
inputBulkImageUpdateInput{
clientMutationId:String
ids:[ID!]
title:String
# rating expressed as 1-5
rating:Int@deprecated(reason:"Use 1-100 range with rating100")
code:String
# rating expressed as 1-100
rating100:Int
organized:Boolean
url:String
url:String@deprecated(reason:"Use urls")
urls:BulkUpdateStrings
date:String
details:String
photographer:String
studio_id:ID
performer_ids:BulkUpdateIds
tag_ids:BulkUpdateIds
gallery_ids:BulkUpdateIds
custom_fields:CustomFieldsInput
}
inputImageDestroyInput{
id:ID!
delete_file:Boolean
delete_generated:Boolean
"If true, delete the file entry from the database if the file is not assigned to any other objects"
destroy_file_entry:Boolean
}
inputImagesDestroyInput{
ids:[ID!]!
delete_file:Boolean
delete_generated:Boolean
"If true, delete the file entry from the database if the file is not assigned to any other objects"
destroy_file_entry:Boolean
}
typeFindImagesResultType{
count:Int!
"""Total megapixels of the images"""
"Total megapixels of the images"
megapixels:Float!
"""Total file size in bytes"""
"Total file size in bytes"
filesize:Float!
images:[Image!]!
}
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.