Simple WebFinger server that returns static resources. Written with Python and FastAPI.
Go to file
2022-12-10 04:23:08 -06:00
bin move to better packaging practices 2022-12-07 23:40:51 -06:00
webfinger Cleanup 2022-12-10 04:23:08 -06:00
.editorconfig move to better packaging practices 2022-12-07 23:40:51 -06:00
.gitignore move to better packaging practices 2022-12-07 23:40:51 -06:00
pdm.lock move to better packaging practices 2022-12-07 23:40:51 -06:00
pyproject.toml WIP: Add OpenAPI documentation 2022-12-10 03:04:28 -06:00
README.md WIP: Add OpenAPI documentation 2022-12-10 03:04:28 -06:00
requirements.txt move to better packaging practices 2022-12-07 23:40:51 -06:00

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

{
	"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