forked from engineering/cloudservices
Diagnosis
parent
51b888848f
commit
2558c3e78b
|
@ -29,14 +29,19 @@ export default class Parseall extends Command {
|
|||
const files = search.map((acc) => {
|
||||
let certfile: string;
|
||||
try { certfile = readdirSync(`${acc.homepath}/Validation`)[0] } catch (error) { if (error.message.includes('no such file or directory') || error.message.includes('File doesn\'t exist.')) certfile = 'not_found.crt' } // eslint-disable-line
|
||||
this.client.signale.note('Cert directory set:');
|
||||
this.client.signale.note(`${acc.homepath}/Validation/${certfile}`);
|
||||
return `${acc.homepath}/Validation/${certfile}`;
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
const parsed = await Promise.allSettled(files.map((c) => parseCertificate(this.client, c)));
|
||||
this.client.signale.note('Promise settled:');
|
||||
this.client.signale.note(parsed);
|
||||
|
||||
const final = search.map(async (a) => {
|
||||
const result = await parsed[search.findIndex((acc) => acc === a)];
|
||||
this.client.signale.note(result);
|
||||
if (result.status === 'rejected') {
|
||||
if (result.reason.message.includes('no such file or directory') || result.reason.message.includes('File doesn\'t exist.')) return `${this.client.stores.emojis.error} **${a.username}** Unable to locate certificate`;
|
||||
if (result.reason.message.includes('panic: Certificate PEM Encode == nil')) return `${this.client.stores.emojis.error} **${a.username}** Invalid certificate`;
|
||||
|
|
Loading…
Reference in New Issue