summaryrefslogtreecommitdiff
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
parentUpdate faq.md (diff)
downloadmisskey-ab54e147f2a170f2a4ee841ace8537e0ab6a1dab.tar.gz
misskey-ab54e147f2a170f2a4ee841ace8537e0ab6a1dab.tar.bz2
misskey-ab54e147f2a170f2a4ee841ace8537e0ab6a1dab.zip
Remove is-root dependencies (#7660)
-rw-r--r--package.json1
-rw-r--r--src/@types/is-root.d.ts7
-rw-r--r--src/boot/master.ts6
-rw-r--r--yarn.lock5
4 files changed, 5 insertions, 14 deletions
diff --git a/package.json b/package.json
index 1f7d570f56..093f0d99c6 100644
--- a/package.json
+++ b/package.json
@@ -153,7 +153,6 @@
"http-signature": "1.3.5",
"idb-keyval": "5.1.3",
"insert-text-at-cursor": "0.3.0",
- "is-root": "2.1.0",
"is-svg": "4.3.1",
"js-yaml": "4.1.0",
"jsdom": "16.7.0",
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
*/
diff --git a/yarn.lock b/yarn.lock
index ecb0ff9739..13e906a261 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6383,11 +6383,6 @@ is-resolvable@^1.1.0:
resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88"
integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==
-is-root@2.1.0:
- version "2.1.0"
- resolved "https://registry.yarnpkg.com/is-root/-/is-root-2.1.0.tgz#809e18129cf1129644302a4f8544035d51984a9c"
- integrity sha512-AGOriNp96vNBd3HtU+RzFEc75FfR5ymiYv8E553I71SCeXBiMsVDUtdio1OEFvrPyLIQ9tVR5RxXIFe5PUFjMg==
-
is-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3"