Merge pull request 'restore activeHalfYear and activeMonth' (#10) from develop into master
All checks were successful
Lint / pnpm_install (push) Successful in 1m47s
Publish Docker image / Build (push) Successful in 4m54s
Test (production install and build) / production (20.16.0) (push) Successful in 1m11s
Test (backend) / unit (20.16.0) (push) Successful in 7m17s
Lint / lint (backend) (push) Successful in 2m23s
Lint / lint (frontend) (push) Successful in 2m22s
Lint / lint (frontend-embed) (push) Successful in 2m16s
Lint / lint (frontend-shared) (push) Successful in 2m22s
Test (backend) / e2e (20.16.0) (push) Successful in 10m49s
Lint / lint (misskey-bubble-game) (push) Successful in 2m26s
Lint / lint (misskey-js) (push) Successful in 2m19s
Lint / lint (misskey-reversi) (push) Successful in 2m21s
Lint / lint (sw) (push) Successful in 2m37s
Lint / typecheck (misskey-js) (push) Successful in 1m28s
Lint / typecheck (backend) (push) Successful in 2m13s
Lint / typecheck (sw) (push) Successful in 1m26s

Reviewed-on: #10
This commit is contained in:
ゆめ 2024-11-10 03:34:35 -06:00
commit 24b6849ad1

View file

@ -15,6 +15,8 @@ import NotesChart from '@/core/chart/charts/notes.js';
import UsersChart from '@/core/chart/charts/users.js'; import UsersChart from '@/core/chart/charts/users.js';
import { DEFAULT_POLICIES } from '@/core/RoleService.js'; import { DEFAULT_POLICIES } from '@/core/RoleService.js';
import type { FastifyInstance, FastifyPluginOptions } from 'fastify'; import type { FastifyInstance, FastifyPluginOptions } from 'fastify';
import { IsNull, MoreThan } from 'typeorm';
import type { UsersRepository } from '@/models/_.js';
const nodeinfo2_1path = '/nodeinfo/2.1'; const nodeinfo2_1path = '/nodeinfo/2.1';
const nodeinfo2_0path = '/nodeinfo/2.0'; const nodeinfo2_0path = '/nodeinfo/2.0';
@ -25,6 +27,8 @@ export class NodeinfoServerService {
constructor( constructor(
@Inject(DI.config) @Inject(DI.config)
private config: Config, private config: Config,
@Inject(DI.usersRepository)
private usersRepository: UsersRepository,
private userEntityService: UserEntityService, private userEntityService: UserEntityService,
private metaService: MetaService, private metaService: MetaService,
@ -58,18 +62,14 @@ export class NodeinfoServerService {
const [ const [
meta, meta,
//activeHalfyear, activeHalfyear,
//activeMonth, activeMonth,
] = await Promise.all([ ] = await Promise.all([
this.metaService.fetch(true), 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 - 15552000000)) } }), this.usersRepository.count({ where: { host: IsNull(), lastActiveDate: MoreThan(new Date(now - 2592000000)) } }),
//this.usersRepository.count({ where: { host: IsNull(), lastActiveDate: MoreThan(new Date(now - 2592000000)) } }),
]); ]);
const activeHalfyear = null;
const activeMonth = null;
const proxyAccount = meta.proxyAccountId ? await this.userEntityService.pack(meta.proxyAccountId).catch(() => null) : null; const proxyAccount = meta.proxyAccountId ? await this.userEntityService.pack(meta.proxyAccountId).catch(() => null) : null;
const basePolicies = { ...DEFAULT_POLICIES, ...meta.policies }; const basePolicies = { ...DEFAULT_POLICIES, ...meta.policies };