add plc directories collection

This commit is contained in:
tree 2023-06-29 05:25:10 +02:00
rodič 25c5333eb8
revize 51b39c9aee
4 změnil soubory, kde provedl 21 přidání a 1 odebrání

Zobrazit soubor

@ -0,0 +1,3 @@
name: Bluesky PLC Directory
url: https://plc.directory
federation: bluesky

Zobrazit soubor

@ -0,0 +1,3 @@
name: Sandbox PLC Directory
url: https://plc.bsky-sandbox.dev
federation: sandbox

13
schema/plc-directory.yaml Normal file
Zobrazit soubor

@ -0,0 +1,13 @@
type: object
additionalProperties: false
properties:
id:
type: string
pattern: '^[a-z0-9-]+$'
name:
type: string
url:
type: string
format: url
federation:
type: string

Zobrazit soubor

@ -7,6 +7,7 @@ const SCHEMA_PATH = "./schema";
const SCHEMA_MAP = {
clients: "client",
federations: "federation",
'plc-directories': 'plc-directory',
};
async function loadYAML(fn) {
@ -51,7 +52,7 @@ export class Engine {
async schemas() {
if (Object.keys(this.schemasData).length === 0) {
for await (const sf of Deno.readDir(SCHEMA_PATH)) {
const name = sf.name.match(/^(\w+)\./)[1];
const name = sf.name.match(/^([\w-]+)\./)[1];
const schema = await loadYAML(join(SCHEMA_PATH, sf.name));
this.schemasData[name] = schema;
}