aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-17 16:24:08 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commiteb8b27c93e61a896a08923dc1ca3c87ba8cf4948 (patch)
tree941c78bbcce2747db08ed68e526e0593058f593b /scripts
parent79d5caf994edd87ad721994490f10677be277497 (diff)
downloadPeerTube-eb8b27c93e61a896a08923dc1ca3c87ba8cf4948.tar.gz
PeerTube-eb8b27c93e61a896a08923dc1ca3c87ba8cf4948.tar.zst
PeerTube-eb8b27c93e61a896a08923dc1ca3c87ba8cf4948.zip
Fix update host script
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update-host.ts18
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 @@
1import { database as db } from '../server/initializers/database' 1import { database as db } from '../server/initializers/database'
2// import { hasFriends } from '../server/lib/friends' 2import { getServerAccount } from '../server/helpers/utils'
3 3
4db.init(true) 4db.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