diff --git a/.meteor/packages b/.meteor/packages index 4caa2b1a..e9d6e5aa 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -56,3 +56,4 @@ ostrio:cookies email meteorhacks:kadira pauldowman:dotenv +ostrio:flow-router-meta diff --git a/.meteor/versions b/.meteor/versions index 6ad6f714..a6f24e41 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -95,6 +95,8 @@ observe-sequence@1.0.16 ordered-dict@1.0.9 ostrio:cookies@2.3.0 ostrio:flow-router-extra@3.5.0 +ostrio:flow-router-meta@2.0.14 +ostrio:flow-router-title@3.1.3 ostrio:logger@2.0.6 ostrio:loggermongo@2.0.3 pauldowman:dotenv@1.0.1 diff --git a/client/root.html b/client/root.html index acf5fc61..adeab486 100644 --- a/client/root.html +++ b/client/root.html @@ -1,5 +1,12 @@ - BLOCKRAZOR - - - + BLOCKRAZOR + + + + + + + + + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 40d91ed4..38a6424c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2552,7 +2552,7 @@ }, "eslint": { "version": "4.19.1", - "resolved": "http://registry.npmjs.org/eslint/-/eslint-4.19.1.tgz", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.19.1.tgz", "integrity": "sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ==", "dev": true, "requires": { @@ -6638,7 +6638,7 @@ }, "wdio-mocha-framework": { "version": "0.5.13", - "resolved": "http://registry.npmjs.org/wdio-mocha-framework/-/wdio-mocha-framework-0.5.13.tgz", + "resolved": "https://registry.npmjs.org/wdio-mocha-framework/-/wdio-mocha-framework-0.5.13.tgz", "integrity": "sha512-sg9EXWJLVTaLgJBOESvfhz3IWN8ujYFU35bazLtHCfmH3t8G9Fy7nNezJ/QdMBB5Ug1yyISynXkn2XWFJ+Tvgw==", "requires": { "babel-runtime": "6.26.0", diff --git a/server/server.routes.js b/server/server.routes.js new file mode 100644 index 00000000..5694100d --- /dev/null +++ b/server/server.routes.js @@ -0,0 +1,65 @@ +import { WebApp } from 'meteor/webapp'; +import { Currencies } from '/imports/api/coins/currencies.js' + +const serverRendering = (req, res, next) => { + try { + + const ua = req.headers['user-agent']; + const pathName = req._parsedUrl.pathname; + if (/bot|WhatsApp|facebook|twitter|pinterest|google|baidu|bing|msn|duckduckgo|teoma|slurp|yandex/i.test(ua)) { + + // Send any non matches forward + if (!pathName.includes('/currency')) { + next(); + } + + var parts = req.url.split("/") + + let currency = Currencies.findOne({ + slug: parts[2] + }) + + let count = Currencies.find({ + slug: parts[2] + }).count(); + + let meteorURL = 'https://blockrazor.org/' + parts[2] + + if(count){ + + // Fetch the data you need to build your tags (and htmlContent) + const html = ` + + + + BlockRazor + + + + + + + + + Hello Bot, plz index us! + + + `; + res.statusCode = 200; + res.setHeader('Content-Type', 'text/html'); + res.end(html); + }else{ + console.log('can not get any content for some unknown reason, plz investigate : ( ') + } + + } else { + + next(); + } + } catch (err) { + console.log(err); + } +} + +// attach the handler to webapp +WebApp.connectHandlers.use(serverRendering); \ No newline at end of file