Skip to content

Commit

Permalink
Merge pull request #25 from atsu1125/custom/api-patch-1
Browse files Browse the repository at this point in the history
Custom/api patch 1
  • Loading branch information
atsu1125 authored and mei23 committed Nov 18, 2022
1 parent 9986b91 commit d6c1153
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/daemons/server-stats.ts
Expand Up @@ -31,10 +31,10 @@ export default function() {
// |-- active --|-- available --|- free -|

const stats = {
cpu_usage: cpu,
cpu_speed: cpuSpeed,
mem,
disk,
cpu_usage: config.hideServerInfo ? -1 : cpu,
cpu_speed: config.hideServerInfo ? -1 : cpuSpeed,
mem: config.hideServerInfo ? -1 : mem,
disk: config.hideServerInfo ? -1 : disk,
os_uptime: config.hideServerInfo ? -1 : os.uptime(),
process_uptime: config.hideServerInfo ? -1 : process.uptime()
};
Expand Down
17 changes: 9 additions & 8 deletions src/server/api/endpoints/server-info.ts
@@ -1,6 +1,7 @@
import * as os from 'os';
import * as si from 'systeminformation';
import define from '../define';
import config from '../../../config';

export const meta = {
requireCredential: false,
Expand All @@ -20,19 +21,19 @@ export default define(meta, async () => {
const fsStats = await si.fsSize();

return {
machine: os.hostname(),
os: os.platform(),
node: process.version,
machine: config.hideServerInfo ? 'Unknown' : os.hostname(),
os: config.hideServerInfo ? 'Unknown' : os.platform(),
node: config.hideServerInfo ? 'Unknown' : process.version,
cpu: {
model: os.cpus()[0].model,
cores: os.cpus().length
model: config.hideServerInfo ? 'Unknown' : os.cpus()[0].model,
cores: config.hideServerInfo ? 'Unknown' : os.cpus().length
},
mem: {
total: memStats.total
total: config.hideServerInfo ? 'Unknown' : memStats.total
},
fs: {
total: fsStats[0].size,
used: fsStats[0].used,
total: config.hideServerInfo ? 'Unknown' : fsStats[0].size,
used: config.hideServerInfo ? 'Unknown' : fsStats[0].used,
}
};
});

0 comments on commit d6c1153

Please sign in to comment.