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 () => {
|
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 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
|
itemsPerPage: 200
|
||||||
}),
|
}),
|
||||||
server = http.createServer(app).listen(4000, () => {
|
register = async () => {
|
||||||
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 {
|
|
||||||
const admin = await apex.store.getObject(apex.utils.usernameToIRI('admin'), true)
|
const admin = await apex.store.getObject(apex.utils.usernameToIRI('admin'), true)
|
||||||
if (!admin) {
|
if (!admin) {
|
||||||
const adminaccount = await apex.createActor('admin', 'Fediblock Admin', 'Fediblock Admin - https://' + constant.apexdomain,
|
const adminaccount = await apex.createActor('admin', 'Fediblock Admin', 'Fediblock Admin - https://' + constant.apexdomain,
|
||||||
@ -108,6 +94,23 @@ const apexinstance = require('./lib/apex'),
|
|||||||
} else {
|
} else {
|
||||||
apex.systemUser = admin
|
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)
|
taskdeletedup(client)
|
||||||
await apex.startDelivery()
|
await apex.startDelivery()
|
||||||
console.log('Server listening on ' + server.address().address + ':' + server.address().port)
|
console.log('Server listening on ' + server.address().address + ':' + server.address().port)
|
||||||
@ -116,6 +119,9 @@ const apexinstance = require('./lib/apex'),
|
|||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
server = http.createServer(app).listen(4000, () => {
|
||||||
|
connect()
|
||||||
})
|
})
|
||||||
|
|
||||||
app.locals.scan = new events.EventEmitter()
|
app.locals.scan = new events.EventEmitter()
|
||||||
|
Loading…
Reference in New Issue
Block a user