Commit graph

1107 commits

Author SHA1 Message Date
Tweeticoats
cca156b5f8
Add container_name to docker compose (#1689)
* Add container_name to docker compose
* Add ports to docker compose
* Provide instructions for DLNA
2021-10-01 16:26:32 +10:00
WithoutPants
ca0a8b00ec
Only group by if using having clauses (#1750)
* Only group by if using having clauses
* Change tag sorting SQL
* Add sorting unit tests
2021-10-01 16:24:58 +10:00
WithoutPants
e3480531a7
Lightbox pan, zoom and display mode options (#1708)
* Rewrite lightbox code
* Don't render offscreen images
* Scroll up to zoom in
* Support touch gestures
* Add reset zoom button
* Align top of image on original/fit horizontal
* Add scrollmode setting
* Add scale up option
* Add option to maintain zoom when transisitioning
* Fix image slideshow wrap around
* Wrap around on previous on first page/image
* Fix single page issues
* Fix two-pointer zoom mode incorrectly activated
2021-10-01 11:52:32 +10:00
gitgiggety
dabf5acefe
Filter tag by hierarchy (#1746)
* Add API support for filtering tags by parent / children
* Add parent & child tags filters for tags to UI
* Add API support for filtering tags by parent / child count
* Add parent & child count filters for tags to UI
* Update db generator
* Add missing build tag
* Add unit tests

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
2021-10-01 11:50:06 +10:00
kermieisinthehouse
df2c9e9754
Fix broken links (#1787) 2021-09-30 10:22:25 +10:00
WithoutPants
9e541956f2
Don't preload videos (#1780) 2021-09-30 09:50:30 +10:00
SmallCoccinelle
bc6d04dc2a
Remove new-from-rev from the linter (#1783)
* Fix all revive warnings in the code base

All of these are of the form

```
var Identifier Type = Expr
```

where the `Type` is known from the output of `Expr` and can be omitted
as a result.

* Handle unchecked errors

* Remove new-from-rev

Since the project passes all linter checks now, including older
revisions, we can remove new-from-rev. While here, reorder the linter
config file, and move the enabled linters up and settings down.

* Fix failing test cases

Studio & Performer export tests use local time rather than UTC. This
fixes the test cases so integration test
passes.
2021-09-28 09:29:45 +10:00
SmallCoccinelle
b94eecae24
Fix integration-testing in the build action (#1784)
When the golangci workflow action was added, we moved large parts of
validation to the parallel action. However, integration testing still
has to happen on the main build action, as it isn't covered by the
validation action.

Reenable the `it` target through docker container build.

This fixes backend test errors sneaking through the build action.
2021-09-28 09:28:05 +10:00
WithoutPants
6ce57a9a43
Fix styling for scene duration on empty system (#1781) 2021-09-27 16:57:24 +10:00
WithoutPants
94d192b833
Don't scan zero length files or directories (#1779)
* Don't scan zero length files or directories
2021-09-27 16:49:30 +10:00
WithoutPants
479bd438df
Accept svg for tag images in file selector (#1778)
* Accept svg for tag images
2021-09-27 12:27:05 +10:00
WithoutPants
b957a87a78
Fix scene marker sort by scene updated SQL error (#1777) 2021-09-27 12:26:38 +10:00
gitgiggety
be94e52f21
Add movie count to performer and studio card (#1760)
* Add movies and movie_count properties to Performer type

Extend the GraphQL API to allow getting the movies and movie count by
performer.

* Add movies count to performer card

* Add movies and movie_count properties to Studio type

Extend the GraphQL API to allow getting the movies and movie count by
studio.

* Add movies count to studio card
2021-09-27 11:31:49 +10:00
Eng Zer Jun
62af723017
refactor: move from io/ioutil to io and os package (#1772)
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-09-27 10:55:23 +10:00
SmallCoccinelle
a2cce0ba77
Add golangci-lint workflow (#1759)
* Add golangci-lint workflow

* Add a bit more lenient linter timeout

1 Minute isn't always enough, so bump to 3.

* Document golangci, add make target

Document how to get golangci-lint in the README file. While here,
provide a QOL target in the makefile
for the linter, and make it part of validation.

* Introduce .golangci.yml

This is the default golangci-lint configuration file location. Use it.

Move configuration into the yaml file, and enable the default set of
linters; we know we pass most of those.

* Add gofmt and revive to golangci-lint

Read the golangci-lint source code to figure out the configuration format.

Copy the configuration from `revive.toml` into the linter configuration.

* Do not set simplify on gofmt

The project currently runs without simplify. So for consistency, don't
make that a requirement for the linter.

* Add new-from-rev

Older issues should not be considered a failure for new PRs and issues.
Use new-from-from to make the current develop as the point-in-time for
when we consider errors.

Once in the tree, we can go and fix the older errors in separate
patches, taking a little bit at a time.

* Move to golangci-lint

Rewrite the way we run targets in the makefile, so it is split between
frontend and backend.

Use the frontend build steps in build.yml

Update README to reflect the new world order.

* Remove check-gofmt.sh

The tool now runs as part of golangci-lint, in particular through the
'validate' target in the Makefile.

* Remove targets for golangci-lint

Fold these targets into the `lint` target. While here, update README.
2021-09-27 10:41:59 +10:00
gitgiggety
1d04b550b9
Movie card visual consistency (#1758)
* Support getting scenes on movies in the API

* Make movie card visually consistent with scene etc

* Add date
* Add synopsis
* Show scene count with hover listing the scenes
* Move scene index to button

* Move scene number to own section

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
2021-09-26 13:52:08 +10:00
gitgiggety
5fdab995f5
Fix list state navigation (#1765)
* Fix sort direction being lost filtering scenes list

Fix thevsort direction being lost on the scenes (& images & galleries?)
lists when filtering the list by using the "badges" on the tags /
performers / ... popovers.

* Fix using back button not clearing filters to empty

Fix (re)setting of a lists criterion based on the URL in case the new
URL doesn't have criterions / "c" set. When it's unset it should be
assumed the criterions must be empty, instead of maintaining the current
criterions (which could be populated wirh the old criterions when the
list was shown before).

* Set page to 1 on list when applying new filter
2021-09-26 13:51:45 +10:00
gitgiggety
f977d0e18a
Add date & details to gallery card (#1763)
* Add date & details to gallery card

Make the gallery card visually consistent with the scenes card. So move
the "X images" to a button at the bottom (where tags, performers and
scenes are shown as well) and add the date & details to the card.
2021-09-26 13:16:49 +10:00
bnkai
ba2a79700a
Remove last jwt-go references (#1770) 2021-09-26 10:11:42 +10:00
InfiniteTF
2f664fe826
Disable vips in Windows (#1767) 2021-09-26 10:01:45 +10:00
WithoutPants
b14d5c5650
Migrate to golang-jwt (#1757) 2021-09-24 11:57:49 +10:00
SmallCoccinelle
a9e2a590b2
Lint checks phase 2 (#1747)
* Log 3 unchecked errors

Rather than ignore errors, log them at
the WARNING log level.

The server has been functioning without these, so assume they are not at
the ERROR level.

* Log errors in concurrency test

If we can't initialize the configuration, treat the test as a failure.

* Undo the errcheck on configurations for now.

* Handle unchecked errors in pkg/manager

* Resolve unchecked errors

* Handle DLNA/DMS unchecked errors

* Handle error checking in concurrency test

Generalize config initialization, so we can initialize a configuration
without writing it to disk.

Use this in the test case, since otherwise the test fails to write.

* Handle the remaining unchecked errors

* Heed gosimple in update test

* Use one-line if-initializer statements

While here, fix a wrong variable capture error.

* testing.T doesn't support %w

use %v instead which is supported.

* Remove unused query builder functions

The Int/String criterion handler functions are now generalized.

Thus, there's no need to keep these functions around anymore.

* Mark filterBuilder.addRecursiveWith nolint

The function is useful in the future and no other refactors are looking
nice.

Keep the function around, but tell the linter to ignore it.

* Remove utils.Btoi

There are no users of this utility function

* Return error on scan failure

If we fail to scan the row when looking for the
unique checksum index, then report the error upwards.

* Fix comments on exported functions

* Fix typos

* Fix startup error
2021-09-23 17:15:50 +10:00
InfiniteTF
9cb1eccadb
Improve image scanning performance and thumbnail generation (#1655)
* Improve image scanning performance and thumbnail generation
* Add vips-tools to build image
* Add option to write generated thumbnails to disk
* Fallback to image if thumbnail generation fails

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
2021-09-23 15:22:14 +10:00
kermieisinthehouse
1e8a8efe3e
Escape all regexp control characters (#1753)
* Escape all regexp control characters
* Add #1752 unit tests

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
2021-09-23 13:08:08 +10:00
WithoutPants
cceaff780b
Update build.yml 2021-09-23 12:41:39 +10:00
WithoutPants
8d9eb7f1e4
Create temp UI file so that embed doesn't fail 2021-09-23 11:13:32 +10:00
SmallCoccinelle
4a0c4c4847
Reorder waitgroup completion (#1748)
Rather than passing a pointer to a waitgroup into task.Start(..)
functions, handle the waitgroup.Done() at the callsite.

This makes waitgroup handling local to its definition rather than it
being spread out over multiple files. Tasks now simply execute, and
the policy of waiting on them is handled by the caller.
2021-09-22 13:22:59 +10:00
WithoutPants
56111433a1
Replace packr with go embed (#1751)
* Embed performer images
* Embed schema migrations
* Update dependencies
* Embed UI
* Remove remaining packr references
2021-09-22 13:08:34 +10:00
WithoutPants
f292238e7f
Only close DB if not nil (#1749) 2021-09-21 21:57:50 +10:00
dependabot[bot]
25182997f1
Bump axios from 0.21.1 to 0.21.2 in /ui/v2.5 (#1745)
Bumps [axios](https://github.com/axios/axios) from 0.21.1 to 0.21.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.21.1...v0.21.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 20:32:55 +10:00
InfiniteTF
a4ed9515c7
Support subpaths when serving stash through a reverse proxy (#1719)
* Support subpaths when serving stash through a reverse proxy
* Add README documentation

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
2021-09-21 14:12:10 +10:00
WithoutPants
f3c8407c40
Cancel in progress builds when new action starts 2021-09-21 12:05:46 +10:00
gitgiggety
3e526a49a4
Add indexes for path and checksum to images (#1740)
* Add indexes for path and checksum to images

The scenes table has unique indexes/constraints on path and checksum
colums. The images table doesn't, which doesn't really make sense, as
scanning uses these colums extensively which warrents an index, and both
should be unique as well.

Adding these indexes thus heavily improves the scanning tasks
performance. On a database containing 4700 images a (re)scan of those
4700 files, which thus shouldn't do anything, took 1.2 seconds, with the
indexes added this only takes 0.4 seconds. Taking the same test on a
generated database containing 4M images + the actual 4700 images took 26
minutes for a rescan, and with the index existing also only takes 0.4
seconds.

* Add images.checksum unique constraint in code with fallback

Work around the issue where in some cases duplicate images (/checksums
on images) might exist. This as discussed in #1740 by creating the index
on startup and in case of an error logging the duplicates. This so the
users where this scenario exists can correct the database (by searching
on the logged checksum(s) and removing the duplicates) and after a
restart the unique index / constraint will still be created. In case
when creating the unique index fails a "normal" / non-unique index is
created as surrogate so the user will still get the performance benefit
(for example during scanning) without being forced to remove the
duplicates and restart beforehand. This surrogate is also automatically
cleaned up after the unique index is succesfully created.
2021-09-21 11:48:52 +10:00
SmallCoccinelle
b7c229dc70
Set NORMAL sync on sqlite3 (#1684)
NORMAL sync is safe when using WAL journaliing.

It cuts the amount of sync calls to the disk, resulting in faster write
operation. On power loss, the database will perhaps lose some ongoing
commits, but that is all.

The expectation is that if the database lives on the same disk as the
stash, this could help performance quite a bit under heavier operation.
2021-09-21 11:38:56 +10:00
SmallCoccinelle
87709fd018
Errcheck phase 1 (#1715)
* Avoid redundant logging in migrations

Return the error and let the caller handle the logging of the error if
needed.

While here, defer m.Close() to the function boundary.

* Treat errors as values

Use %v rather than %s and pass the errors directly.

* Generate a wrapped error on stat-failure

* Log 3 unchecked errors

Rather than ignore errors, log them at
the WARNING log level.

The server has been functioning without these, so assume they are not at
the ERROR level.

* Propagate errors upward

Failure in path generation was ignored. Propagate the errors upward the
call stack, so it can be handled at the level of orchestration.

* Warn on errors

Log errors rather than quenching them.

Errors are logged at the Warn-level for now.

* Check error when creating test databases

Use the builtin log package and stop the program fatally on error.

* Add warnings to uncheck task errors

Focus on the task system in a single commit, logging unchecked
errors as warnings.

* Warn-on-error in API routes

Look through the API routes, and make sure errors are being logged if
they occur. Prefer the Warn-log-level because none of these has proven
to be fatal in the system up until now.

* Propagate error when adding Util API

* Propagate error on adding util API

* Return unhandled error

* JS log API: propagate and log errors

* JS Plugins: log GQL addition failures.

* Warn on failure to write to stdin

* Warn on failure to stop task

* Wrap viper.BindEnv

The current viper code only errors if no name is provided, so it should
never fail. Rewrite the code flow to factor through a panic-function.

This removes error warnings from this part of the code.

* Log errors in concurrency test

If we can't initialize the configuration, treat the test as a failure.

* Warn on errors in configuration code

* Plug an unchecked error in gallery zip walking

* Warn on screenshot serving failure

* Warn on encoder screenshot failure

* Warn on errors in path-handling code

* Undo the errcheck on configurations for now.

* Use one-line initializers where applicable

rather than using

  err := f()
  if err!= nil { ..

prefer the shorter

  if err := f(); err != nil { ..

If f() isn't too long of a name, or wraps a function with a body.
2021-09-21 09:34:25 +10:00
bnkai
af6232ec97
Fix Query for Scene Markers (#1743) 2021-09-20 09:52:19 +10:00
liquid-flow
919249f851
Fix Scene Player CLS issue (#1739) 2021-09-19 11:31:52 +10:00
liquid-flow
13fda2ad85
Fix scene edit panel layout (#1737)
* Fix scene edit panel layout
2021-09-19 11:07:23 +10:00
gitgiggety
82e4ad4130
Execute Gallery.Create.Post plugin hook during scan (#1731)
* Execute Gallery.Create.Post plugin hook during scan

Fix issue where Gallery.Create.Post hook is not executed when a new
gallery is created during scan, when the gallery is created based on the
folder.

* Fix Gallery.Create.Post hook being invoked in transaction

Invoke the Gallery.Create.Post hook during zip scan after the
transaction has been committed. This is necessary to allow the plugin to
access the gallery (using GraphQL API). Otherwise the API obviously uses
a different database transaction which can't find the gallery as it
isn't committed yet.
2021-09-19 10:28:34 +10:00
gitgiggety
b83ce29ac4
Scraper log improvements (#1741)
* Fix logs from scraper and plugins not being shown in UI

Using `logger.` in the logger package to write logs is "incorrect". This
as the package contains a variable named `logger` which contains the
logrus instance. So instead of the log line being handled by the custom
log implementation / wrapper which makes sure the lines are shown in the
UI as well, it's written to logrus directly meaning the wrapper is
skipped.

This "issue" is obviously triggered because in any other place
`logger.X` can be used and it will used the custom logger package /
wrapper which works fine.

* Add plugin / scraper name to logging output

Indicate which plugin / scraper wrote a log message by including its
name to the `[Scrape]` prefix.

* Add missing addLogItem call
2021-09-19 10:06:34 +10:00
WithoutPants
66f92c5dcc
Fix autotag tag alias (#1713)
* Add unit tests for tag alias
* Fix tag alias autotag
* Don't autotag non-path galleries
* Add studio alias tests
2021-09-17 09:23:56 +10:00
stg-annon
d29699fa30
Support scraper logging to specific log levels (#1648)
* init scrapper log levels
* Refactor plugin logging

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
2021-09-17 09:09:44 +10:00
WithoutPants
501ed7c2c2
Make hierarchical criterion depth input optional (#1733) 2021-09-16 20:41:07 +10:00
MartinWe13
e0c910d9e8
Adjustments German translation (#1730)
* Update de-DE.json

A few (first) adjustments to the German translation. Partly the words are chosen too long and translated not very technically.
2021-09-16 12:10:08 +10:00
gitgiggety
f3119a6c38
Add AND, OR and NOT support to studio filter (#1726) 2021-09-16 12:09:23 +10:00
Still Hsu
23f852cd91
Add new zh-tw localizations & move non-legacy localization keys (#1693)
* Add new localizations & move non-legacy localization keys

Signed-off-by: Still Hsu <dev@stillu.cc>

* Fix sv-SE localization keys

Signed-off-by: Still Hsu <dev@stillu.cc>

* Fix duplicated key
* Add missing internationalisation

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
2021-09-16 09:04:50 +10:00
gitgiggety
2274db16b7
Generate screenshot images for markers (#1604)
* Generate screenshot images for markers

In some scenarios it might not be possible to use the preview video or
image of markers, i.e. when only static images are supported like in
Kodi. So generate a static screenshot as well.

* Make generating animated and static image optional for markers
* Use screenshot for markers when preview type is set to static image
2021-09-15 12:27:05 +10:00
liquid-flow
f5e4e7742e
[Bug Fix] Disable float-on-scroll JWPlayer feature on mobile (#1721)
* Disable video float on mobile
2021-09-15 10:13:45 +10:00
Perdition
3be23999ef
Update sv-SE.json (#1722)
Fixes a bunch of awkward sounding terms and other errors.
2021-09-14 23:21:59 +10:00
liquid-flow
612ecb72fc
[Bug Fix] Fix scene markers editor mobile UI (#1718)
* Fix mobile layout
2021-09-14 20:07:53 +10:00