|
1 | 1 | # stash-box
|
2 |
| -Stash App's own OpenSource video indexing and Perceptual Hashing MetaData API |
| 2 | + |
| 3 | +[](https://discord.gg/2TsNFKt) |
| 4 | + |
| 5 | +**stash-box is Stash App's own OpenSource video indexing and Perceptual Hashing MetaData API for porn.** |
| 6 | + |
| 7 | +The intent of stash-box is to provide a collaborative, crowd-sourced database of porn metadata, in the same way as [MusicBrainz](https://musicbrainz.org/) does for music. The submission and editing of metadata is expected to follow the same principle as that of the MusicBrainz database. [See here](https://musicbrainz.org/doc/Editing_FAQ) for how MusicBrainz does it. |
| 8 | + |
| 9 | +Currently, stash-box provides a graphql backend API only. There is no built in UI. The graphql playground can be accessed at `host:port/playground`. The graphql interface is at `host:port/graphql`. |
| 10 | + |
| 11 | +# Docker install |
| 12 | + |
| 13 | +TODO |
| 14 | + |
| 15 | +# Bare-metal Install |
| 16 | + |
| 17 | +Stash-box supports macOS, Windows, and Linux. |
| 18 | + |
| 19 | +Releases TODO |
| 20 | + |
| 21 | +## CLI |
| 22 | + |
| 23 | +Stash-box provides some command line options. See what is currently available by running `stashdb --help`. |
| 24 | + |
| 25 | +For example, to run stash locally on port 80 run it like this (OSX / Linux) `stashdb --host 127.0.0.1 --port 80` |
| 26 | + |
| 27 | +## Configuration |
| 28 | + |
| 29 | +Stash-box generates a configuration file in the current working directory when it is first started up. This configuration file is generated with the following defaults: |
| 30 | +- running on `0.0.0.0` port `9998` |
| 31 | +- sqlite3 database generated in the current working directory named `stashdb-go.sqlite` |
| 32 | +- generated read (`read_api_key`) and write (`modify_api_key`) API keys. These can be deleted to disable read/write authentication (all requests will be allowed without API key) |
| 33 | + |
| 34 | +### API keys |
| 35 | + |
| 36 | +These are a very basic authorization method. When set, the `ApiKey` header must be set to the correct value to read/write the data. The write API key allows reading and writing. The read API key allows only reading. |
| 37 | + |
| 38 | +## SSL (HTTPS) |
| 39 | + |
| 40 | +Stash-box supports HTTPS with some additional work. First you must generate a SSL certificate and key combo. Here is an example using openssl: |
| 41 | + |
| 42 | +`openssl req -x509 -newkey rsa:4096 -sha256 -days 7300 -nodes -keyout stashdb.key -out stashdb.crt -extensions san -config <(echo "[req]"; echo distinguished_name=req; echo "[san]"; echo subjectAltName=DNS:stashdb.server,IP:127.0.0.1) -subj /CN=stashdb.server` |
| 43 | + |
| 44 | +This command would need customizing for your environment. [This link](https://stackoverflow.com/questions/10175812/how-to-create-a-self-signed-certificate-with-openssl) might be useful. |
| 45 | + |
| 46 | +Once you have a certificate and key file name them `stashdb.crt` and `stashdb.key` and place them in the directory where stash-box is run from. Stash-box detects these and starts up using HTTPS rather than HTTP. |
| 47 | + |
| 48 | +# FAQ |
| 49 | + |
| 50 | +> I have a question not answered here. |
| 51 | +
|
| 52 | +Join the [Discord server](https://discord.gg/2TsNFKt). |
| 53 | + |
| 54 | +# Development |
| 55 | + |
| 56 | +## Install |
| 57 | + |
| 58 | +* [Revive](https://github.com/mgechev/revive) - Configurable linter |
| 59 | + * Go Install: `go get github.com/mgechev/revive` |
| 60 | +* [Packr2](https://github.com/gobuffalo/packr/tree/v2.0.2/v2) - Static asset bundler |
| 61 | + * Go Install: `go get github.com/gobuffalo/packr/v2/[email protected]` |
| 62 | + * [Binary Download](https://github.com/gobuffalo/packr/releases) |
| 63 | +* [Yarn](https://yarnpkg.com/en/docs/install) - Yarn package manager |
| 64 | + |
| 65 | +NOTE: You may need to run the `go get` commands outside the project directory to avoid modifying the projects module file. |
| 66 | + |
| 67 | +## Environment |
| 68 | + |
| 69 | +### macOS |
| 70 | + |
| 71 | +TODO |
| 72 | + |
| 73 | +### Windows |
| 74 | + |
| 75 | +1. Download and install [Go for Windows](https://golang.org/dl/) |
| 76 | +2. Download and install [MingW](https://sourceforge.net/projects/mingw-w64/) |
| 77 | +3. Search for "advanced system settings" and open the system properties dialog. |
| 78 | + 1. Click the `Environment Variables` button |
| 79 | + 2. Add `GO111MODULE=on` |
| 80 | + 3. Under system variables find the `Path`. Edit and add `C:\Program Files\mingw-w64\*\mingw64\bin` (replace * with the correct path). |
| 81 | + |
| 82 | +## Commands |
| 83 | + |
| 84 | +* `make generate` - Generate Go GraphQL and packr2 files. This should be run if the graphql schema or schema migration files have changed. |
| 85 | +* `make build` - Builds the binary |
| 86 | +* `make vet` - Run `go vet` |
| 87 | +* `make lint` - Run the linter |
| 88 | +* `make test` - Runs the unit tests |
| 89 | +* `make it` - Runs the unit and integration tests |
| 90 | + |
| 91 | +## Building a release |
| 92 | + |
| 93 | +1. Run `make generate` to create generated files |
| 94 | +2. Run `make build` to build the executable for your current platform |
| 95 | + |
| 96 | +## Cross compiling |
| 97 | + |
| 98 | +TODO |
0 commit comments