From 36a05a441a6be0a1a270802c9a38a2265a7b775e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 24 Jun 2021 02:52:43 -0400 Subject: contact form handler --- lib/mail.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib') diff --git a/lib/mail.js b/lib/mail.js index 705880d2..9780fab7 100644 --- a/lib/mail.js +++ b/lib/mail.js @@ -10,6 +10,22 @@ function openInbox(cb) { imap.openBox("INBOX", true, cb); } +app.post( + "/contact", + ah((req, res) => { + const mailgun = require("mailgun-js")(config.mailgun); + let data = { + subject: "Contact form", + text: JSON.stringify(req.body), + from: "server@coinos.io", + to: "contact@coinos.io" + }; + + mailgun.messages().send(data); + res.send(req.body); + }) +); + imap.once("ready", function() { openInbox(function(err, box) { if (err) throw err; -- cgit v1.2.3 From 8a554b6d3085efc3e4b062bdb0ac61cc0ce89416 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 8 Jul 2021 15:14:57 -0400 Subject: check that token can decode properly --- lib/sockets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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"); -- cgit v1.2.3 From 889e472f78660f4680586ae0606650229e87d75d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 3 Aug 2021 04:44:14 -0400 Subject: silhouettes contact endpoint --- lib/mail.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib') diff --git a/lib/mail.js b/lib/mail.js index 9780fab7..ca2c2b81 100644 --- a/lib/mail.js +++ b/lib/mail.js @@ -10,6 +10,22 @@ 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: "server@coinos.io", + to: "testsil@coinos.io" + }; + + mailgun.messages().send(data); + res.send(req.body); + }) +); + app.post( "/contact", ah((req, res) => { -- cgit v1.2.3 From 05f4be452167da0ee719b6d27b16299c189a748c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 3 Aug 2021 04:44:52 -0400 Subject: increase allowed fee rate --- lib/send.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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"); -- cgit v1.2.3