Diagnostic tool: testing API communication from Prosody to Peertube.

This commit is contained in:
John Livingston
2021-06-22 12:57:24 +02:00
parent 7279761c66
commit a526feac19
6 changed files with 83 additions and 7 deletions

View File

@ -85,6 +85,7 @@ async function getProsodyConfig (options: RegisterServerOptions): Promise<Prosod
'api/'
const authApiUrl = baseApiUrl + 'user' // FIXME: should be protected by apikey, but mod_auth_http cant handle params
const roomApiUrl = baseApiUrl + 'room?apikey=' + apikey + '&jid={room.jid|jid_node}'
const testApiUrl = baseApiUrl + 'test?apikey=' + apikey
const config = new ProsodyConfigContent(paths, prosodyDomain)
config.useHttpAuthentication(authApiUrl)
@ -96,7 +97,7 @@ async function getProsodyConfig (options: RegisterServerOptions): Promise<Prosod
// TODO: add a settings to choose?
config.useDefaultPersistent()
config.useTestModule(apikey)
config.useTestModule(apikey, testApiUrl)
let logLevel: ProsodyLogLevel | undefined
if (logger.level && (typeof logger.level === 'string')) {

View File

@ -236,9 +236,10 @@ class ProsodyConfigContent {
this.muc.set('muc_room_default_persistent', true)
}
useTestModule (apikey: string): void {
useTestModule (prosodyApikey: string, apiurl: string): void {
this.global.add('modules_enabled', 'http_peertubelivechat_test')
this.global.set('peertubelivechat_test_apikey', apikey)
this.global.set('peertubelivechat_test_apikey', prosodyApikey)
this.global.set('peertubelivechat_test_peertube_api_url', apiurl)
}
setLog (level: ProsodyLogLevel, syslog?: ProsodyLogLevel[]): void {