Add basic nodeinfo.

This commit is contained in:
Andrew Pietila 2023-04-12 00:06:39 -05:00
parent 340244cdab
commit d90c8ded64
2 changed files with 54 additions and 0 deletions

View file

@ -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();
});
}
};

34
routes/nodeinfo/2.0.js Normal file
View file

@ -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();
});
}
};