From 2af97851e114d9d612a1fb90a5d8a4a8a9a4d71f Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 28 Mar 2020 04:57:40 -0400 Subject: [PATCH] no idea whats happening but i object --- src/commands/cwg_create.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index 6966cd0..8a5a8a1 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -34,7 +34,7 @@ export default class CWG_Create extends Command { let certs: { cert: string, key: string }; 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***`); const account = await this.client.db.Account.findOne({ $or: [{ username: args[0] }, { userID: args[0] }] }); @@ -74,7 +74,7 @@ export default class CWG_Create extends Command { const domain = await this.createDomain(account, args[1], Number(args[2]), certs); - const tasks = [message.delete(), this.client.util.exec('systemctl reload')]; + const tasks = [message.delete(), this.client.util.exec('systemctl reload nginx')]; // @ts-ignore await Promise.all(tasks); @@ -149,6 +149,11 @@ export default class CWG_Create extends Command { let x509: { cert: string, key: string }; if (x509Certificate) { x509 = await this.createCertAndPrivateKey(domain, x509Certificate.cert, x509Certificate.key); + } else { + x509 = { + cert: '/etc/ssl/private/cloud-libraryofcode-org.chain.crt', + key: '/etc/ssl/private/cloud-libraryofcode-org.key', + }; } let cfg = await fs.readFile('/opt/CloudServices/dist/static/nginx.conf', { encoding: 'utf8' }); cfg = cfg.replace(/\[DOMAIN]/g, domain);