From 7a3ff32122e463627de5217be0b1ea8300f5442b Mon Sep 17 00:00:00 2001 From: Matthew R Date: Fri, 25 Dec 2020 20:16:41 -0500 Subject: [PATCH] quality fixes --- src/commands/eris.ts | 4 ++-- src/commands/game.ts | 4 ++-- src/commands/page.ts | 2 +- src/commands/score_notify.ts | 2 +- src/commands/tls.ts | 18 +++++++++++++++++- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/commands/eris.ts b/src/commands/eris.ts index f90b8ac..a80ea1f 100644 --- a/src/commands/eris.ts +++ b/src/commands/eris.ts @@ -1,6 +1,6 @@ import { Message, EmbedOptions } from 'eris'; -import axios, { AxiosResponse, AxiosError } from 'axios'; -import { Client, Command, RichEmbed } from '../class'; +import axios, { AxiosResponse } from 'axios'; +import { Client, Command } from '../class'; export default class Eris extends Command { constructor(client: Client) { diff --git a/src/commands/game.ts b/src/commands/game.ts index d2dead0..be34f78 100644 --- a/src/commands/game.ts +++ b/src/commands/game.ts @@ -35,14 +35,14 @@ export default class Game extends Command { if (!member.activities || member.activities.length <= 0) return this.error(message.channel, 'Cannot find a game for this member.'); const embed = new RichEmbed(); let mainStatus: Activity; - if (member.activities[0].type === ActivityType.CUSTOM_STATUS) { + if (member.activities[0]?.type === ActivityType.CUSTOM_STATUS) { mainStatus = member.activities[1]; embed.setDescription(`*${member.activities[0].state}*`); } else { mainStatus = member.activities[0]; } embed.setAuthor(member.user.username, member.user.avatarURL); - if (mainStatus.type === ActivityType.LISTENING) { + if (mainStatus?.type === ActivityType.LISTENING) { embed.setTitle('Spotify'); embed.setColor('#1ed760'); embed.addField('Song', mainStatus.details, true); diff --git a/src/commands/page.ts b/src/commands/page.ts index 0f09386..7ead34a 100644 --- a/src/commands/page.ts +++ b/src/commands/page.ts @@ -210,7 +210,7 @@ export default class Page extends Command { priority: 1, app: 'cr-zero', }); - chan.on('StasisStart', async (event, channel) => { + chan.on('StasisStart', async (_event, channel) => { const playback = await channel.play({ media: `sound:/tmp/${fileExtension}`, }, undefined); diff --git a/src/commands/score_notify.ts b/src/commands/score_notify.ts index 2a9b98b..4538e7f 100644 --- a/src/commands/score_notify.ts +++ b/src/commands/score_notify.ts @@ -27,7 +27,7 @@ export default class Score_Notify extends Command { await this.client.db.Score.updateOne({ userID: message.author.id }, { $set: { notify: false } }); return this.success(message.channel, 'You will no longer be sent notifications when your score is hard-pulled.'); default: - return this.error(message.channel, 'Invalid option. Valid options are `yes` and `no`.'); + return this.error(message.channel, 'Invalid option. Valid options are `on` and `off`.'); } } catch (err) { return this.client.util.handleError(err, message, this); diff --git a/src/commands/tls.ts b/src/commands/tls.ts index 4de878e..662f985 100644 --- a/src/commands/tls.ts +++ b/src/commands/tls.ts @@ -21,10 +21,19 @@ interface TLSResponse { locality: string[], country: string[], }, + root: { + commonName: string, + organization: string[], + organizationalUnit: string[], + locality: string[], + country: string[], + }, + notBefore: Date, + notAfter: Date, validationType: 'DV' | 'OV' | 'EV', signatureAlgorithm: string, publicKeyAlgorithm: string, - serialNumber: number, + serialNumber: string, keyUsage: number[], keyUsageAsText: ['CRL Signing'?, 'Certificate Signing'?, 'Content Commitment'?, 'Data Encipherment'?, 'Decipher Only'?, 'Digital Signature'?, 'Encipher Only'?, 'Key Agreement'?, 'Key Encipherment'?], extendedKeyUsage: number[], @@ -106,10 +115,17 @@ export default class TLS extends Command { if (resp.issuer.organizationalUnit?.length > 0) issuerString += `**Organizational Unit:** ${resp.issuer.organizationalUnit[0]}\n`; if (resp.issuer.locality?.length > 0) issuerString += `**Locality:** ${resp.issuer.locality[0]}\n`; if (resp.issuer.country?.length > 0) issuerString += `**Country:** ${resp.issuer.country[0]}`; + const rootString = `**Root Certificate:** ${resp.root.organization?.length > 0 ? resp.root.organization[0] : ''} (${resp.root.commonName ?? ''} : ${resp.root.organizationalUnit?.length > 0 ? resp.root.organizationalUnit[0] : ''})`; + if (rootString?.length > 0) issuerString += `\n\n${rootString}`; embed.addField('Issuer', issuerString, true); embed.addBlankField(); + embed.addField('Issued On', new Date(resp.notBefore).toLocaleString('en-us'), true); + embed.addField('Expiry', new Date(resp.notAfter).toLocaleString('en-us'), true); + + embed.addBlankField(); + let sanString = ''; for (let i = 0; i < resp.san.length; i++) {