summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrinsuki <428rinsuki+git@gmail.com>2021-08-19 16:27:12 +0900
committerGitHub <noreply@github.com>2021-08-19 16:27:12 +0900
commitab54e147f2a170f2a4ee841ace8537e0ab6a1dab (patch)
tree666322c483d1b619fc499019354a8a6fef676765 /src
parentUpdate faq.md (diff)
downloadsharkey-ab54e147f2a170f2a4ee841ace8537e0ab6a1dab.tar.gz
sharkey-ab54e147f2a170f2a4ee841ace8537e0ab6a1dab.tar.bz2
sharkey-ab54e147f2a170f2a4ee841ace8537e0ab6a1dab.zip
Remove is-root dependencies (#7660)
Diffstat (limited to 'src')
-rw-r--r--src/@types/is-root.d.ts7
-rw-r--r--src/boot/master.ts6
2 files changed, 5 insertions, 8 deletions
diff --git a/src/@types/is-root.d.ts b/src/@types/is-root.d.ts
deleted file mode 100644
index 3905a16c8d..0000000000
--- a/src/@types/is-root.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-declare module 'is-root' {
- function isRoot(): boolean;
-
- namespace isRoot {} // Hack
-
- export = isRoot;
-}
diff --git a/src/boot/master.ts b/src/boot/master.ts
index 473e215bac..3d86a5dab8 100644
--- a/src/boot/master.ts
+++ b/src/boot/master.ts
@@ -2,7 +2,6 @@ import * as os from 'os';
import * as cluster from 'cluster';
import * as chalk from 'chalk';
import * as portscanner from 'portscanner';
-import * as isRoot from 'is-root';
import { getConnection } from 'typeorm';
import Logger from '../services/logger';
@@ -39,6 +38,11 @@ function greet() {
bootLogger.info(`Misskey v${meta.version}`, null, true);
}
+function isRoot() {
+ // maybe process.getuid will be undefined under not POSIX environment (e.g. Windows)
+ return process.getuid != null && process.getuid() === 0;
+}
+
/**
* Init master process
*/