2022-02-13 22:30:56 +01:00
|
|
|
# Screenshot service
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
- `Xvfb`
|
|
|
|
- `fluxbox`
|
|
|
|
- `firefox-beta`
|
|
|
|
|
2022-02-24 00:24:13 +01:00
|
|
|
## Building
|
|
|
|
|
|
|
|
```sh
|
2022-04-24 19:57:01 +02:00
|
|
|
docker image build -t headless-fox Docker
|
2022-02-24 00:24:13 +01:00
|
|
|
```
|
|
|
|
|
2022-04-24 18:47:08 +02:00
|
|
|
## Running the server
|
|
|
|
|
|
|
|
```
|
2022-06-15 20:27:15 +02:00
|
|
|
npm start
|
2022-02-24 00:24:13 +01:00
|
|
|
```
|
2022-05-05 21:54:34 +02:00
|
|
|
|
2022-06-15 20:27:15 +02:00
|
|
|
Visit localhost:3000 to see the test form
|
|
|
|
|
2022-05-28 12:54:53 +02:00
|
|
|
To set up a systemd daemon that starts with the server, use:
|
|
|
|
|
|
|
|
```
|
|
|
|
npm run install-daemon
|
|
|
|
```
|
|
|
|
|
2022-05-05 21:54:34 +02:00
|
|
|
## Testing the API
|
|
|
|
|
|
|
|
with httpie:
|
|
|
|
|
|
|
|
```
|
2022-05-05 22:06:39 +02:00
|
|
|
http POST localhost:3000/api/requests url==pearson.com 'domains[]==youtube.com' 'domains[]==google.com'
|
2022-05-05 21:54:34 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
It returns a 303 response that redirects to a URL you can poll to see the status of the screenshot request.
|