浏览代码

Merge pull request #106 from gmetais/develop

v1.7.8
Gaël Métais 9 年之前
父节点
当前提交
88b5567131

+ 3 - 1
front/src/css/index.css

@@ -33,7 +33,8 @@
 .settings select {
 .settings select {
   font-size: 1em;
   font-size: 1em;
 }
 }
-.settings input[type=text] {
+.settings input[type=text],
+.settings input[type=password] {
   width: 100%;
   width: 100%;
   min-width: 4em;
   min-width: 4em;
 }
 }
@@ -128,6 +129,7 @@
 .advanced > div > div.label {
 .advanced > div > div.label {
   width: 25%;
   width: 25%;
   white-space: nowrap;
   white-space: nowrap;
+  vertical-align: middle;
 }
 }
 .advanced .subTable {
 .advanced .subTable {
   display: table;
   display: table;

+ 1 - 1
front/src/js/services/apiService.js

@@ -14,7 +14,7 @@ apiService.factory('API', ['$location', 'Runs', 'Results', function($location, R
                 waitForSelector: settings.waitForSelector,
                 waitForSelector: settings.waitForSelector,
                 cookie: settings.cookie,
                 cookie: settings.cookie,
                 authUser: settings.authUser,
                 authUser: settings.authUser,
-                authPass: settings.authPass,
+                authPass: settings.authPass
             };
             };
 
 
             if (settings.waitForSelector && settings.waitForSelector !== '') {
             if (settings.waitForSelector && settings.waitForSelector !== '') {

+ 2 - 1
front/src/less/index.less

@@ -38,7 +38,7 @@
         font-size: 1em;
         font-size: 1em;
     }
     }
 
 
-    input[type=text] {
+    input[type=text], input[type=password] {
         width: 100%;
         width: 100%;
         min-width: 4em;
         min-width: 4em;
     }
     }
@@ -147,6 +147,7 @@
             &.label {
             &.label {
                 width: 25%;
                 width: 25%;
                 white-space: nowrap;
                 white-space: nowrap;
+                vertical-align: middle;
             }
             }
         }
         }
     }
     }

+ 3 - 3
front/src/views/index.html

@@ -42,7 +42,7 @@
                 </div>
                 </div>
                 <div><input type="text" name="cookie" ng-model="settings.cookie" /></div>
                 <div><input type="text" name="cookie" ng-model="settings.cookie" /></div>
             </div>
             </div>
-            <!--<div>
+            <div>
                 <div class="label">
                 <div class="label">
                     Authent
                     Authent
                     <span class="settingsTooltip">
                     <span class="settingsTooltip">
@@ -57,10 +57,10 @@
                     </div>
                     </div>
                     <div>
                     <div>
                         <div><span>password</div>
                         <div><span>password</div>
-                        <div><input type="text" class="authField" name="authPass" ng-model="settings.authPass" /></div>
+                        <div><input type="password" class="authField" name="authPass" ng-model="settings.authPass" /></div>
                     </div>
                     </div>
                 </div>
                 </div>
-            </div>-->
+            </div>
             <!--<div>
             <!--<div>
                 <div class="label">Blocked domains</div>
                 <div class="label">Blocked domains</div>
                 <div>
                 <div>

+ 2 - 2
lib/metadata/policies.js

@@ -152,8 +152,8 @@ var policies = {
         "label": "DOM access on scroll",
         "label": "DOM access on scroll",
         "message": "<p>This rule counts the number of DOM-accessing functions calls on a scroll event, such as queries, readings, writings, bindings and jQuery functions.</p><p>Two scroll events are triggered quickly, one after the other, and only the second one is analyzed so throttled functions are ignored.</p><p>One of the main reasons of a poor scrolling experience is when too much JS is executed on each scroll event. Note that some devices such as smartphones and MacBooks send more scroll events than others.</p><p>Reduce the number of DOM accesses inside scroll listeners. Put DOM queries outside them when possible. Use <a href=\"http://blogorama.nerdworks.in/javascriptfunctionthrottlingan/\" target=\"_blank\">throttling or debouncing</a>.</p>",
         "message": "<p>This rule counts the number of DOM-accessing functions calls on a scroll event, such as queries, readings, writings, bindings and jQuery functions.</p><p>Two scroll events are triggered quickly, one after the other, and only the second one is analyzed so throttled functions are ignored.</p><p>One of the main reasons of a poor scrolling experience is when too much JS is executed on each scroll event. Note that some devices such as smartphones and MacBooks send more scroll events than others.</p><p>Reduce the number of DOM accesses inside scroll listeners. Put DOM queries outside them when possible. Use <a href=\"http://blogorama.nerdworks.in/javascriptfunctionthrottlingan/\" target=\"_blank\">throttling or debouncing</a>.</p>",
         "isOkThreshold": 1,
         "isOkThreshold": 1,
-        "isBadThreshold": 12,
-        "isAbnormalThreshold": 25,
+        "isBadThreshold": 20,
+        "isAbnormalThreshold": 35,
         "hasOffenders": true,
         "hasOffenders": true,
         "offendersTransformFn": function(offenders) {
         "offendersTransformFn": function(offenders) {
             return offenders;
             return offenders;

+ 1 - 1
lib/tools/phantomas/phantomasWrapper.js

@@ -21,7 +21,7 @@ var PhantomasWrapper = function() {
             
             
             // Cusomizable options
             // Cusomizable options
             'engine': task.options.phantomasEngine || 'webkit',
             'engine': task.options.phantomasEngine || 'webkit',
-            'timeout': task.options.timeout || 45,
+            'timeout': task.options.timeout || 30,
             'js-deep-analysis': task.options.jsDeepAnalysis || false,
             'js-deep-analysis': task.options.jsDeepAnalysis || false,
             'user-agent': (task.options.device === 'desktop') ? 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36' : null,
             'user-agent': (task.options.device === 'desktop') ? 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36' : null,
             'tablet': (task.options.device === 'tablet'),
             'tablet': (task.options.device === 'tablet'),

+ 19 - 2
lib/tools/weightChecker/weightChecker.js

@@ -33,11 +33,19 @@ var WeightChecker = function() {
         delete data.toolsResults.phantomas.metrics.requestsList;
         delete data.toolsResults.phantomas.metrics.requestsList;
         delete data.toolsResults.phantomas.offenders.requestsList;
         delete data.toolsResults.phantomas.offenders.requestsList;
 
 
+        var httpAuth = null;
+        if (data.params && data.params.options && data.params.options.authUser && data.params.options.authPass) {
+            httpAuth = {
+                username: data.params.options.authUser,
+                password: data.params.options.authPass
+            };
+        }
+
         // Transform every request into a download function with a callback when done
         // Transform every request into a download function with a callback when done
         var redownloadList = requestsList.map(function(entry) {
         var redownloadList = requestsList.map(function(entry) {
             return function(callback) {
             return function(callback) {
                 
                 
-                redownloadEntry(entry)
+                redownloadEntry(entry, httpAuth)
 
 
                 .then(imageOptimizer.optimizeImage)
                 .then(imageOptimizer.optimizeImage)
 
 
@@ -313,7 +321,7 @@ var WeightChecker = function() {
     }
     }
 
 
 
 
-    function redownloadEntry(entry) {
+    function redownloadEntry(entry, httpAuth) {
         var deferred = Q.defer();
         var deferred = Q.defer();
         
         
         function downloadError(message) {
         function downloadError(message) {
@@ -367,6 +375,15 @@ var WeightChecker = function() {
             timeout: REQUEST_TIMEOUT
             timeout: REQUEST_TIMEOUT
         };
         };
 
 
+        // Basic auth
+        if (httpAuth) {
+            requestOptions.auth = {
+                user: httpAuth.username,
+                pass: httpAuth.password,
+                sendImmediately: false // Tries a first time without auth, wait for a 401 error before resending
+            };
+        }
+
         download(requestOptions, entry.contentType, function(error, result) {
         download(requestOptions, entry.contentType, function(error, result) {
             if (error) {
             if (error) {
                 if (error.code === 'ETIMEDOUT') {
                 if (error.code === 'ETIMEDOUT') {

+ 4 - 4
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "yellowlabtools",
   "name": "yellowlabtools",
-  "version": "1.7.7",
+  "version": "1.7.8",
   "description": "Online tool to audit a webpage for performance and front-end quality issues",
   "description": "Online tool to audit a webpage for performance and front-end quality issues",
   "license": "GPL-2.0",
   "license": "GPL-2.0",
   "author": {
   "author": {
@@ -27,7 +27,7 @@
     "async": "1.4.2",
     "async": "1.4.2",
     "body-parser": "1.13.3",
     "body-parser": "1.13.3",
     "chart.js": "1.0.2",
     "chart.js": "1.0.2",
-    "clean-css": "3.4.1",
+    "clean-css": "3.4.2",
     "compression": "1.5.2",
     "compression": "1.5.2",
     "cors": "2.7.1",
     "cors": "2.7.1",
     "debug": "2.2.0",
     "debug": "2.2.0",
@@ -37,8 +37,8 @@
     "jstoxml": "0.2.3",
     "jstoxml": "0.2.3",
     "lwip": "0.0.7",
     "lwip": "0.0.7",
     "meow": "3.3.0",
     "meow": "3.3.0",
-    "minimize": "1.7.0",
-    "phantomas": "1.11.0",
+    "minimize": "1.7.1",
+    "phantomas": "1.12.0",
     "ps-node": "0.0.4",
     "ps-node": "0.0.4",
     "q": "1.4.1",
     "q": "1.4.1",
     "request": "2.61.0",
     "request": "2.61.0",