diff --git a/routes/.well-known/nodeinfo.js b/routes/.well-known/nodeinfo.js new file mode 100644 index 0000000..2e90670 --- /dev/null +++ b/routes/.well-known/nodeinfo.js @@ -0,0 +1,20 @@ +'use strict'; + +const express = require('express'); + +module.exports = { + /** + * @param {express.IRoute} routeObj + */ + route: (routeObj) => { + routeObj.get(async (req, res, _next) => { + res.json({ + "links": [{ + "rel": "http://nodeinfo.diaspora.software/ns/schema/2.0", + "href": `https://${req.headers.host}/nodeinfo/2.0` + }] + }); + res.end(); + }); + } +}; diff --git a/routes/nodeinfo/2.0.js b/routes/nodeinfo/2.0.js new file mode 100644 index 0000000..9f84284 --- /dev/null +++ b/routes/nodeinfo/2.0.js @@ -0,0 +1,34 @@ +'use strict'; + +const express = require('express'); + +module.exports = { + /** + * @param {express.IRoute} routeObj + */ + route: (routeObj) => { + routeObj.get(async (req, res, _next) => { + res.header("content-type", "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.0#\""); + res.json({ + version: "2.0", + software: { + name: "haxsocial", + // TODO: Include a git depth and revision hash. + version: "0.0.0" + }, + protocols: [ + "activitypub" + ], + services: { + outbound: [], + inbound: [] + }, + usage: { + }, + openRegistrations: false, + metadata: {} + }); + res.end(); + }); + } +};