nip11: "virtual_paths"

This commit is contained in:
fiatjaf 2024-04-25 11:56:08 -03:00
parent 6071f3489e
commit 981ca17aea

24
11.md
View File

@ -60,6 +60,30 @@ The relay MAY choose to publish its software version as a string attribute. The
Extra Fields Extra Fields
------------ ------------
### Virtual Relays
Some relays want to expose "virtual" addresses to the same underlying dataset or other types of weird functionality. A basic example is a relay that may serve all notes under its `/` path, but only Italian notes under its `/it` path and only Japanese notes under its `/jp` path. In this case clients may use the virtual (`/jp` etc) paths when browsing the relay, for example; but in other situations, like when selecting relays for building a feed for some specific profile, clients should just want to connect to `/`.
```json
{
"virtual_path": {
"is": true,
"canonical": "/",
"alternatives": [
{"path": "/jp", "description": "only stuff in Japanese"},
{"path": "/it", "description": "only stuff in Italian"},
{"path": "/fr", "description": "whatever"},
{"path": "/pt", "description": "blergh"}
]
},
...
}
```
- `is`: this is `true` when the current path queried is a virtual path.
- `canonical`: this is the path that should be used when the client doesn't care about the virtual.
- `alternatives`: optionally, if a relay wants to announce its virtual paths, this may be useful sometimes.
### Server Limitations ### Server Limitations
These are limitations imposed by the relay on clients. Your client These are limitations imposed by the relay on clients. Your client