diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-17 16:24:08 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | eb8b27c93e61a896a08923dc1ca3c87ba8cf4948 (patch) | |
tree | 941c78bbcce2747db08ed68e526e0593058f593b | |
parent | 79d5caf994edd87ad721994490f10677be277497 (diff) | |
download | PeerTube-eb8b27c93e61a896a08923dc1ca3c87ba8cf4948.tar.gz PeerTube-eb8b27c93e61a896a08923dc1ca3c87ba8cf4948.tar.zst PeerTube-eb8b27c93e61a896a08923dc1ca3c87ba8cf4948.zip |
Fix update host script
-rwxr-xr-x | scripts/update-host.ts | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/scripts/update-host.ts b/scripts/update-host.ts index 05f0ef96d..4410e1ff7 100755 --- a/scripts/update-host.ts +++ b/scripts/update-host.ts | |||
@@ -1,15 +1,19 @@ | |||
1 | import { database as db } from '../server/initializers/database' | 1 | import { database as db } from '../server/initializers/database' |
2 | // import { hasFriends } from '../server/lib/friends' | 2 | import { getServerAccount } from '../server/helpers/utils' |
3 | 3 | ||
4 | db.init(true) | 4 | db.init(true) |
5 | .then(() => { | 5 | .then(() => { |
6 | // FIXME: check if has following | 6 | return getServerAccount() |
7 | // return hasFriends() | ||
8 | return true | ||
9 | }) | 7 | }) |
10 | .then(itHasFriends => { | 8 | .then(serverAccount => { |
11 | if (itHasFriends === true) { | 9 | return db.AccountFollow.listAcceptedFollowingUrlsForApi([ serverAccount.id ]) |
12 | console.log('Cannot update host because you have friends!') | 10 | }) |
11 | .then(res => { | ||
12 | return res.total > 0 | ||
13 | }) | ||
14 | .then(hasFollowing => { | ||
15 | if (hasFollowing === true) { | ||
16 | console.log('Cannot update host because you follow other servers!') | ||
13 | process.exit(-1) | 17 | process.exit(-1) |
14 | } | 18 | } |
15 | 19 | ||