From 8e7c6526e16881aee6e0d5025546f47c390eb98a Mon Sep 17 00:00:00 2001 From: April John Date: Mon, 4 Sep 2023 18:28:18 +0200 Subject: [PATCH] is this the proper way? --- packages/backend/src/server/index.ts | 25 +++----------------- packages/backend/src/server/nodeinfo.ts | 31 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index 251830823..9259ef73a 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -35,9 +35,6 @@ import { koaBody } from "koa-body"; import removeTrailingSlash from "koa-remove-trailing-slashes"; import { v4 as uuid } from "uuid"; import { Cache } from "@/misc/cache.js"; -import { getInstance } from "./api/mastodon/endpoints/meta.js"; -import { convertAccount } from "./api/mastodon/converters.js"; -import { getClient } from "./api/mastodon/ApiMastodonCompatibleService.js"; export const serverLogger = new Logger("server", "gray", false); @@ -161,29 +158,13 @@ const cache = new Cache>>( mastoRouter.get("/nodeinfo/2.0.json", async (ctx) => { const base = await cache.fetch(null, () => nodeinfo2()); - const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; - const accessTokens = ctx.request.headers.authorization; - const client = getClient(BASE_URL, accessTokens); - const data = await client.getInstance(); - const admin = await Users.findOne({ - where: { - host: IsNull(), - isAdmin: true, - isDeleted: false, - isSuspended: false, - }, - order: { id: "ASC" }, - }); - const contact = - admin == null - ? null - : convertAccount((await client.getAccount(admin.id)).data); - const masto = { ...getInstance(data.data, contact), ...base }; // @ts-ignore base.software.repository = undefined; - ctx.body = { version: "2.0", ...masto }; + ctx.body = { + version: "2.0", + ...base }; ctx.set("Cache-Control", "public, max-age=600"); }); diff --git a/packages/backend/src/server/nodeinfo.ts b/packages/backend/src/server/nodeinfo.ts index 9cf3ab636..43601c468 100644 --- a/packages/backend/src/server/nodeinfo.ts +++ b/packages/backend/src/server/nodeinfo.ts @@ -96,6 +96,37 @@ export const nodeinfo2 = async () => { enableServiceWorker: meta.enableServiceWorker, proxyAccountName: proxyAccount ? proxyAccount.username : null, themeColor: meta.themeColor || "#31748f", + + //Akkoma + features: [ + "mastodon_api", + "mastodon_api_float", + "polls", + "relay", + "quote_posting", + "pleroma_emoji_reactions", + "pleroma_chat_messages", + "exposable_reactions", + "profile_directory" + ], + federation: { + enabled : true + }, + fields_limits: { + max_fields: 10, + max_remote_fields: 20, + name_length: 512, + value_length: 2048 + }, + post_formats: [ + "text/x.misskeymarkdown" + ], + publicTimelineVisibility: { + local: true, + federated: false, + bubble: false, + }, + }, }; };