From e4ca2bb8cf484ee1f77c56aa464c33cdfe2eeb24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Tue, 27 Nov 2018 08:56:13 +0100 Subject: [PATCH 1/4] Trying adsense to help serverbills --- .gitignore | 1 + server/config/analytics.example.js | 3 --- server/public/layouts/client/main.handlebars | 9 +++++++ server/routing/client/router.js | 26 +++++++++++++++++++- 4 files changed, 35 insertions(+), 4 deletions(-) delete mode 100644 server/config/analytics.example.js diff --git a/.gitignore b/.gitignore index 675bc78e..1ffdf0f4 100755 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ server/config/mongo_config.js server/config/cert_config.js server/config/recaptcha.js server/config/analytics.js +server/config/google.js server/public/assets/dist/maps/ server/public/assets/dist/callback.min.js server/public/assets/dist/token.min.js diff --git a/server/config/analytics.example.js b/server/config/analytics.example.js deleted file mode 100644 index 55b17d48..00000000 --- a/server/config/analytics.example.js +++ /dev/null @@ -1,3 +0,0 @@ -var analytics = "xxxx"; - -module.exports = analytics; diff --git a/server/public/layouts/client/main.handlebars b/server/public/layouts/client/main.handlebars index 2dfc8131..69d08e79 100644 --- a/server/public/layouts/client/main.handlebars +++ b/server/public/layouts/client/main.handlebars @@ -47,6 +47,15 @@ } } + {{#if adds}} + + + {{/if}} {{/unless}} diff --git a/server/routing/client/router.js b/server/routing/client/router.js index 0e566d08..7ceaaefd 100644 --- a/server/routing/client/router.js +++ b/server/routing/client/router.js @@ -4,6 +4,9 @@ var path = require('path'); var year = new Date().getYear()+1900; var path = require('path'); var analytics = "xx"; +var google = {}; +var adsense = "xx"; +var adds = true; var mongojs = require('mongojs'); var token_db = mongojs("tokens"); var Functions = require(pathThumbnails + '/handlers/functions.js'); @@ -13,10 +16,17 @@ var db = require(pathThumbnails + '/handlers/db.js'); //var db = require(pathThumbnails + '/handlers/db.js'); try { - analytics = require(path.join(path.join(__dirname, '../../config/'), 'analytics.js')); + google = require(path.join(path.join(__dirname, '../../config/'), 'google.js')); + analytics = google.analytics; } catch(e) { console.log("No analytics-id found"); } +try { + adsense = google.adsense; +} catch(e) { + adds = false; + console.log("No adsense-id found"); +} try { var Recaptcha = require('express-recaptcha'); var recaptcha_config = require(path.join(path.join(__dirname, '../../config/'), 'recaptcha.js')); @@ -81,6 +91,8 @@ router.route('/api/apply').get(function(req, res, next) { javascript_file: "token.min.js", captcha: res.recaptcha, analytics: analytics, + adsense: adsense, + adds: adds, type: "website", activated: false, id: "", @@ -103,6 +115,8 @@ router.route('/api/apply/:id').get(function(req, res) { javascript_file: "token.min.js", captcha: res.recaptcha, analytics: analytics, + adsense: adsense, + adds: adds, activated: true, type: "website", token: result[0].token, @@ -120,6 +134,8 @@ router.route('/api/apply/:id').get(function(req, res) { javascript_file: "token.min.js", captcha: res.recaptcha, analytics: analytics, + adsense: adsense, + adds: adds, activated: false, token:"", type: "website", @@ -147,6 +163,8 @@ function root(req, res, next) { year: year, javascript_file: "remote.min.js", captcha: res.recaptcha, + adsense: adsense, + adds: adds, analytics: analytics, type: "website", stylesheet: "style.css", @@ -162,6 +180,8 @@ function root(req, res, next) { year: year, javascript_file: "main.min.js", captcha: res.recaptcha, + adsense: adsense, + adds: adds, analytics: analytics, stylesheet: "style.css", type: "website", @@ -209,6 +229,8 @@ function channel(req, res, next) { year: year, javascript_file: "remote.min.js", captcha: res.recaptcha, + adsense: adsense, + adds: adds, analytics: analytics, type: "website", stylesheet: "style.css", @@ -241,6 +263,8 @@ function channel(req, res, next) { year: year, javascript_file: "main.min.js", captcha: res.recaptcha, + adsense: adsense, + adds: adds, analytics: analytics, type: "video", stylesheet: "style.css", From e21865422dfc5890f3a4b1a068b20aec17655328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Tue, 27 Nov 2018 08:57:03 +0100 Subject: [PATCH 2/4] Added examplefile --- server/config/google.example.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 server/config/google.example.js diff --git a/server/config/google.example.js b/server/config/google.example.js new file mode 100644 index 00000000..55393054 --- /dev/null +++ b/server/config/google.example.js @@ -0,0 +1,6 @@ +var google = { + "analytics": "xxxx", + "adsense": "ca-pub-8428196254301338"; +} + +module.exports = google; From 10f9ff87da8cd97b2665f40e041657cd3936233b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Tue, 27 Nov 2018 08:57:55 +0100 Subject: [PATCH 3/4] Not including our adcode --- server/config/google.example.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/config/google.example.js b/server/config/google.example.js index 55393054..9c65eafe 100644 --- a/server/config/google.example.js +++ b/server/config/google.example.js @@ -1,6 +1,6 @@ var google = { "analytics": "xxxx", - "adsense": "ca-pub-8428196254301338"; + "adsense": "xxxx; } module.exports = google; From 1849727ff8455c1a5c91c2dc21fb677cf8c39a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Tue, 27 Nov 2018 08:58:31 +0100 Subject: [PATCH 4/4] Correct syntax --- server/config/google.example.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/config/google.example.js b/server/config/google.example.js index 9c65eafe..b1174cb3 100644 --- a/server/config/google.example.js +++ b/server/config/google.example.js @@ -1,6 +1,6 @@ var google = { "analytics": "xxxx", - "adsense": "xxxx; + "adsense": "xxxx", } module.exports = google;