webfinger/README.md

60 lines
1.4 KiB
Markdown
Raw Normal View History

# webfinger
2022-11-20 09:37:34 +00:00
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
2022-11-20 09:37:34 +00:00
```bash
pdm install
pdm run uvicorn webfinger:app --port 7033
2022-11-20 09:37:34 +00:00
```
#### ...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