aboutsummaryrefslogtreecommitdiff
path: root/src/server/DashSession/DashSessionAgent.ts
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2020-01-10 14:34:22 -0500
committerSam Wilkins <samwilkins333@gmail.com>2020-01-10 14:34:22 -0500
commit7741fd9cc135f94fbc1b68d89d68e38c93648f33 (patch)
tree6835b149857ea16454a81673e3b39af6e89ca0de /src/server/DashSession/DashSessionAgent.ts
parentcfba84bdfee74407b9dcbe80505f527ddb4b0433 (diff)
created multicolumn view file, made recipient parameter optional in sessionmanager
Diffstat (limited to 'src/server/DashSession/DashSessionAgent.ts')
-rw-r--r--src/server/DashSession/DashSessionAgent.ts25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/server/DashSession/DashSessionAgent.ts b/src/server/DashSession/DashSessionAgent.ts
index 8061da1ca..f3f0a3c3d 100644
--- a/src/server/DashSession/DashSessionAgent.ts
+++ b/src/server/DashSession/DashSessionAgent.ts
@@ -19,7 +19,6 @@ import { ServerWorker } from "../session/agents/server_worker";
*/
export class DashSessionAgent extends AppliedSessionAgent {
- private readonly notificationRecipients = ["brownptcdash@gmail.com"];
private readonly signature = "-Dash Server Session Manager";
private readonly releaseDesktop = pathFromRoot("../../Desktop");
@@ -83,14 +82,15 @@ export class DashSessionAgent extends AppliedSessionAgent {
*/
private dispatchSessionPassword = async (key: string) => {
const { mainLog } = this.sessionMonitor;
+ const { notificationRecipient } = DashSessionAgent;
mainLog(green("dispatching session key..."));
- const failures = await Email.dispatchAll({
- to: this.notificationRecipients,
+ const error = await Email.dispatch({
+ to: notificationRecipient,
subject: "Dash Release Session Admin Authentication Key",
content: `The key for this session (started @ ${new Date().toUTCString()}) is ${key}.\n\n${this.signature}`
});
- if (failures) {
- failures.map(({ recipient, error: { message } }) => this.sessionMonitor.mainLog(red(`dispatch failure @ ${recipient} (${yellow(message)})`)));
+ if (error) {
+ this.sessionMonitor.mainLog(red(`dispatch failure @ ${notificationRecipient} (${yellow(error.message)})`));
mainLog(red("distribution of session key experienced errors"));
} else {
mainLog(green("successfully distributed session key to recipients"));
@@ -102,13 +102,14 @@ export class DashSessionAgent extends AppliedSessionAgent {
*/
private dispatchCrashReport = async (crashCause: Error) => {
const { mainLog } = this.sessionMonitor;
- const failures = await Email.dispatchAll({
- to: this.notificationRecipients,
+ const { notificationRecipient } = DashSessionAgent;
+ const error = await Email.dispatch({
+ to: notificationRecipient,
subject: "Dash Web Server Crash",
content: this.generateCrashInstructions(crashCause)
});
- if (failures) {
- failures.map(({ recipient, error: { message } }) => this.sessionMonitor.mainLog(red(`dispatch failure @ ${recipient} (${yellow(message)})`)));
+ if (error) {
+ this.sessionMonitor.mainLog(red(`dispatch failure @ ${notificationRecipient} (${yellow(error.message)})`));
mainLog(red("distribution of crash notification experienced errors"));
} else {
mainLog(green("successfully distributed crash notification to recipients"));
@@ -210,4 +211,10 @@ export class DashSessionAgent extends AppliedSessionAgent {
}
}
+}
+
+export namespace DashSessionAgent {
+
+ export const notificationRecipient = "brownptcdash@gmail.com";
+
} \ No newline at end of file