From 3b3bd68645754669c4acecb9050833b87b2955b4 Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 9 Oct 2024 17:18:38 +0100 Subject: [PATCH] use injected meta in MastodonApiServerService --- .../src/server/api/mastodon/MastodonApiServerService.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts index 8c9cca1730..6577d5ba1b 100644 --- a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts +++ b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts @@ -8,11 +8,10 @@ import megalodon, { Entity, MegalodonInterface } from 'megalodon'; import querystring from 'querystring'; import { IsNull } from 'typeorm'; import multer from 'fastify-multer'; -import type { AccessTokensRepository, NoteEditRepository, NotesRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js'; +import type { AccessTokensRepository, NoteEditRepository, NotesRepository, UserProfilesRepository, UsersRepository, MiMeta } from '@/models/_.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; import type { Config } from '@/config.js'; -import { MetaService } from '@/core/MetaService.js'; import { convertAnnouncement, convertFilter, convertAttachment, convertFeaturedTag, convertList, MastoConverters } from './converters.js'; import { getInstance } from './endpoints/meta.js'; import { ApiAuthMastodon, ApiAccountMastodon, ApiFilterMastodon, ApiNotifyMastodon, ApiSearchMastodon, ApiTimelineMastodon, ApiStatusMastodon } from './endpoints.js'; @@ -31,6 +30,8 @@ export function getClient(BASE_URL: string, authorization: string | undefined): @Injectable() export class MastodonApiServerService { constructor( + @Inject(DI.meta) + private serverSettings: MiMeta, @Inject(DI.usersRepository) private usersRepository: UsersRepository, @Inject(DI.notesRepository) @@ -112,7 +113,7 @@ export class MastodonApiServerService { order: { id: 'ASC' }, }); const contact = admin == null ? null : await this.mastoConverter.convertAccount((await client.getAccount(admin.id)).data); - reply.send(await getInstance(data.data, contact as Entity.Account, this.config, await this.metaService.fetch())); + reply.send(await getInstance(data.data, contact as Entity.Account, this.config, this.serverSettings)); } catch (e: any) { /* console.error(e); */ reply.code(401).send(e.response.data);