1
0
Fork 0

typing fix

refactor/models
Matthew 2020-05-12 10:44:16 -04:00
parent f507131ae2
commit 025c14139b
No known key found for this signature in database
GPG Key ID: D499B75C1390E321
1 changed files with 1 additions and 4 deletions

View File

@ -32,8 +32,6 @@ export default class CWG_Create extends Command {
try { try {
if (!args[2]) return this.client.commands.get('help').run(message, ['cwg', this.name]); if (!args[2]) return this.client.commands.get('help').run(message, ['cwg', this.name]);
let certs: { cert: string, key: string };
if (!this.urlRegex.test(args[1])) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid URL***`); if (!this.urlRegex.test(args[1])) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid URL***`);
if (Number(args[2]) <= 1024 || Number(args[2]) >= 65535) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Port must be greater than 1024 and less than 65535***`); if (Number(args[2]) <= 1024 || Number(args[2]) >= 65535) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Port must be greater than 1024 and less than 65535***`);
if (!args[1].endsWith('.cloud.libraryofcode.org') && !args[4]) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Certificate Chain and Private Key are required for custom domains***`); if (!args[1].endsWith('.cloud.libraryofcode.org') && !args[4]) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Certificate Chain and Private Key are required for custom domains***`);
@ -59,6 +57,7 @@ export default class CWG_Create extends Command {
const edit = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Binding domain...***`); const edit = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Binding domain...***`);
let certs: { cert?: string, key?: string } = {};
if (!args[1].endsWith('.cloud.libraryofcode.org')) { if (!args[1].endsWith('.cloud.libraryofcode.org')) {
const urls = args.slice(3, 5); const urls = args.slice(3, 5);
if (urls.some((l) => !l.includes('snippets.cloud.libraryofcode.org/raw/'))) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid snippets URL***`); if (urls.some((l) => !l.includes('snippets.cloud.libraryofcode.org/raw/'))) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid snippets URL***`);
@ -72,8 +71,6 @@ export default class CWG_Create extends Command {
certs = { cert: certAndPrivateKey[0], key: certAndPrivateKey[1] }; certs = { cert: certAndPrivateKey[0], key: certAndPrivateKey[1] };
} else { } else {
// eslint-disable-next-line no-shadow
const certs: { cert?: string, key?: string } = {};
certs.cert = await fs.readFile('/etc/ssl/private/cloud-libraryofcode-org.chain.crt', { encoding: 'utf8' }); certs.cert = await fs.readFile('/etc/ssl/private/cloud-libraryofcode-org.chain.crt', { encoding: 'utf8' });
certs.key = await fs.readFile('/etc/ssl/private/cloud-libraryofcode-org.key', { encoding: 'utf8' }); certs.key = await fs.readFile('/etc/ssl/private/cloud-libraryofcode-org.key', { encoding: 'utf8' });
} }