Skip to content

Commit

Permalink
サーバー情報を隠さない
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Jan 7, 2021
1 parent 9c06150 commit ccfcd69
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .config/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,6 @@ themeColor: '#fb4e4e'

# アップロードやリモート取得で処理できるファイルサイズの制限 (bytes)
#maxFileSize: 262144000

# サーバー情報を隠す (default: false)
#hideServerInfo: true
2 changes: 2 additions & 0 deletions src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export type Source = {

icons?: Icons
themeColor?: string;

hideServerInfo?: boolean;
};

export type DriveConfig = {
Expand Down
5 changes: 3 additions & 2 deletions src/daemons/server-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as diskusage from 'diskusage';
import * as Deque from 'double-ended-queue';
import Xev from 'xev';
import * as osUtils from 'os-utils';
import config from '../config';

const ev = new Xev();

Expand Down Expand Up @@ -32,8 +33,8 @@ export default function() {
used: usedmem
},
disk,
os_uptime: -1,
process_uptime: -1
os_uptime: config.hideServerInfo ? -1 : os.uptime(),
process_uptime: config.hideServerInfo ? -1 : process.uptime()
};
ev.emit('serverStats', stats);
log.unshift(stats);
Expand Down
12 changes: 7 additions & 5 deletions src/misc/build-meta.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IMeta } from '../models/meta';
import Emoji from '../models/emoji';
import config from '../config';
import * as os from 'os';

export async function buildMeta(instance: IMeta, detail = true) {
const emojis = await Emoji.find({ host: null }, {
Expand All @@ -20,13 +21,14 @@ export async function buildMeta(instance: IMeta, detail = true) {
description: instance.description,
langs: instance.langs,

machine: 'Unknown',
os: 'Unknown',
node: 'Unknown',
machine: config.hideServerInfo ? 'Unknown' : os.hostname(),
os: config.hideServerInfo ? 'Unknown' : os.platform(),
arch: config.hideServerInfo ? 'Unknown' : os.arch(),
node: config.hideServerInfo ? 'Unknown' : process.version,

cpu: {
model: 'Unknown',
cores: 'Unknown'
model: config.hideServerInfo ? 'Unknown' : os.cpus()[0].model,
cores: config.hideServerInfo ? 'Unknown' : os.cpus().length
},

announcements: instance.announcements || [],
Expand Down

0 comments on commit ccfcd69

Please sign in to comment.