* add error propagation and logging in favicon-related functions
If favicon fetching or serving fails for any reason, or if favicon_path
is not configured, log an error.
Related to #655
* add lint to default make target to conform with GitHub workflow
* change error string to conform to linter
* More reliable favicon retrieval.
Previously, the application looked for favicons in `/favicon.ico`.
But favicons can be anywhere on a website and the location can be
defined in HTML and JSON manifests. Websites can also have multiple
favicons.
As a result, when a new site was added to stash-box which did not have a
`/favicon.ico`, the site was created without a proper favicon. Additionally,
since stash-box didn't check the filetype of the data returned by the
`/favicon.ico` GET request, it stored various 404 and other redirected
html pages.
A non-trivial amount of logic is required to discover all favicon
locations, check filetypes, and sort them. It therefore makes sense to
rely on a third-party package for this job. This patch uses
`go.deanishe.net/favicon`.
* Check length of icons to avoid runtime error when using icons[0] later.
* Specify go.deanishe.net/favicon as direct requirement
* favicon: crate favicon file only after retreival has succeded
Previously, an empty file was created at the start of the downloadIcon
function and would remain as an empty file even when favicon retreival
failed. This empty file would prevent future attempts to download an
icon for the same site ID.
Now the icon file is created at the end, after everything else has
succeeded.
* retreive the smallest available favicon for sites
* use http.client with cookiejar for favicon finder
Cookies are required for certain websites, even for simple requests.
See code comment for details.
* Makefile: include generate in the default make target
This more closely mirrors the GitHub workflow build process and helps
avoid CI build failures on pull requests.
* consolidate .PHONY lines for readability
* add 'make clean'
* pre-ui must be declared as PHONY
Otherwise, if a file named `pre-ui` exists, the pre-ui make target will
be skipped.
* rm dist in make clean
dist is currently created by go build from the cross-compile make
targets
* move PHONY and simple var exports to top for readability
* consolidate the previous 3-step build into a default make target
The previous default target was `pre-build` which doesn't accomplish
anything useful on its own. Now the default build target is `stash-box`
which calls the other three targets that build the application.
Readme updated to reflect this change.
* Remove config file from clean command
While the config is initially auto generated, it is typically manually edited by the user, so it should not be cleaned.
Co-authored-by: InfiniteTF <infinitekittens@protonmail.com>
* Fix clicking on "show all results" not working
* Fix effect of pressing Enter on PerformerSelect
Fixes navigation to /search/:term when pressing enter on PerformerSelect
* Add `ui-start` to Makefile
* Add fuzzy performer/scene search
* Add frontend support for users
* Add support for tags and fingerprints
* Fingerprint duration and UI updates
* Add image entity for performers/scenes/studios
* Switch frontend to create-react-app and typescript 3.9
* Remove image fields from URL type
* Remove image fields from studio
* Fix bugs, and update frontend config/readme
* Add pg_trgm info
* Fix integration tests
* Create image url resolver and remove unused image fields
* Don't open browser by default
* Fix development auth cookie issues
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
* Add tags
* Add studio
* Add scenes support
* Add integration test
* Add gitattributes. Add test targets
* Add DB interface and refactor
* Add performer image
* Replace checksums with fingerprints
* Update dependencies
* Make performers unique on name/disambiguation
* Add first draft of README