2022-01-11 00:29:33 +00:00
|
|
|
import type { RegisterServerOptions } from '@peertube/peertube-types'
|
2021-04-12 15:53:12 +00:00
|
|
|
import { diagBackend } from './backend'
|
|
|
|
import { TestResult, newResult } from './utils'
|
|
|
|
import { diagProsody } from './prosody'
|
|
|
|
import { diagVideo } from './video'
|
|
|
|
|
2021-04-12 18:15:44 +00:00
|
|
|
export async function diag (test: string, options: RegisterServerOptions): Promise<TestResult> {
|
2021-04-12 15:53:12 +00:00
|
|
|
let result: TestResult
|
|
|
|
|
|
|
|
if (test === 'backend') {
|
2021-04-12 18:15:44 +00:00
|
|
|
result = await diagBackend(test, options)
|
2021-04-12 15:53:12 +00:00
|
|
|
} else if (test === 'webchat-video') {
|
2021-04-12 18:15:44 +00:00
|
|
|
result = await diagVideo(test, options)
|
2021-04-12 15:53:12 +00:00
|
|
|
} else if (test === 'prosody') {
|
2021-04-12 18:15:44 +00:00
|
|
|
result = await diagProsody(test, options)
|
2021-04-12 15:53:12 +00:00
|
|
|
} else {
|
|
|
|
result = newResult(test)
|
|
|
|
result.messages.push('Unknown test')
|
|
|
|
}
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|