|
||
---|---|---|
bin | ||
webfinger | ||
.editorconfig | ||
.gitignore | ||
pdm.lock | ||
pyproject.toml | ||
README.md | ||
requirements.txt |
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
andaliases
andproperties
will be served normally.
- Currently, the "subject" will be ignored (as the
Example acct:a@trwnh.com.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
pdm install
pdm run uvicorn webfinger:app --port 7033
...with virtualenv
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