Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
levidurfee committed May 23, 2019
2 parents c7a501c + 965e355 commit 833c5dc
Show file tree
Hide file tree
Showing 3 changed files with 4,537 additions and 2 deletions.
13 changes: 11 additions & 2 deletions functions/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const url = require('url-parse');

admin.initializeApp(functions.config().firebase);
const settings = {/* your settings... */ timestampsInSnapshots: true };
admin.firestore().settings(settings);

exports.cspReport = functions.https.onRequest((request, response) => {
let report;

try {
report = JSON.parse(request.body.toString('utf8'));
} catch(e) {
return console.error(e);
}

const report = JSON.parse(request.body.toString('utf8'));
const myurl = new url(report['csp-report']['document-uri']);

report.created_at = Date.now();
Expand All @@ -16,5 +25,5 @@ exports.cspReport = functions.https.onRequest((request, response) => {
}).catch((err) => {
return response.json({result: `Failed. ` + err });
});

});

0 comments on commit 833c5dc

Please sign in to comment.