diff --git a/server.js b/server.js index 546155738..ab7fbc144 100644 --- a/server.js +++ b/server.js @@ -23,7 +23,7 @@ const app = express(); const port = process.env.PORT || 5000; //const port = 5000; -app.use(fb.validateFirebaseIdToken); +//app.use(fb.validateFirebaseIdToken); app.use(compression()); app.use(bodyParser.json({ limit: "50mb" })); app.use(bodyParser.urlencoded({ limit: "50mb", extended: true })); @@ -32,7 +32,7 @@ app.use(cors()); //Email Based Paths. var sendEmail = require("./sendemail.js"); -app.post("/sendemail", sendEmail.sendEmail); +app.post("/sendemail", fb.validateFirebaseIdToken, sendEmail.sendEmail); //Test route to ensure Express is responding. app.get("/test", async function (req, res) { @@ -43,18 +43,38 @@ app.post("/test", test.testResponse); //Accounting-IIF const accountingIIF = require("./server/accounting/iif/iif"); -app.post("/accounting/iif/receivables", accountingIIF.receivables); +app.post( + "/accounting/iif/receivables", + fb.validateFirebaseIdToken, + accountingIIF.receivables +); //Accounting Qbxml const accountQbxml = require("./server/accounting/qbxml/qbxml"); -app.post("/accounting/qbxml/receivables", accountQbxml.receivables); -app.post("/accounting/qbxml/payables", accountQbxml.payables); -app.post("/accounting/qbxml/payments", accountQbxml.payments); +app.post( + "/accounting/qbxml/receivables", + fb.validateFirebaseIdToken, + accountQbxml.receivables +); +app.post( + "/accounting/qbxml/payables", + fb.validateFirebaseIdToken, + accountQbxml.payables +); +app.post( + "/accounting/qbxml/payments", + fb.validateFirebaseIdToken, + accountQbxml.payments +); //Cloudinary Media Paths var media = require("./server/media/media"); -app.post("/media/sign", media.createSignedUploadURL); -app.post("/media/download", media.downloadFiles); +app.post( + "/media/sign", + fb.validateFirebaseIdToken, + media.createSignedUploadURL +); +app.post("/media/download", fb.validateFirebaseIdToken, media.downloadFiles); //SMS/Twilio Paths var smsReceive = require("./server/sms/receive"); @@ -64,7 +84,7 @@ app.post( smsReceive.receive ); var smsSend = require("./server/sms/send"); -app.post("/sms/send", smsSend.send); +app.post("/sms/send", fb.validateFirebaseIdToken, smsSend.send); var smsStatus = require("./server/sms/status"); app.post( "/sms/status", @@ -73,26 +93,34 @@ app.post( ); var job = require("./server/job/job"); -app.post("/job/totals", job.totals); +app.post("/job/totals", fb.validateFirebaseIdToken, job.totals); //Scheduling var scheduling = require("./server/scheduling/scheduling-job"); -app.post("/scheduling/job", scheduling.job); +app.post("/scheduling/job", fb.validateFirebaseIdToken, scheduling.job); //Handlebars Paths for Email/Report Rendering var renderHandlebars = require("./server/render/renderHandlebars"); -app.post("/render", renderHandlebars.render); +app.post("/render", fb.validateFirebaseIdToken, renderHandlebars.render); -app.post("/notifications/send", fb.sendNotification); +app.post( + "/notifications/send", + fb.validateFirebaseIdToken, + fb.sendNotification +); //Stripe Processing var stripe = require("./server/stripe/payment"); -app.post("/stripe/payment", stripe.payment); -app.post("/stripe/mobilepayment", stripe.mobile_payment); +app.post("/stripe/payment", fb.validateFirebaseIdToken, stripe.payment); +app.post( + "/stripe/mobilepayment", + fb.validateFirebaseIdToken, + stripe.mobile_payment +); //Tech Console var tech = require("./server/tech/tech"); -app.post("/tech/login", tech.techLogin); +app.post("/tech/login", fb.validateFirebaseIdToken, tech.techLogin); var utils = require("./server/utils/utils"); app.post("/utils/time", utils.servertime);