Fix settings read.

This commit is contained in:
John Livingston 2023-04-13 18:41:23 +02:00 committed by John Livingston
parent 801798852c
commit cf0e4d8061

View File

@ -64,22 +64,26 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise<Pro
let certsDir: string | undefined = path.resolve(dir, 'certs') let certsDir: string | undefined = path.resolve(dir, 'certs')
let certsDirIsCustom = false let certsDirIsCustom = false
if ((settings['prosody-certificates-dir'] as string ?? '') !== '') { if (settings['prosody-room-allow-s2s']) {
if (!fs.statSync(settings['prosody-certificates-dir'] as string).isDirectory()) { if ((settings['prosody-certificates-dir'] as string ?? '') !== '') {
// We can throw an exception here... if (!fs.statSync(settings['prosody-certificates-dir'] as string).isDirectory()) {
// Because if the user input a wrong directory, the plugin will not register, // We can throw an exception here...
// and he will never be able to fix the conf // Because if the user input a wrong directory, the plugin will not register,
logger.error('Certificate directory does not exist or is not a directory') // and he will never be able to fix the conf
certsDir = undefined logger.error('Certificate directory does not exist or is not a directory')
certsDir = undefined
} else {
certsDir = settings['prosody-certificates-dir'] as string
}
certsDirIsCustom = true
} else { } else {
certsDir = settings['prosody-certificates-dir'] as string // In this case we are generating and using self signed certificates
// Note: when using prosodyctl to generate self-signed certificates,
// there are wrongly generated in the data dir.
// So we will use this dir as the certs dir.
certsDir = path.resolve(dir, 'data')
} }
certsDirIsCustom = true
} else if (settings['prosody-room-allow-s2s']) {
// Note: when using prosodyctl to generate self-signed certificates,
// there are wrongly generated in the data dir.
// So we will use this dir as the certs dir.
certsDir = path.resolve(dir, 'data')
} }
return { return {