diff --git a/packages/backend/src/server/NodeinfoServerService.ts b/packages/backend/src/server/NodeinfoServerService.ts index ab073c270f..126df4650c 100644 --- a/packages/backend/src/server/NodeinfoServerService.ts +++ b/packages/backend/src/server/NodeinfoServerService.ts @@ -15,8 +15,8 @@ import NotesChart from '@/core/chart/charts/notes.js'; import UsersChart from '@/core/chart/charts/users.js'; import { DEFAULT_POLICIES } from '@/core/RoleService.js'; import type { FastifyInstance, FastifyPluginOptions } from 'fastify'; -import { IsNull, MoreThan } from 'typeorm'; -import type { UsersRepository } from '@/models/_.js'; +import { IsNull, MoreThan, Not } from 'typeorm'; +import type { NotesRepository, UsersRepository } from '@/models/_.js'; const nodeinfo2_1path = '/nodeinfo/2.1'; const nodeinfo2_0path = '/nodeinfo/2.0'; @@ -29,6 +29,8 @@ export class NodeinfoServerService { private config: Config, @Inject(DI.usersRepository) private usersRepository: UsersRepository, + @Inject(DI.notesRepository) + private notesRepository: NotesRepository, private userEntityService: UserEntityService, private metaService: MetaService, @@ -64,10 +66,12 @@ export class NodeinfoServerService { meta, activeHalfyear, activeMonth, + localComments, ] = await Promise.all([ this.metaService.fetch(true), this.usersRepository.count({ where: { host: IsNull(), lastActiveDate: MoreThan(new Date(now - 15552000000)) } }), this.usersRepository.count({ where: { host: IsNull(), lastActiveDate: MoreThan(new Date(now - 2592000000)) } }), + this.notesRepository.count({ where: { userHost: IsNull(), replyId: Not(IsNull()) } }), ]); const proxyAccount = meta.proxyAccountId ? await this.userEntityService.pack(meta.proxyAccountId).catch(() => null) : null; @@ -91,7 +95,7 @@ export class NodeinfoServerService { usage: { users: { total, activeHalfyear, activeMonth }, localPosts, - localComments: 0, + localComments, }, metadata: { nodeName: meta.name,