Compare commits

...

14 commits

Author SHA1 Message Date
April John
d81412e84e say no pub timeline 2023-09-04 20:18:21 +02:00
April John
4e9959bd73 recommended timeline akkoma 2023-09-04 20:02:20 +02:00
April John
e482db3f33 can we change this? 2023-09-04 19:53:31 +02:00
April John
4afc2eb950 omg 2023-09-04 19:33:47 +02:00
April John
053b5bdb27 i love free software 2023-09-04 19:11:16 +02:00
April John
d2c5ada55d curse 2023-09-04 19:06:24 +02:00
April John
8fe7709f29 aww 2023-09-04 18:56:16 +02:00
April John
08c7e52596 aaaa 2023-09-04 18:47:37 +02:00
April John
2c935fe9db fix format 2023-09-04 18:43:03 +02:00
April John
20a48cabd0 stop it from being cached 2023-09-04 18:38:55 +02:00
April John
8e7c6526e1 is this the proper way? 2023-09-04 18:28:18 +02:00
April John
8a088b8d74 [AkkomaFE] Ship Mastodon instance with nodeinfo 2023-09-04 18:10:54 +02:00
April John
f967da4dda [AkkomaAPI] Add endpoint /nodeinfo/2.0.json 2023-09-04 17:55:17 +02:00
April John
e17691df43 [MastodonAPI] add Pleroma stuff to api/v1/instance
Pleroma has custom fields which we added to allow
compatibility with AkkomaFE

Co-authored-by: Legion Orsetti <fwam@users.noreply.github.com>
2023-09-04 17:04:34 +02:00
3 changed files with 101 additions and 3 deletions

View file

@ -37,7 +37,41 @@ export async function getInstance(
languages: meta.langs, languages: meta.langs,
registrations: !meta.disableRegistration || response.registrations, registrations: !meta.disableRegistration || response.registrations,
approval_required: !response.registrations, approval_required: !response.registrations,
invites_enabled: response.registrations, invites_enabled: response.registrations,
pleroma : {
metadata: {
account_activation_required: !response.registrations,
birthday_min_age: 0,
birthday_required: false,
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"
]
},
stats: {
mau: 1,
},
vapid_public_key: meta.swPublicKey ? meta.swPublicKey : "",
},
configuration: { configuration: {
accounts: { accounts: {
max_featured_tags: 20, max_featured_tags: 20,

View file

@ -24,7 +24,7 @@ import * as Acct from "@/misc/acct.js";
import { envOption } from "@/env.js"; import { envOption } from "@/env.js";
import megalodon, { MegalodonInterface } from "megalodon"; import megalodon, { MegalodonInterface } from "megalodon";
import activityPub from "./activitypub.js"; import activityPub from "./activitypub.js";
import nodeinfo from "./nodeinfo.js"; import nodeinfo, { nodeinfo2 } from "./nodeinfo.js";
import wellKnown from "./well-known.js"; import wellKnown from "./well-known.js";
import apiServer from "./api/index.js"; import apiServer from "./api/index.js";
import fileServer from "./file/index.js"; import fileServer from "./file/index.js";
@ -34,6 +34,7 @@ import { initializeStreamingServer } from "./api/streaming.js";
import { koaBody } from "koa-body"; import { koaBody } from "koa-body";
import removeTrailingSlash from "koa-remove-trailing-slashes"; import removeTrailingSlash from "koa-remove-trailing-slashes";
import { v4 as uuid } from "uuid"; import { v4 as uuid } from "uuid";
import { Cache } from "@/misc/cache.js";
export const serverLogger = new Logger("server", "gray", false); export const serverLogger = new Logger("server", "gray", false);
@ -149,6 +150,24 @@ mastoRouter.get("/oauth/authorize", async (ctx) => {
); );
}); });
const cache = new Cache<Awaited<ReturnType<typeof nodeinfo2>>>(
"nodeinfo",
60 * 10,
);
mastoRouter.get("/nodeinfo/2.0.json", async (ctx) => {
const base = await cache.fetch(null, () => nodeinfo2());
// @ts-ignore
base.software.repository = undefined;
ctx.body = {
version: "2.0",
...base };
ctx.set("Cache-Control", "public, max-age=600");
});
mastoRouter.post("/oauth/token", async (ctx) => { mastoRouter.post("/oauth/token", async (ctx) => {
const body: any = ctx.request.body || ctx.request.query; const body: any = ctx.request.body || ctx.request.query;
console.log("token-request", body); console.log("token-request", body);

View file

@ -23,7 +23,7 @@ export const links = [
}, },
]; ];
const nodeinfo2 = async () => { export const nodeinfo2 = async () => {
const now = Date.now(); const now = Date.now();
const [meta, total, activeHalfyear, activeMonth, localPosts] = const [meta, total, activeHalfyear, activeMonth, localPosts] =
await Promise.all([ await Promise.all([
@ -96,6 +96,51 @@ const nodeinfo2 = async () => {
enableServiceWorker: meta.enableServiceWorker, enableServiceWorker: meta.enableServiceWorker,
proxyAccountName: proxyAccount ? proxyAccount.username : null, proxyAccountName: proxyAccount ? proxyAccount.username : null,
themeColor: meta.themeColor || "#31748f", 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: false,
federated: false,
bubble: false,
},
uploadLimits: {
background: 40000000,
avatar: 40000000,
banner: 40000000,
general: 40000000,
},
suggestions: {
enabled: false
},
staffAccounts: [
"https://fedi.afra.berlin/@april"
],
localBubbleInstances: [
"mk.absturztau.be"
]
}, },
}; };
}; };