diff options
| author | Adam Soltys <[email protected]> | 2021-08-03 01:52:33 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-08-03 01:52:33 -0700 |
| commit | e5e2bcf015b128c71cacf125d6aea4a0dddd30c3 (patch) | |
| tree | 09af4085f72fa2466cb0f66768be6e882be30f81 /lib | |
| parent | 2f52a91c5babde9e374dd9c532448f565bcbfeee (diff) | |
| parent | 1fbae57bb9540b1c116efc367809ac01ae2e9df2 (diff) | |
| download | coinos-server-e5e2bcf015b128c71cacf125d6aea4a0dddd30c3.tar.gz coinos-server-e5e2bcf015b128c71cacf125d6aea4a0dddd30c3.zip | |
Merge branch 'prod' into dev
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mail.js | 32 | ||||
| -rw-r--r-- | lib/send.js | 2 | ||||
| -rw-r--r-- | lib/sockets.js | 2 |
3 files changed, 34 insertions, 2 deletions
diff --git a/lib/mail.js b/lib/mail.js index 705880d2..ca2c2b81 100644 --- a/lib/mail.js +++ b/lib/mail.js @@ -10,6 +10,38 @@ function openInbox(cb) { imap.openBox("INBOX", true, cb); } +app.post( + "/contact-sil", + ah((req, res) => { + const mailgun = require("mailgun-js")(config.mailgun); + let data = { + subject: "Contact form", + text: JSON.stringify(req.body), + from: "[email protected]", + to: "[email protected]" + }; + + mailgun.messages().send(data); + res.send(req.body); + }) +); + +app.post( + "/contact", + ah((req, res) => { + const mailgun = require("mailgun-js")(config.mailgun); + let data = { + subject: "Contact form", + text: JSON.stringify(req.body), + from: "[email protected]", + to: "[email protected]" + }; + + mailgun.messages().send(data); + res.send(req.body); + }) +); + imap.once("ready", function() { openInbox(function(err, box) { if (err) throw err; diff --git a/lib/send.js b/lib/send.js index 660fcae4..fd577231 100644 --- a/lib/send.js +++ b/lib/send.js @@ -6,7 +6,7 @@ send = async (amount, memo, hash, user) => { let routingInfo = payreq.tags.find(t => t.tagName === "routing_info"); if ( routingInfo && - routingInfo.data.find(d => d.fee_proportional_millionths > 100) + routingInfo.data.find(d => d.fee_proportional_millionths > 1000) ) throw new Error("Fee rate too high"); diff --git a/lib/sockets.js b/lib/sockets.js index 931a9d23..bd59ee38 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -96,7 +96,7 @@ wss.on("connection", function(ws, req) { lastSeen[token] = new Date(); try { - if (!token || token === "null") return ws.close(); + if (!token || token === "null" || !jwt.decode(token)) return ws.close(); const username = jwt.decode(token).username; if (!username) throw new Error("Invalid JWT token"); |
