From 196ab43ea11136f9b71c9e118246843b060bf912 Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Sun, 12 Feb 2017 14:47:54 -0800 Subject: [PATCH] Updates to include the new e-mail settings stored in SQL. --- SQL_MIGRATIONS.md | 5 +++++ deployment/base.sql | 2 +- lib/worker.js | 12 +++++++++--- package.json | 1 + sql_sync/config_entries.json | 24 ++++++++++++++++++++++++ 5 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 SQL_MIGRATIONS.md diff --git a/SQL_MIGRATIONS.md b/SQL_MIGRATIONS.md new file mode 100644 index 0000000..ab1378f --- /dev/null +++ b/SQL_MIGRATIONS.md @@ -0,0 +1,5 @@ +2/12/2017 +--------- +```sql +ALTER TABLE monero_live.config MODIFY item_value TEXT; +``` \ No newline at end of file diff --git a/deployment/base.sql b/deployment/base.sql index 8b912eb..8bb5132 100644 --- a/deployment/base.sql +++ b/deployment/base.sql @@ -42,7 +42,7 @@ CREATE TABLE config id INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT, module VARCHAR(32), item VARCHAR(32), - item_value VARCHAR(128), + item_value TEXT, item_type VARCHAR(64), Item_desc VARCHAR(512) ); diff --git a/lib/worker.js b/lib/worker.js index cc0268b..2ea5e05 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -1,6 +1,7 @@ "use strict"; const debug = require("debug")("worker"); const async = require("async"); +const sprintf = require("sprintf-js").sprintf; let threadName = "Worker Server "; let cycleCount = 0; @@ -214,9 +215,14 @@ function updateShareStats() { return; } // toAddress, subject, body - global.support.sendEmail(rows[0].email, "Worker " + worker + " not hashing", - "Hello,\r\n\r\nYour worker: " + worker + " has stopped submitting hashes at: " + global.support.formatDate(Date.now()) + - " UTC\r\n\r\nThank you,\r\nXMRPool.net Administration Team"); + let emailData = { + worker: worker, + timestamp: global.support.formatDate(Date.now()), + poolEmailSig: global.config.general.emailSig + }; + global.support.sendEmail(rows[0].email, + sprintf(global.config.email.workerNotHashingSubject, emailData), + sprintf(global.config.email.workerNotHashingBody, emailData)); }); } minerStats.hash = 0; diff --git a/package.json b/package.json index badf469..e21ab4d 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "request": "^2.79.0", "request-json": "0.6.1", "shapeshift.io": "1.3.0", + "sprintf-js": "^1.0.3", "uuid": "3.0.1", "wallet-address-validator": "0.1.0" } diff --git a/sql_sync/config_entries.json b/sql_sync/config_entries.json index ee84eb3..b9da6c4 100644 --- a/sql_sync/config_entries.json +++ b/sql_sync/config_entries.json @@ -510,5 +510,29 @@ "item_value": "", "item_type": "string", "Item_desc": "Host that receives share information" + }, + { + "id": 70, + "module": "email", + "item": "workerNotHashingBody", + "item_value": "Hello,\n\nYour worker: %(worker)s has stopped submitting hashes at: %(timestamp)s UTC\n\nThank you,\n%(poolEmailSig)", + "item_type": "string", + "Item_desc": "Email sent to the miner when their worker stops hashing" + }, + { + "id": 71, + "module": "email", + "item": "workerNotHashingSubject", + "item_value": "Worker %(worker)s stopped hashing", + "item_type": "string", + "Item_desc": "Subject of email sent to miner when worker stops hashing" + }, + { + "id": 72, + "module": "general", + "item": "emailSig", + "item_value": "NodeJS-Pool Administration Team", + "item_type": "string", + "Item_desc": "Signature line for the emails." } ] \ No newline at end of file