From dbbd01a83d902e462ce960d94f8c0dccb40e6a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Wed, 28 Mar 2018 20:10:56 -0500 Subject: [PATCH 1/7] Fix about text --- front/src/views/about.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/src/views/about.html b/front/src/views/about.html index 142ec4f..dab850c 100644 --- a/front/src/views/about.html +++ b/front/src/views/about.html @@ -1,7 +1,7 @@
-

Yellow Lab Tools is an open source project by Gaël Métais. It lets you test a webpage (via an URL) and detects performance and front-end code quality issues.

+

Yellow Lab Tools is an open source project by Gaël Métais. It allows you to test a webpage (via an URL) and detects performance and front-end code quality issues.

-

This is done by loading the webpage via PhantomJS and collecting various metrics and statistics with the help of Phantomas. These metrics are categorized and transformed into scores. It also gives in-depth details so developpers can correct the detected issues.

+

This is done by loading the webpage via PhantomJS and collecting various metrics and statistics with the help of Phantomas. These metrics are categorized and transformed into scores. It also gives in-depth details so that developers can correct the detected issues.

By the way, it's free because we are geeks, not businessmen. All we want is a on GitHub. It will boost our motivation to add more awesome features!!!

From cab3f57737d7713a2c370ac2d5885215c2092305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Wed, 17 Jan 2018 10:21:11 -0600 Subject: [PATCH 2/7] Getting ready for HTTPS & HTTP/2 --- README.md | 2 +- front/src/js/controllers/dashboardCtrl.js | 4 ++-- front/src/js/directives/offendersDirectives.js | 11 +++++++++++ front/src/main.html | 8 ++++---- front/src/views/rule.html | 6 +++--- package.json | 2 +- 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 85b2675..4b541b1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Analyzes a webpage and detects **performance** or **front-end code quality** iss The online tool (recommended): - http://yellowlab.tools + https://yellowlab.tools diff --git a/front/src/js/controllers/dashboardCtrl.js b/front/src/js/controllers/dashboardCtrl.js index b8f2115..76aab21 100644 --- a/front/src/js/controllers/dashboardCtrl.js +++ b/front/src/js/controllers/dashboardCtrl.js @@ -41,11 +41,11 @@ dashboardCtrl.controller('DashboardCtrl', ['$scope', '$rootScope', '$routeParams }; $scope.shareOnTwitter = function(message) { - openSocialPopup('https://twitter.com/intent/tweet?text=' + encodeURIComponent(message + 'http://yellowlab.tools')); + openSocialPopup('https://twitter.com/intent/tweet?text=' + encodeURIComponent(message + 'https://yellowlab.tools')); }; $scope.shareOnLinkedin = function(message) { - openSocialPopup('https://www.linkedin.com/shareArticle?mini=true&url=http://yellowlab.tools&title=' + encodeURIComponent(message) + '&summary=' + encodeURIComponent('YellowLabTools is a free online tool that analyzes performance and front-end quality of a webpage.')); + openSocialPopup('https://www.linkedin.com/shareArticle?mini=true&url=https://yellowlab.tools&title=' + encodeURIComponent(message) + '&summary=' + encodeURIComponent('YellowLabTools is a free online tool that analyzes performance and front-end quality of a webpage.')); }; function openSocialPopup(url) { diff --git a/front/src/js/directives/offendersDirectives.js b/front/src/js/directives/offendersDirectives.js index f9d747e..434598a 100644 --- a/front/src/js/directives/offendersDirectives.js +++ b/front/src/js/directives/offendersDirectives.js @@ -924,4 +924,15 @@ }; }); + // Proxify an HTTP image to HTTPS if hosted on HTTPS + // Uses a great free open-source external service: https://images.weserv.nl + offendersDirectives.filter('https', function() { + return function(url) { + if (url && url.indexOf('http://') === 0 && window.location.protocol === 'https:') { + return 'https://images.weserv.nl/?url=' + encodeURIComponent(url.substr(7)); + } + return url; + }; + }); + })(); diff --git a/front/src/main.html b/front/src/main.html index fce557d..eec3f07 100644 --- a/front/src/main.html +++ b/front/src/main.html @@ -18,10 +18,10 @@ - - - - + + + + diff --git a/front/src/views/rule.html b/front/src/views/rule.html index f011a2a..8238c17 100644 --- a/front/src/views/rule.html +++ b/front/src/views/rule.html @@ -133,7 +133,7 @@
- +
@@ -267,7 +267,7 @@
Current file: -
+

Current weight: {{image.original | bytes}}

@@ -364,7 +364,7 @@
Weight (bytes)
-
+
{{request.size}}
diff --git a/package.json b/package.json index cbdea7d..2406783 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "author": { "name": "Gaël Métais", "email": "gael@gaelmetais.com", - "url": "http://www.gaelmetais.com" + "url": "https://www.gaelmetais.com" }, "repository": { "type": "git", From 95659839b21d1032c9b3c45975af032f4bd1deb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sat, 31 Mar 2018 09:28:21 -0500 Subject: [PATCH 3/7] Fix IP address filtering when behind a proxy --- lib/server/middlewares/apiLimitsMiddleware.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/server/middlewares/apiLimitsMiddleware.js b/lib/server/middlewares/apiLimitsMiddleware.js index 7e2c643..0ebe205 100644 --- a/lib/server/middlewares/apiLimitsMiddleware.js +++ b/lib/server/middlewares/apiLimitsMiddleware.js @@ -6,25 +6,27 @@ var debug = require('debug')('apiLimitsMiddleware'); var apiLimitsMiddleware = function(req, res, next) { 'use strict'; - debug('Entering API Limits Middleware with IP address %s', req.connection.remoteAddress); + var ipAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress; + + debug('Entering API Limits Middleware with IP address %s', ipAddress); if (req.path.indexOf('/api/') === 0 && !res.locals.hasApiKey) { if (req.path === '/api/runs') { - if (!runsTable.accepts(req.connection.remoteAddress)) { + if (!runsTable.accepts(ipAddress)) { // Sorry :/ - debug('Too many tests launched from IP address %s', req.connection.remoteAddress); + debug('Too many tests launched from IP address %s', ipAddress); res.status(429).send('Too many requests'); return; } } - if (!callsTable.accepts(req.connection.remoteAddress)) { + if (!callsTable.accepts(ipAddress)) { // Sorry :/ - debug('Too many API requests from IP address %s', req.connection.remoteAddress); + debug('Too many API requests from IP address %s', ipAddress); res.status(429).send('Too many requests'); return; } From 214b3c75d0002a07cbde3cb12a2ad2922490569e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sun, 1 Apr 2018 00:24:27 -0500 Subject: [PATCH 4/7] Fix test timeout --- test/core/imageOptimizerTest.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/core/imageOptimizerTest.js b/test/core/imageOptimizerTest.js index 3238e3f..8d37f5f 100644 --- a/test/core/imageOptimizerTest.js +++ b/test/core/imageOptimizerTest.js @@ -161,6 +161,8 @@ describe('imageOptimizer', function() { }); it('should optimize an SVG image losslessly', function(done) { + this.timeout(5000); + var fileContent = fs.readFileSync(path.resolve(__dirname, '../www/svg-image.svg')); var fileSize = fileContent.length; From e2d60dde4374fb80c3bebb88846230003b31114e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Wed, 4 Apr 2018 16:10:15 -0500 Subject: [PATCH 5/7] v1.13.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2406783..8e40168 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yellowlabtools", - "version": "1.13.1", + "version": "1.13.2", "description": "Online tool to audit a webpage for performance and front-end quality issues", "license": "GPL-2.0", "author": { From b3399f419ea1c8cf5ac7dbf5df60bd52bb8ae39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Thu, 5 Apr 2018 19:07:38 -0500 Subject: [PATCH 6/7] Add sponsoring slots on home, dashboard and about pages --- front/src/css/dashboard.css | 16 ++++++++-------- front/src/css/index.css | 3 +++ front/src/css/main.css | 3 +++ front/src/less/dashboard.less | 18 +++++++++--------- front/src/less/index.less | 4 ++++ front/src/less/main.less | 3 +++ front/src/views/about.html | 4 ++++ front/src/views/dashboard.html | 7 ++++--- front/src/views/index.html | 4 ++++ lib/server/controllers/frontController.js | 5 ++++- server_config/settings-prod.json | 8 +++++++- server_config/settings.json | 8 +++++++- 12 files changed, 60 insertions(+), 23 deletions(-) diff --git a/front/src/css/dashboard.css b/front/src/css/dashboard.css index 104695f..c5e089a 100644 --- a/front/src/css/dashboard.css +++ b/front/src/css/dashboard.css @@ -158,14 +158,6 @@ .summary .fromShare { margin-bottom: 3em; } -.summary .apiTip { - font-size: 0.8em; - margin-bottom: 4em; - color: #413; -} -.summary .apiTip a { - color: inherit; -} .summary .tweet .tweetText { color: #413; background: #F2F2F2; @@ -189,3 +181,11 @@ .summary .tweet input { font-size: 0.9em; } +.summary .sponsor { + font-size: 0.9em; + margin-bottom: 4em; + color: #413; +} +.summary .sponsor a { + color: inherit; +} diff --git a/front/src/css/index.css b/front/src/css/index.css index 8bcc1ff..20f1b18 100644 --- a/front/src/css/index.css +++ b/front/src/css/index.css @@ -177,3 +177,6 @@ input[type=submit].clicked { top: 0.2em; box-shadow: none; } +.homeSponsor { + margin-top: 3em; +} diff --git a/front/src/css/main.css b/front/src/css/main.css index c870840..add9c9c 100644 --- a/front/src/css/main.css +++ b/front/src/css/main.css @@ -295,6 +295,9 @@ a.linkButton { .footer .github { margin: 1em 0 0 0.5em; } +.footer .sponsor { + font-size: 0.9em; +} [class^="icon-"]:before, [class*=" icon-"]:before { vertical-align: baseline; diff --git a/front/src/less/dashboard.less b/front/src/less/dashboard.less index b46ed02..974ec04 100644 --- a/front/src/less/dashboard.less +++ b/front/src/less/dashboard.less @@ -158,15 +158,6 @@ margin-bottom: 3em; } -.summary .apiTip { - font-size: 0.8em; - margin-bottom: 4em; - color: #413; - a { - color: inherit; - } -} - .summary .tweet { .tweetText { color: #413; @@ -189,4 +180,13 @@ input { font-size: 0.9em; } +} + +.summary .sponsor { + font-size: 0.9em; + margin-bottom: 4em; + color: #413; + a { + color: inherit; + } } \ No newline at end of file diff --git a/front/src/less/index.less b/front/src/less/index.less index bbc8b4d..6892452 100644 --- a/front/src/less/index.less +++ b/front/src/less/index.less @@ -199,4 +199,8 @@ input[type=submit].clicked { left: 0.1em; top: 0.2em; box-shadow: none; +} + +.homeSponsor { + margin-top: 3em; } \ No newline at end of file diff --git a/front/src/less/main.less b/front/src/less/main.less index 2aac50b..3d5bbe3 100644 --- a/front/src/less/main.less +++ b/front/src/less/main.less @@ -250,6 +250,9 @@ a.linkButton { .github { margin: 1em 0 0 0.5em; } + .sponsor { + font-size: 0.9em; + } } [class^="icon-"]:before, [class*=" icon-"]:before { diff --git a/front/src/views/about.html b/front/src/views/about.html index dab850c..e838117 100644 --- a/front/src/views/about.html +++ b/front/src/views/about.html @@ -5,5 +5,9 @@

By the way, it's free because we are geeks, not businessmen. All we want is a on GitHub. It will boost our motivation to add more awesome features!!!

+ <%if (sponsoring.about) { %> + + <% } %> +


Back to index

\ No newline at end of file diff --git a/front/src/views/dashboard.html b/front/src/views/dashboard.html index 955bdba..ecc4692 100644 --- a/front/src/views/dashboard.html +++ b/front/src/views/dashboard.html @@ -55,9 +55,10 @@ -
- Did you know? You can bookmark this result page URL or share it, Yellow Lab Tools keeps test results for years! -
+ <%if (sponsoring.dashboard) { %> + + <% } %> +
diff --git a/front/src/views/index.html b/front/src/views/index.html index 6e376dc..0bed0eb 100644 --- a/front/src/views/index.html +++ b/front/src/views/index.html @@ -110,3 +110,7 @@

Untangles the JavaScript spaghetti code

+ +<%if (sponsoring.home) { %> +
<%- sponsoring.home %>
+<% } %> \ No newline at end of file diff --git a/lib/server/controllers/frontController.js b/lib/server/controllers/frontController.js index f193a29..fb156c6 100644 --- a/lib/server/controllers/frontController.js +++ b/lib/server/controllers/frontController.js @@ -1,6 +1,8 @@ var path = require('path'); var express = require('express'); +var serverSettings = (process.env.IS_TEST) ? require('../../../test/fixtures/settings.json') : require('../../../server_config/settings.json'); + var FrontController = function(app) { 'use strict'; @@ -23,7 +25,8 @@ var FrontController = function(app) { app.get('/views/:viewName', function(req, res) { res.setHeader('Cache-Control', 'public, max-age=' + cacheDuration); res.render(path.join(__dirname, assetsPath, 'views/' + req.params.viewName), { - baseUrl: app.locals.baseUrl || '/' + baseUrl: app.locals.baseUrl || '/', + sponsoring: serverSettings.sponsoring || {} }); }); diff --git a/server_config/settings-prod.json b/server_config/settings-prod.json index b219b33..aff5cc0 100644 --- a/server_config/settings-prod.json +++ b/server_config/settings-prod.json @@ -9,5 +9,11 @@ }, "maxAnonymousRunsPerDay": 99999999, "maxAnonymousCallsPerDay": 99999999, - "blockedUrls": [] + "blockedUrls": [], + + "sponsoring" : { + "home": "(this is a private instance)", + "dashboard": null, + "about": "(this is a private instance)" + } } \ No newline at end of file diff --git a/server_config/settings.json b/server_config/settings.json index 25f19fc..a23c7ff 100644 --- a/server_config/settings.json +++ b/server_config/settings.json @@ -9,5 +9,11 @@ }, "maxAnonymousRunsPerDay": 99999999, "maxAnonymousCallsPerDay": 99999999, - "blockedUrls": [] + "blockedUrls": [], + + "sponsoring" : { + "home": "(this is a private instance)", + "dashboard": null, + "about": "(this is a private instance)" + } } \ No newline at end of file From 7dd611b61ab7524a4ab02fef35d67a5df7a15d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Thu, 5 Apr 2018 20:31:09 -0500 Subject: [PATCH 7/7] Fix production env --- lib/server/controllers/frontController.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/server/controllers/frontController.js b/lib/server/controllers/frontController.js index fb156c6..83b66c3 100644 --- a/lib/server/controllers/frontController.js +++ b/lib/server/controllers/frontController.js @@ -16,7 +16,8 @@ var FrontController = function(app) { app.get(route, function(req, res) { res.setHeader('Cache-Control', 'public, max-age=20'); res.render(path.join(__dirname, assetsPath, 'main.html'), { - baseUrl: app.locals.baseUrl || '/' + baseUrl: app.locals.baseUrl || '/', + sponsoring: serverSettings.sponsoring || {} }); }); });