Merge branch 'nip11' into 'main'
Add NIP-11 support See merge request soapbox-pub/ditto!81
This commit is contained in:
commit
5d53224a76
|
@ -10,8 +10,8 @@ const instanceController: AppController = (c) => {
|
||||||
return c.json({
|
return c.json({
|
||||||
uri: host,
|
uri: host,
|
||||||
title: 'Ditto',
|
title: 'Ditto',
|
||||||
description: 'An efficient and flexible social media server.',
|
description: 'Nostr and the Fediverse',
|
||||||
short_description: 'An efficient and flexible social media server.',
|
short_description: 'Nostr and the Fediverse',
|
||||||
registrations: Conf.registrations,
|
registrations: Conf.registrations,
|
||||||
max_toot_chars: Conf.postCharLimit,
|
max_toot_chars: Conf.postCharLimit,
|
||||||
configuration: {
|
configuration: {
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { AppController } from '@/app.ts';
|
||||||
|
import { Conf } from '@/config.ts';
|
||||||
|
|
||||||
|
const relayInfoController: AppController = (c) => {
|
||||||
|
return c.json({
|
||||||
|
name: 'Ditto',
|
||||||
|
description: 'Nostr and the Fediverse.',
|
||||||
|
pubkey: '<administrative contact pubkey>',
|
||||||
|
contact: `mailto:${Conf.adminEmail}`,
|
||||||
|
supported_nips: [1, 5, 9, 11, 45, 46, 98],
|
||||||
|
software: 'Ditto',
|
||||||
|
version: '0.0.0',
|
||||||
|
limitation: {
|
||||||
|
// TODO.
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export { relayInfoController };
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { relayInfoController } from '@/controllers/nostr/relay-info.ts';
|
||||||
import * as eventsDB from '@/db/events.ts';
|
import * as eventsDB from '@/db/events.ts';
|
||||||
import * as pipeline from '@/pipeline.ts';
|
import * as pipeline from '@/pipeline.ts';
|
||||||
import { jsonSchema } from '@/schema.ts';
|
import { jsonSchema } from '@/schema.ts';
|
||||||
|
@ -116,9 +117,14 @@ function prepareFilters(filters: ClientREQ[2][]): Filter[] {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
const relayController: AppController = (c) => {
|
const relayController: AppController = (c, next) => {
|
||||||
const upgrade = c.req.header('upgrade');
|
const upgrade = c.req.header('upgrade');
|
||||||
|
|
||||||
|
// NIP-11: https://github.com/nostr-protocol/nips/blob/master/11.md
|
||||||
|
if (c.req.header('accept') === 'application/nostr+json') {
|
||||||
|
return relayInfoController(c, next);
|
||||||
|
}
|
||||||
|
|
||||||
if (upgrade?.toLowerCase() !== 'websocket') {
|
if (upgrade?.toLowerCase() !== 'websocket') {
|
||||||
return c.text('Please use a Nostr client to connect.', 400);
|
return c.text('Please use a Nostr client to connect.', 400);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ export {
|
||||||
} from 'https://deno.land/x/hono@v3.10.1/mod.ts';
|
} from 'https://deno.land/x/hono@v3.10.1/mod.ts';
|
||||||
export { cors, logger, serveStatic } from 'https://deno.land/x/hono@v3.10.1/middleware.ts';
|
export { cors, logger, serveStatic } from 'https://deno.land/x/hono@v3.10.1/middleware.ts';
|
||||||
export { z } from 'https://deno.land/x/zod@v3.21.4/mod.ts';
|
export { z } from 'https://deno.land/x/zod@v3.21.4/mod.ts';
|
||||||
export { Author, RelayPool } from 'https://dev.jspm.io/nostr-relaypool@0.6.30';
|
export { RelayPool } from 'https://dev.jspm.io/nostr-relaypool@0.6.30';
|
||||||
export {
|
export {
|
||||||
type Event,
|
type Event,
|
||||||
type EventTemplate,
|
type EventTemplate,
|
||||||
|
|
Loading…
Reference in New Issue