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 { diagConverse } from './converse'
|
|
|
|
import { diagChatType } from './chat-type'
|
|
|
|
import { TestResult, newResult } from './utils'
|
|
|
|
import { diagProsody } from './prosody'
|
|
|
|
import { diagUri } from './uri'
|
|
|
|
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 === 'webchat-type') {
|
2021-04-12 18:15:44 +00:00
|
|
|
result = await diagChatType(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 if (test === 'converse') {
|
2021-04-12 18:15:44 +00:00
|
|
|
result = await diagConverse(test, options)
|
2021-04-12 15:53:12 +00:00
|
|
|
} else if (test === 'use-uri') {
|
2021-04-12 18:15:44 +00:00
|
|
|
result = await diagUri(test, options)
|
2021-04-12 15:53:12 +00:00
|
|
|
} else {
|
|
|
|
result = newResult(test)
|
|
|
|
result.messages.push('Unknown test')
|
|
|
|
}
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|