From 981ca17aea65194b8bee419fc818ae1a54f68340 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 25 Apr 2024 11:56:08 -0300 Subject: [PATCH] nip11: "virtual_paths" --- 11.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/11.md b/11.md index a50038a0..07d489af 100644 --- a/11.md +++ b/11.md @@ -60,6 +60,30 @@ The relay MAY choose to publish its software version as a string attribute. The 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 These are limitations imposed by the relay on clients. Your client