Merge commit 'refs/pull/11342/head' of https://github.com/misskey-dev/misskey into develop

This commit is contained in:
NoriDev 2023-08-02 16:33:38 +09:00
commit dedfc7a35e
2 changed files with 14 additions and 0 deletions

View file

@ -375,6 +375,7 @@ import * as ep___fetchRss from './endpoints/fetch-rss.js';
import * as ep___retention from './endpoints/retention.js';
import { GetterService } from './GetterService.js';
import { ApiLoggerService } from './ApiLoggerService.js';
import { ServerStatsService } from '@/daemons/ServerStatsService.js';
import type { Provider } from '@nestjs/common';
const $admin_meta: Provider = { provide: 'ep:admin/meta', useClass: ep___admin_meta.default };
@ -752,6 +753,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
providers: [
GetterService,
ApiLoggerService,
ServerStatsService,
$admin_meta,
$admin_abuseUserReports,
$admin_accounts_create,

View file

@ -4,12 +4,14 @@
*/
import { Inject, Injectable } from '@nestjs/common';
import { ModuleRef } from '@nestjs/core';
import { DataSource } from 'typeorm';
import type { Meta } from '@/models/entities/Meta.js';
import { ModerationLogService } from '@/core/ModerationLogService.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { DI } from '@/di-symbols.js';
import { MetaService } from '@/core/MetaService.js';
import { ServerStatsService } from '@/daemons/ServerStatsService.js';
export const meta = {
tags: ['admin'],
@ -133,6 +135,8 @@ export const paramDef = {
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private moduleRef: ModuleRef,
@Inject(DI.db)
private db: DataSource,
@ -528,6 +532,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
await this.metaService.update(set);
this.moderationLogService.insertModerationLog(me, 'updateMeta');
if (set.enableServerMachineStats === true) {
const serverStatsService: ServerStatsService = await this.moduleRef.resolve(ServerStatsService);
await serverStatsService.start();
} else {
const serverStatsService: ServerStatsService = await this.moduleRef.resolve(ServerStatsService);
serverStatsService.dispose();
}
});
}
}