This commit is contained in:
parent
6c56252145
commit
5deb70a0b0
@ -238,5 +238,5 @@ module.exports = async (client, apex, app) => {
|
||||
job = schedule.scheduleJob('0 ' + constant.schedule + ' * * *', async () => {
|
||||
await util.sendFederatedMessage(constant.nick, null, 'Scanning ' + app.locals.server + ' instance with ' + app.locals.scantotal + ' peers\nScanned ' + app.locals.peers + ' peers from ' + app.locals.instances + ' instances, ' + app.locals.created + ' created, ' + app.locals.updated + ' updated\nhttps://' + constant.apexdomain)
|
||||
})
|
||||
await scanReturn()
|
||||
return await scanReturn()
|
||||
}
|
||||
|
36
server.js
36
server.js
@ -54,21 +54,7 @@ const apexinstance = require('./lib/apex'),
|
||||
},
|
||||
itemsPerPage: 200
|
||||
}),
|
||||
server = http.createServer(app).listen(4000, () => {
|
||||
mongoclient.connect()
|
||||
.then(async () => {
|
||||
const exists = await client.indices.exists({ index: constant.index })
|
||||
if (!exists) {
|
||||
await client.indices.create({
|
||||
index: constant.index,
|
||||
body: require('./fediblock-mapping.json')
|
||||
})
|
||||
}
|
||||
apex.store.db = mongoclient.db(constant.dbname)
|
||||
return apex.store.db
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
register = async () => {
|
||||
const admin = await apex.store.getObject(apex.utils.usernameToIRI('admin'), true)
|
||||
if (!admin) {
|
||||
const adminaccount = await apex.createActor('admin', 'Fediblock Admin', 'Fediblock Admin - https://' + constant.apexdomain,
|
||||
@ -108,6 +94,23 @@ const apexinstance = require('./lib/apex'),
|
||||
} else {
|
||||
apex.systemUser = admin
|
||||
}
|
||||
},
|
||||
connect = () => {
|
||||
mongoclient.connect()
|
||||
.then(async () => {
|
||||
const exists = await client.indices.exists({ index: constant.index })
|
||||
if (!exists) {
|
||||
await client.indices.create({
|
||||
index: constant.index,
|
||||
body: require('./fediblock-mapping.json')
|
||||
})
|
||||
}
|
||||
apex.store.db = mongoclient.db(constant.dbname)
|
||||
return apex.store.db
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
await register()
|
||||
taskdeletedup(client)
|
||||
await apex.startDelivery()
|
||||
console.log('Server listening on ' + server.address().address + ':' + server.address().port)
|
||||
@ -116,6 +119,9 @@ const apexinstance = require('./lib/apex'),
|
||||
console.error(e)
|
||||
}
|
||||
})
|
||||
},
|
||||
server = http.createServer(app).listen(4000, () => {
|
||||
connect()
|
||||
})
|
||||
|
||||
app.locals.scan = new events.EventEmitter()
|
||||
|
Loading…
Reference in New Issue
Block a user