add nodeinfo support

This commit is contained in:
Will Murphy 2022-05-01 15:09:23 -05:00
parent b5c9246807
commit a56fd5221e

View file

@ -9,6 +9,7 @@ const history = require('connect-history-api-fallback')
const { onShutdown } = require('node-graceful-shutdown') const { onShutdown } = require('node-graceful-shutdown')
const ActivitypubExpress = require('activitypub-express') const ActivitypubExpress = require('activitypub-express')
const { version } = require('./package.json')
const { DOMAIN, KEY_PATH, CERT_PATH, CA_PATH, PORT_HTTPS, DB_URL, DB_NAME } = process.env const { DOMAIN, KEY_PATH, CERT_PATH, CA_PATH, PORT_HTTPS, DB_URL, DB_NAME } = process.env
const app = express() const app = express()
@ -41,6 +42,8 @@ const routes = {
likes: '/s/:id/likes' likes: '/s/:id/likes'
} }
const apex = ActivitypubExpress({ const apex = ActivitypubExpress({
name: 'Guppe Groups',
version,
domain: DOMAIN, domain: DOMAIN,
actorParam: 'actor', actorParam: 'actor',
objectParam: 'id', objectParam: 'id',
@ -93,6 +96,8 @@ app.get(
apex.net.validators.targetActor, apex.net.validators.targetActor,
apex.net.wellKnown.respondWebfinger apex.net.wellKnown.respondWebfinger
) )
app.get('/.well-known/nodeinfo', apex.net.nodeInfoLocation.get)
app.get('/nodeinfo/:version', apex.net.nodeInfo.get)
app.on('apex-inbox', async ({ actor, activity, recipient, object }) => { app.on('apex-inbox', async ({ actor, activity, recipient, object }) => {
switch (activity.type.toLowerCase()) { switch (activity.type.toLowerCase()) {