From 700ee190f840baf48777997d894fc8bed3976330 Mon Sep 17 00:00:00 2001 From: jrtechs Date: Sat, 2 Apr 2022 09:30:07 -0400 Subject: [PATCH] Removed traffic logging logic and removed unused email config --- .gitignore | 2 + admin/analytics.js | 71 ---------------------------------- config.json | 13 ++----- includes/html/adminHeader.html | 3 -- templates/admin/analytics.html | 20 ---------- utils/sql.js | 32 --------------- 6 files changed, 5 insertions(+), 136 deletions(-) delete mode 100644 admin/analytics.js delete mode 100644 templates/admin/analytics.html diff --git a/.gitignore b/.gitignore index 6ba5f92..c72d5dc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ .vscode node_modules package-lock.json +sitemap.txt +db/ diff --git a/admin/analytics.js b/admin/analytics.js deleted file mode 100644 index 727f3e7..0000000 --- a/admin/analytics.js +++ /dev/null @@ -1,71 +0,0 @@ - -/** Whiskers template file */ -const TEMPLATE_FILE = "admin/analytics.html"; - - -const includes = require('../includes/includes.js'); - -//updates db -const sql = require('../utils/sql'); - - -const generateData = function(templateContext) -{ - return new Promise(function(resolve, reject) - { - var data = []; - - sql.getTraffic().then(function(traffic) - { - var start = traffic[0].date; - var currentMonth = new Date(start.getUTCFullYear(), start.getMonth(), 1, 0,0,0); - templateContext.start = JSON.stringify(currentMonth); - var monthCount = 0; - for(var i = 0; i < traffic.length; i++) - { - var currentDate = traffic[i].date; - - if(currentMonth.getMonth() != currentDate.getMonth()) - { - var foo = new Object(); - foo.x = currentMonth; - foo.y = monthCount; - data.push(foo); - monthCount = 0; - currentMonth = new Date(currentDate.getUTCFullYear(), currentDate.getMonth(), 1, 0,0,0); - } - monthCount = monthCount + 1; - } - templateContext.finish = JSON.stringify(currentMonth); - templateContext.dataset = JSON.stringify(data); - resolve(); - }); - }); -}; - - -module.exports= - { - /** - * Fetches context information for the admin blog page and handles post - * data sent regarding editing blog. - * - * @param templateContext json object used as the template context - * @returns {Promise} renders the template used for this page - */ - main: function(templateContext) - { - return new Promise(function(resolve, reject) - { - Promise.all([includes.fetchTemplate(TEMPLATE_FILE), generateData(templateContext)]).then(function(template) - { - templateContext.adminPage = template[0]; - resolve(); - }).catch(function(error) - { - console.log("error in add admin blog.js"); - reject(error); - }); - }); - } - }; \ No newline at end of file diff --git a/config.json b/config.json index 919dc03..776eb51 100644 --- a/config.json +++ b/config.json @@ -1,16 +1,9 @@ { "PORT": 8000, - + "SESSION_SECRET": "random-data-to-seed-session-data", - - "SQL_HOST": "localhost", + "SQL_HOST": "db", "SQL_DATABASE": "jrtechs_blog", "SQL_USER": "root", - "SQL_PASSWORD": "password", - - - "CAPTCHA_SECRET": "captcha-secret", - "GMAIL_ACCOUNT": "email@gmail.com", - "EMAIL_PASSWORD": "email-password", - "DESTINATION_EMAIL": "destination email address" + "SQL_PASSWORD": "password" } \ No newline at end of file diff --git a/includes/html/adminHeader.html b/includes/html/adminHeader.html index 37c79c9..5d9f385 100644 --- a/includes/html/adminHeader.html +++ b/includes/html/adminHeader.html @@ -82,9 +82,6 @@ -