diff --git a/config.json.example b/config.json.example index d771410..49f827b 100644 --- a/config.json.example +++ b/config.json.example @@ -1,4 +1,6 @@ { + // Remove all comments from the config when using it! + "port": 80, "globalSalt": "[global salt (pepper) that is added to every ip before hashing to make it even harder for someone to decode the ip]", "adminUserID": "[the hashed id of the user who can perform admin actions]", diff --git a/src/databases/databases.js b/src/databases/databases.js index 8676292..d01d01f 100644 --- a/src/databases/databases.js +++ b/src/databases/databases.js @@ -3,7 +3,8 @@ var Sqlite3 = require('better-sqlite3'); var fs = require('fs'); let options = { - readonly: config.readOnly + readonly: config.readOnly, + fileMustExist: !config.createDatabaseIfNotExist }; var db = new Sqlite3(config.db, options); diff --git a/src/routes/submitSponsorTimes.js b/src/routes/submitSponsorTimes.js index 30b1f0f..a550f00 100644 --- a/src/routes/submitSponsorTimes.js +++ b/src/routes/submitSponsorTimes.js @@ -168,6 +168,16 @@ module.exports = async function submitSponsorTimes(req, res) { } }] } + }, (err, res) => { + if (err) { + console.log("Failed to send first time submission Discord hook."); + console.log(JSON.stringify(err)); + console.log("\n"); + } else if (res && res.statusCode >= 400) { + console.log("Error sending first time submission Discord hook"); + console.log(JSON.stringify(res)); + console.log("\n"); + } }); }); } diff --git a/src/routes/voteOnSponsorTime.js b/src/routes/voteOnSponsorTime.js index 79c73d6..bc9a326 100644 --- a/src/routes/voteOnSponsorTime.js +++ b/src/routes/voteOnSponsorTime.js @@ -119,6 +119,16 @@ module.exports = async function voteOnSponsorTime(req, res) { } }] } + }, (err, res) => { + if (err) { + console.log("Failed to send reported submission Discord hook."); + console.log(JSON.stringify(err)); + console.log("\n"); + } else if (res && res.statusCode >= 400) { + console.log("Error sending reported submission Discord hook"); + console.log(JSON.stringify(res)); + console.log("\n"); + } }); }); } diff --git a/test/mocks.js b/test/mocks.js index a124646..df19c8a 100644 --- a/test/mocks.js +++ b/test/mocks.js @@ -4,10 +4,12 @@ var app = express(); var config = require('../src/config.js'); app.post('/ReportChannelWebhook', (req, res) => { + console.log("report mock hit"); res.status(200); }); app.post('/FirstTimeSubmissionsWebhook', (req, res) => { + console.log("first time submisson mock hit"); res.status(200); });