merge: Restore activeHalfyear and activeMonth nodeinfo (!861)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/861

Approved-by: Marie <github@yuugi.dev>
Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
dakkar 2025-09-13 15:33:18 +00:00
commit 57450fd8b8

View file

@ -4,7 +4,9 @@
*/
import { Inject, Injectable } from '@nestjs/common';
import { IsNull, MoreThan } from 'typeorm';
import { DI } from '@/di-symbols.js';
import type { UsersRepository } from '@/models/_.js';
import type { Config } from '@/config.js';
import { MetaService } from '@/core/MetaService.js';
import { MemorySingleCache } from '@/misc/cache.js';
@ -25,6 +27,9 @@ export class NodeinfoServerService {
@Inject(DI.config)
private config: Config,
@Inject(DI.usersRepository)
private usersRepository: UsersRepository,
private systemAccountService: SystemAccountService,
private metaService: MetaService,
private notesChart: NotesChart,
@ -57,18 +62,15 @@ export class NodeinfoServerService {
const [
meta,
//activeHalfyear,
//activeMonth,
activeHalfyear,
activeMonth,
] = 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.usersRepository.count({ where: { host: IsNull(), isBot: false, lastActiveDate: MoreThan(new Date(now - 15552000000)) } }),
this.usersRepository.count({ where: { host: IsNull(), isBot: false, lastActiveDate: MoreThan(new Date(now - 2592000000)) } }),
]);
const activeHalfyear = null;
const activeMonth = null;
const proxyAccount = await this.systemAccountService.fetch('proxy');
const basePolicies = { ...DEFAULT_POLICIES, ...meta.policies };