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:
parent
e1a570abff
commit
cf0c8ee588
14 changed files with 61 additions and 20 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue