41 lines
1.9 KiB
Markdown
41 lines
1.9 KiB
Markdown
# Drop In URL previews server
|
|
|
|
A simple python server that handles /_matrix/media/*/preview_url requests, for servers like Dendrite.
|
|
|
|
## Installation
|
|
Just use docker.
|
|
|
|
Or you can run it yourself, but that's your choice.
|
|
```bash
|
|
pip install -r requirements.txt
|
|
PREVIEW_HOMESERVER=https://example.com python3 server.py
|
|
```
|
|
|
|
### Example docker-compose.yml
|
|
```yaml
|
|
version: "3"
|
|
services:
|
|
url_previews:
|
|
environment:
|
|
- "PREVIEW_HOMESERVER=https://matrix.nexy7574.co.uk"
|
|
- "FORWARDED_ALLOW_IPS=*"
|
|
ports:
|
|
- "2226:2226"
|
|
restart: "unless-stopped"
|
|
container_name: "dendrite-url-previews"
|
|
volumes:
|
|
- url_previews:/app/data/
|
|
build: . # there's no pre-built image
|
|
|
|
volumes:
|
|
url_previews:
|
|
```
|
|
|
|
## Configuration
|
|
|
|
| Environment Variable | Description | Example | Default |
|
|
|-----------------------|----------------------------------------------------------------------------------------------------|---------------------------------|-----------------------------------|
|
|
| `PREVIEW_HOMESERVER` | The homeserver to use for the previews. | `https://matrix.nexy7574.co.uk` | The host name of the request URL. |
|
|
| `PREVIEW_HOST` | The host IP/Name to listen to. | `192.168.0.2` | `0.0.0.0` |
|
|
| `PREVIEW_PORT` | The port to listen to. | `8080` | `2226` |
|
|
| `FORWARDED_ALLOW_IPS` | The list of reverse proxy IPs to trust. See [Uvicorn docs](https://www.uvicorn.org/settings/#http) | `*` | `127.0.0.1` |
|