forked from misskey-dev/misskey
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from atsu1125/custom/api-patch-1
feat: api/server-info
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} | ||
}; | ||
}); |