Skip to content

Commit

Permalink
Merge pull request #24 from atsu1125/custom/api-patch-1
Browse files Browse the repository at this point in the history
feat: api/server-info
  • Loading branch information
atsu1125 authored and mei23 committed Nov 18, 2022
1 parent 89bf96a commit aed5742
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/server/api/endpoints/server-info.ts
@@ -0,0 +1,37 @@
import * as os from 'os';
import * as si from 'systeminformation';
import define from '../define';

export const meta = {
requireCredential: false,

desc: {
},

tags: ['meta'],

params: {
},
};

export default define(meta, async () => {
const memStats = await si.mem();
const fsStats = await si.fsSize();

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

0 comments on commit aed5742

Please sign in to comment.