firefish/packages/backend/src/server/api/mastodon/endpoints/meta.ts
cutestnekoaqua 717aa899b1
feat: v1 Mastodon API
This commit adds (maybe unstable) support for Mastodons v1 api
also some v2 endpoints, maybe I miss stuff, I dont know.
We will need to test this but it should be kinda stable
and work like (old) butter.

Co-authored-by: Natty <natty.sh.git@gmail.com>
Co-authored-by: cutls <web-pro@cutls.com>
2023-02-09 23:21:50 +01:00

98 lines
2.3 KiB
TypeScript

import { Entity } from "@cutls/megalodon";
// TODO: add calckey features
export function getInstance(response: Entity.Instance) {
return {
uri: response.uri,
title: response.title || "",
short_description: response.description || "",
description: response.description || "",
email: response.email || "",
version: "3.0.0 compatible (Calckey)",
urls: response.urls,
stats: response.stats,
thumbnail: response.thumbnail || "",
languages: ["en", "de", "ja"],
registrations: response.registrations,
approval_required: !response.registrations,
invites_enabled: response.registrations,
configuration: {
accounts: {
max_featured_tags: 20,
},
statuses: {
max_characters: 3000,
max_media_attachments: 4,
characters_reserved_per_url: response.uri.length,
},
media_attachments: {
supported_mime_types: [
"image/jpeg",
"image/png",
"image/gif",
"image/heic",
"image/heif",
"image/webp",
"image/avif",
"video/webm",
"video/mp4",
"video/quicktime",
"video/ogg",
"audio/wave",
"audio/wav",
"audio/x-wav",
"audio/x-pn-wave",
"audio/vnd.wave",
"audio/ogg",
"audio/vorbis",
"audio/mpeg",
"audio/mp3",
"audio/webm",
"audio/flac",
"audio/aac",
"audio/m4a",
"audio/x-m4a",
"audio/mp4",
"audio/3gpp",
"video/x-ms-asf",
],
image_size_limit: 10485760,
image_matrix_limit: 16777216,
video_size_limit: 41943040,
video_frame_rate_limit: 60,
video_matrix_limit: 2304000,
},
polls: {
max_options: 8,
max_characters_per_option: 50,
min_expiration: 300,
max_expiration: 2629746,
},
},
contact_account: {
id: "1",
username: "admin",
acct: "admin",
display_name: "admin",
locked: true,
bot: true,
discoverable: false,
group: false,
created_at: "1971-01-01T00:00:00.000Z",
note: "",
url: "https://http.cat/404",
avatar: "https://http.cat/404",
avatar_static: "https://http.cat/404",
header: "https://http.cat/404",
header_static: "https://http.cat/404",
followers_count: -1,
following_count: 0,
statuses_count: 0,
last_status_at: "1971-01-01T00:00:00.000Z",
noindex: true,
emojis: [],
fields: [],
},
rules: [],
};
}