diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2021-01-03 22:38:32 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2021-01-03 22:38:32 +0900 |
| commit | c6fe79809286ca4a886a2a8e01efb4201bb5a2c1 (patch) | |
| tree | 1c8bf0d7749e453e1113afead08fe6e433e9abb9 /src/server | |
| parent | Fix CSS injection at MFM speed (#7051) (diff) | |
| download | sharkey-c6fe79809286ca4a886a2a8e01efb4201bb5a2c1.tar.gz sharkey-c6fe79809286ca4a886a2a8e01efb4201bb5a2c1.tar.bz2 sharkey-c6fe79809286ca4a886a2a8e01efb4201bb5a2c1.zip | |
サーバー情報ウィジェット
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/api/endpoints/server-info.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/server/api/endpoints/server-info.ts b/src/server/api/endpoints/server-info.ts new file mode 100644 index 0000000000..4e636d331c --- /dev/null +++ b/src/server/api/endpoints/server-info.ts @@ -0,0 +1,35 @@ +import * as os from 'os'; +import * as si from 'systeminformation'; +import define from '../define'; + +export const meta = { + requireCredential: false as const, + + desc: { + }, + + tags: ['meta'], + + params: { + }, +}; + +export default define(meta, async () => { + const memStats = await si.mem(); + const fsStats = await si.fsSize(); + + return { + machine: os.hostname(), + cpu: { + model: os.cpus()[0].model, + cores: os.cpus().length + }, + mem: { + total: memStats.total + }, + fs: { + total: fsStats[0].size, + used: fsStats[0].used, + }, + }; +}); |