summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json2
-rw-r--r--src/routes/activitypub.ts55
2 files changed, 56 insertions, 1 deletions
diff --git a/package.json b/package.json
index 60fa957..92c6f34 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gathio",
- "version": "1.3.0",
+ "version": "1.3.1",
"description": "",
"main": "index.js",
"type": "module",
diff --git a/src/routes/activitypub.ts b/src/routes/activitypub.ts
index 2b8fb4a..667a44f 100644
--- a/src/routes/activitypub.ts
+++ b/src/routes/activitypub.ts
@@ -84,6 +84,61 @@ router.get("/:eventID/m/:hash", async (req: Request, res: Response) => {
}
});
+router.get("/.well-known/nodeinfo", (req, res) => {
+ if (!config.general.is_federated) {
+ return res.status(404).render("404", frontendConfig());
+ }
+ const nodeInfo = {
+ links: [
+ {
+ rel: "http://nodeinfo.diaspora.software/ns/schema/2.2",
+ href: `https://${config.general.domain}/.well-known/nodeinfo/2.2`,
+ },
+ ],
+ };
+ res.header(
+ "Content-Type",
+ 'application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"',
+ ).send(nodeInfo);
+});
+
+router.get("/.well-known/nodeinfo/2.2", async (req, res) => {
+ const eventCount = await Event.countDocuments();
+
+ if (!config.general.is_federated) {
+ return res.status(404).render("404", frontendConfig());
+ }
+ const nodeInfo = {
+ version: "2.2",
+ instance: {
+ name: config.general.site_name,
+ description:
+ "Federated, no-registration, privacy-respecting event hosting.",
+ },
+ software: {
+ name: "Gathio",
+ version: process.env.npm_package_version || "unknown",
+ repository: "https://github.com/lowercasename/gathio",
+ homepage: "https://gath.io",
+ },
+ protocols: ["activitypub"],
+ services: {
+ inbound: [],
+ outbound: [],
+ },
+ openRegistrations: true,
+ usage: {
+ users: {
+ total: eventCount,
+ },
+ },
+ };
+ res.header(
+ "Content-Type",
+ 'application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"',
+ ).send(nodeInfo);
+});
+
router.get("/.well-known/webfinger", async (req, res) => {
let resource = req.query.resource as string;
if (!resource || !resource.includes("acct:")) {