Merge branch 'develop' into mkjs-n
This commit is contained in:
commit
cef5feaee2
17 changed files with 137 additions and 33 deletions
|
|
@ -96,6 +96,8 @@ export default class extends Endpoint<'admin/meta'> {
|
|||
enableActiveEmailValidation: instance.enableActiveEmailValidation,
|
||||
enableChartsForRemoteUser: instance.enableChartsForRemoteUser,
|
||||
enableChartsForFederatedInstances: instance.enableChartsForFederatedInstances,
|
||||
enableServerMachineStats: instance.enableServerMachineStats,
|
||||
enableIdenticonGeneration: instance.enableIdenticonGeneration,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -304,6 +304,14 @@ export default class extends Endpoint<'admin/update-meta'> {
|
|||
set.enableChartsForFederatedInstances = ps.enableChartsForFederatedInstances;
|
||||
}
|
||||
|
||||
if (ps.enableServerMachineStats !== undefined) {
|
||||
set.enableServerMachineStats = ps.enableServerMachineStats;
|
||||
}
|
||||
|
||||
if (ps.enableIdenticonGeneration !== undefined) {
|
||||
set.enableIdenticonGeneration = ps.enableIdenticonGeneration;
|
||||
}
|
||||
|
||||
if (ps.serverRules !== undefined) {
|
||||
set.serverRules = ps.serverRules;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,12 @@ import * as os from 'node:os';
|
|||
import si from 'systeminformation';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: false,
|
||||
allowGet: true,
|
||||
cacheSec: 60 * 1,
|
||||
|
||||
tags: ['meta'],
|
||||
} as const;
|
||||
|
|
@ -19,8 +22,24 @@ export const paramDef = {
|
|||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
) {
|
||||
super(meta, paramDef, async () => {
|
||||
if (!(await this.metaService.fetch()).enableServerMachineStats) return {
|
||||
machine: '?',
|
||||
cpu: {
|
||||
model: '?',
|
||||
cores: 0,
|
||||
},
|
||||
mem: {
|
||||
total: 0,
|
||||
},
|
||||
fs: {
|
||||
total: 0,
|
||||
used: 0,
|
||||
},
|
||||
};
|
||||
|
||||
const memStats = await si.mem();
|
||||
const fsStats = await si.fsSize();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue