Add nodeinfo

This commit is contained in:
Alex Gleason
2023-07-09 20:32:45 -05:00
parent 8894bb5513
commit 8fa6ac0a4c
2 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
import { Conf } from '@/config.ts';
import type { AppController } from '@/app.ts';
const nodeInfoController: AppController = (c) => {
return c.json({
links: [
{
rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0',
href: Conf.local('/nodeinfo/2.0'),
},
{
rel: 'http://nodeinfo.diaspora.software/ns/schema/2.1',
href: Conf.local('/nodeinfo/2.1'),
},
],
});
};
const nodeInfoSchemaController: AppController = (c) => {
return c.json({
version: '2.1',
software: {
name: 'ditto',
version: '0.0.0',
repository: 'https://gitlab.com/soapbox-pub/ditto',
homepage: 'https://soapbox.pub',
},
protocols: [
'activitypub',
],
services: {
inbound: [],
outbound: [],
},
openRegistrations: false,
usage: {
users: {
total: 0,
activeMonth: 0,
activeHalfyear: 0,
},
localPosts: 0,
localComments: 0,
},
metadata: {
features: [
'nip05',
'nostr_bridge',
],
},
});
};
export { nodeInfoController, nodeInfoSchemaController };