1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Fix admin edition disabling feature

This commit is contained in:
Chocobozzz 2021-10-14 11:35:43 +02:00
parent e1a570abff
commit cf0c8ee588
No known key found for this signature in database
GPG key ID: 583A612D890159BE
14 changed files with 61 additions and 20 deletions

View file

@ -1,7 +1,11 @@
import express from 'express'
import { Server } from 'http'
import { randomInt } from '@shared/core-utils'
import { terminateServer } from './utils'
export class MockInstancesIndex {
private server: Server
private readonly indexInstances: { host: string, createdAt: string }[] = []
initialize () {
@ -30,11 +34,15 @@ export class MockInstancesIndex {
})
const port = 42000 + randomInt(1, 1000)
app.listen(port, () => res(port))
this.server = app.listen(port, () => res(port))
})
}
addInstance (host: string) {
this.indexInstances.push({ host, createdAt: new Date().toISOString() })
}
terminate () {
return terminateServer(this.server)
}
}