From e07211d0f8d1ccc8d3640407a2df660ae64709de Mon Sep 17 00:00:00 2001 From: Bsian Date: Sun, 29 Mar 2020 22:40:50 +0100 Subject: [PATCH 1/4] Bug fixes --- src/commands/cwg_create.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index 8a5a8a1..2d8937e 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -155,7 +155,7 @@ export default class CWG_Create extends Command { key: '/etc/ssl/private/cloud-libraryofcode-org.key', }; } - let cfg = await fs.readFile('/opt/CloudServices/dist/static/nginx.conf', { encoding: 'utf8' }); + let cfg = await fs.readFile('/opt/CloudServices/src/static/nginx.conf', { encoding: 'utf8' }); cfg = cfg.replace(/\[DOMAIN]/g, domain); cfg = cfg.replace(/\[PORT]/g, String(port)); cfg = cfg.replace(/\[CERTIFICATE]/g, x509.cert); @@ -180,9 +180,8 @@ export default class CWG_Create extends Command { } return entry.save(); } catch (error) { - await fs.unlink(`/etc/nginx/sites-enabled/${domain}`); - await fs.unlink(`/etc/nginx/sites-available/${domain}`); - await this.client.db.Domain.deleteMany({ domain }); + const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${domain}`), fs.unlink(`/etc/nginx/sites-available/${domain}`), this.client.db.Domain.deleteMany({ domain })]; + await Promise.allSettled(tasks); throw error; } } From 09bec4ad43d5856e3669769e4b022e6f4c27397f Mon Sep 17 00:00:00 2001 From: Bsian Date: Sun, 29 Mar 2020 22:43:47 +0100 Subject: [PATCH 2/4] Matt stop changing the fucking target --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index febdc18..10493bf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": ["ES2019.Object", "ES2020.Promise"], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ From f55db08f362735ffb9dcee118541e14c4381d8ad Mon Sep 17 00:00:00 2001 From: Bsian Date: Sun, 29 Mar 2020 22:51:17 +0100 Subject: [PATCH 3/4] More bug fixes? --- src/commands/cwg_create.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index 2d8937e..ce53fa5 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -182,7 +182,7 @@ export default class CWG_Create extends Command { } catch (error) { const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${domain}`), fs.unlink(`/etc/nginx/sites-available/${domain}`), this.client.db.Domain.deleteMany({ domain })]; await Promise.allSettled(tasks); - throw error; + return Promise.reject(error); } } From d6ec1d6a6ccab7c0bf6b69d3150e12a5b9ce4d07 Mon Sep 17 00:00:00 2001 From: Bsian Date: Sun, 29 Mar 2020 22:59:21 +0100 Subject: [PATCH 4/4] More bug fixes --- src/commands/cwg_create.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index ce53fa5..33d009f 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -126,9 +126,8 @@ export default class CWG_Create extends Command { return Promise.all(completed); } catch (err) { - await fs.unlink(`/etc/nginx/sites-available/${args[1]}`); - await fs.unlink(`/etc/nginx/sites-enabled/${args[1]}`); - await this.client.db.Domain.deleteMany({ domain: args[1] }); + const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${args[1]}`), fs.unlink(`/etc/nginx/sites-available/${args[1]}`), this.client.db.Domain.deleteMany({ domain: args[1] })]; + await Promise.allSettled(tasks); return this.client.util.handleError(err, message, this); } } @@ -182,7 +181,7 @@ export default class CWG_Create extends Command { } catch (error) { const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${domain}`), fs.unlink(`/etc/nginx/sites-available/${domain}`), this.client.db.Domain.deleteMany({ domain })]; await Promise.allSettled(tasks); - return Promise.reject(error); + throw error; } }