diff --git a/README.md b/README.md index e08e49f..ffd30c6 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,15 @@ Simple WebFinger server that returns static resources. Written with Python and F ## Deployment -### Add static resources +### Add static resources as a quickstart - Create a `resource/` folder. This will map to the `?resource=` query parameter. - Put a .jrd file in there; anything before the .jrd 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. -- Symlinks will be resolved as well. Try using a URI as a symlink and put it in `aliases` too! +- Symlinks will be resolved as well. Try using a URI as a symlink and maybe put it in `aliases` too! -Example `acct:a@trwnh.com.jrd` +Example `resource/acct:a@trwnh.com.jrd` ```json { @@ -33,6 +33,13 @@ Example `acct:a@trwnh.com.jrd` } ``` +If your resource URI has slashes in it and would therefore be an invalid UNIX path, it must be percent-encoded. For example, to have the WebFinger server respond to a lookup for `?resource=https://trwnh.com/~a`, you can create a symlink with the path `resource/https%3A%2F%2Ftrwnh.com%2F~a.jrd` like so: + +```sh +cd resource +ln -s "acct:a@trwnh.com" "https%3A%2F%2Ftrwnh.com%2F~a.jrd" +``` + ### Running the server Environment variables you may use: diff --git a/webfinger/lookup.py b/webfinger/lookup.py index 6bbbcfd..67925c3 100644 --- a/webfinger/lookup.py +++ b/webfinger/lookup.py @@ -48,7 +48,7 @@ class JRD(BaseModel): schema_extra = { "example": r'''{ "subject": "acct:a@trwnh.com", - "aliases": ["https://trwnh.com/actors/7057bc10-db1c-4ebe-9e00-22cf04be4e5e", "https://trwnh.com/~a", "acct:trwnh@trwnh.com"], + "aliases": ["https://ap.trwnh.com/actors/7057bc10-db1c-4ebe-9e00-22cf04be4e5e", "https://trwnh.com/~a", "acct:trwnh@ap.trwnh.com"], "links": [ { "rel": "self",