webfinger/README.md
2022-12-10 19:34:30 -06:00

63 lines
1.5 KiB
Markdown

# webfinger
Simple WebFinger server that returns static resources. Written with Python and FastAPI.
## Deployment
### Add static resources
- Create a `resource/` folder. This will map to the `?resource=` query parameter.
- Put a .json file in there; anything before the .json will be served via that `resource` query parameter.
- Currently, the "subject" will be ignored (as the `resource` will be used directly).
- Otherwise, `links` and `aliases` and `properties` will be served normally.
Example `acct:a@trwnh.com.json`
```json
{
"subject": "acct:a@trwnh.com",
"aliases": ["https://trwnh.com/actors/7057bc10-db1c-4ebe-9e00-22cf04be4e5e", "https://trwnh.com/~a"],
"links": [
{
"rel": "self",
"type": "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"",
"href": "https://trwnh.com/actors/7057bc10-db1c-4ebe-9e00-22cf04be4e5e"
},
{
"rel": "https://webfinger.net/rel/profile-page/",
"type": "text/html",
"href": "https://trwnh.com/~a"
}
]
}
```
### Running the server
Environment variables you may use:
- `RESOURCE_DIR`: specify the directory from which resources will be served
#### ...with PDM
```bash
pdm install
pdm run uvicorn webfinger:app --port 7033
```
#### ...with virtualenv
```bash
virtualenv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn webfinger:app --port 7033
```
### Post-run
proxy `/.well-known/webfinger` to localhost:7033
## Development
`pdm run uvicorn webfinger:app --reload`