aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-10-22 09:01:06 +0300
committerGravatar Vitaly Takmazov2024-10-22 09:01:06 +0300
commitd2e3ee78415198b3d73b7907a8a2fdb4d2ce9194 (patch)
treee3eb7442516aa9b77129fdfb9341c8805c9a4d1d
parent7e6601867f08b31cc3ee4373ec748ac1aba2f6cf (diff)
vnext: `/.well-known/nodeinfo` endpoint
-rw-r--r--vnext/server/app.js6
-rw-r--r--vnext/server/middleware/host-meta.js17
2 files changed, 21 insertions, 2 deletions
diff --git a/vnext/server/app.js b/vnext/server/app.js
index f8beb933..223868f1 100644
--- a/vnext/server/app.js
+++ b/vnext/server/app.js
@@ -13,7 +13,7 @@ import { instance } from './middleware/mastodon'
import path from 'path'
import { webhook, webhookPath } from './durov'
import { webfinger } from './middleware/webfinger'
-import { jsonMeta, xmlMeta } from './middleware/host-meta'
+import { jsonMeta, nodeinfo, xmlMeta } from './middleware/host-meta'
// initialize the application and create the routes
export const app = express()
@@ -35,6 +35,10 @@ router.get('/.well-known/host-meta.json', jsonMeta)
router.get('/.well-known/webfinger', webfinger)
+// Nodeinfo
+
+router.get('/.well-known/nodeinfo', nodeinfo)
+
// Mastodon API
router.get('/api/v2/instance', instance)
diff --git a/vnext/server/middleware/host-meta.js b/vnext/server/middleware/host-meta.js
index eec7d3e3..fe6ca631 100644
--- a/vnext/server/middleware/host-meta.js
+++ b/vnext/server/middleware/host-meta.js
@@ -15,7 +15,7 @@ export const xmlMeta = async (_req, res) => {
}
/**
- * host-meta endpoint
+ * host-meta.json endpoint
* @type {import('express').RequestParamHandler}
*/
export const jsonMeta = async (_req, res) => {
@@ -28,3 +28,18 @@ export const jsonMeta = async (_req, res) => {
]
})
}
+
+/**
+ * nodeinfo endpoint
+ * @type {import('express').RequestParamHandler}
+ */
+export const nodeinfo = async (_req, res) => {
+ return res.json({
+ 'links': [
+ {
+ 'rel': 'https://nodeinfo.diaspora.software/ns/schema/2.0',
+ 'href': `${baseURL}/.well-known/nodeinfo/2.0`
+ }
+ ]
+ })
+}