diff --git a/.gitattributes b/.gitattributes index 569c27415..8984c4bd8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ -libmproxy/web/static/**/* -diff \ No newline at end of file +libmproxy/web/static/**/* -diff +web/src/js/filt/filt.js -diff \ No newline at end of file diff --git a/libmproxy/web/static/js/app.js b/libmproxy/web/static/js/app.js index 6a886c11e..d7c070899 100644 --- a/libmproxy/web/static/js/app.js +++ b/libmproxy/web/static/js/app.js @@ -39,7 +39,7 @@ var Navigation = _.extend({}, ReactRouter.Navigation, { if(query === undefined){ query = this.context.getCurrentQuery(); } - ReactRouter.Navigation.replaceWith.call(this,routeNameOrPath, params, query); + ReactRouter.Navigation.replaceWith.call(this, routeNameOrPath, params, query); } }); @@ -287,102 +287,103 @@ Filt = (function() { peg$c0 = { type: "other", description: "filter expression" }, peg$c1 = peg$FAILED, peg$c2 = function(orExpr) { return orExpr; }, - peg$c3 = { type: "other", description: "whitespace" }, - peg$c4 = /^[ \t\n\r]/, - peg$c5 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" }, - peg$c6 = { type: "other", description: "control character" }, - peg$c7 = /^[|&!()~"]/, - peg$c8 = { type: "class", value: "[|&!()~\"]", description: "[|&!()~\"]" }, - peg$c9 = { type: "other", description: "optional whitespace" }, - peg$c10 = [], - peg$c11 = "|", - peg$c12 = { type: "literal", value: "|", description: "\"|\"" }, - peg$c13 = function(first, second) { return or(first, second); }, - peg$c14 = "&", - peg$c15 = { type: "literal", value: "&", description: "\"&\"" }, - peg$c16 = function(first, second) { return and(first, second); }, - peg$c17 = "!", - peg$c18 = { type: "literal", value: "!", description: "\"!\"" }, - peg$c19 = function(expr) { return not(expr); }, - peg$c20 = "(", - peg$c21 = { type: "literal", value: "(", description: "\"(\"" }, - peg$c22 = ")", - peg$c23 = { type: "literal", value: ")", description: "\")\"" }, - peg$c24 = function(expr) { return binding(orExpr); }, - peg$c25 = "~a", - peg$c26 = { type: "literal", value: "~a", description: "\"~a\"" }, - peg$c27 = function() { return assetFilter; }, - peg$c28 = "~e", - peg$c29 = { type: "literal", value: "~e", description: "\"~e\"" }, - peg$c30 = function() { return errorFilter; }, - peg$c31 = "~q", - peg$c32 = { type: "literal", value: "~q", description: "\"~q\"" }, - peg$c33 = function() { return noResponseFilter; }, - peg$c34 = "~s", - peg$c35 = { type: "literal", value: "~s", description: "\"~s\"" }, - peg$c36 = function() { return responseFilter; }, - peg$c37 = "true", - peg$c38 = { type: "literal", value: "true", description: "\"true\"" }, - peg$c39 = function() { return trueFilter; }, - peg$c40 = "false", - peg$c41 = { type: "literal", value: "false", description: "\"false\"" }, - peg$c42 = function() { return falseFilter; }, - peg$c43 = "~c", - peg$c44 = { type: "literal", value: "~c", description: "\"~c\"" }, - peg$c45 = function(s) { return responseCode(s); }, - peg$c46 = "~d", - peg$c47 = { type: "literal", value: "~d", description: "\"~d\"" }, - peg$c48 = function(s) { return domain(s); }, - peg$c49 = "~h", - peg$c50 = { type: "literal", value: "~h", description: "\"~h\"" }, - peg$c51 = function(s) { return header(s); }, - peg$c52 = "~hq", - peg$c53 = { type: "literal", value: "~hq", description: "\"~hq\"" }, - peg$c54 = function(s) { return requestHeader(s); }, - peg$c55 = "~hs", - peg$c56 = { type: "literal", value: "~hs", description: "\"~hs\"" }, - peg$c57 = function(s) { return responseHeader(s); }, - peg$c58 = "~m", - peg$c59 = { type: "literal", value: "~m", description: "\"~m\"" }, - peg$c60 = function(s) { return method(s); }, - peg$c61 = "~t", - peg$c62 = { type: "literal", value: "~t", description: "\"~t\"" }, - peg$c63 = function(s) { return contentType(s); }, - peg$c64 = "~tq", - peg$c65 = { type: "literal", value: "~tq", description: "\"~tq\"" }, - peg$c66 = function(s) { return requestContentType(s); }, - peg$c67 = "~ts", - peg$c68 = { type: "literal", value: "~ts", description: "\"~ts\"" }, - peg$c69 = function(s) { return responseContentType(s); }, - peg$c70 = "~u", - peg$c71 = { type: "literal", value: "~u", description: "\"~u\"" }, - peg$c72 = function(s) { return url(s); }, - peg$c73 = { type: "other", description: "string" }, - peg$c74 = "\"", - peg$c75 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c76 = function(chars) { return chars.join(""); }, - peg$c77 = "'", - peg$c78 = { type: "literal", value: "'", description: "\"'\"" }, - peg$c79 = void 0, - peg$c80 = /^["\\]/, - peg$c81 = { type: "class", value: "[\"\\\\]", description: "[\"\\\\]" }, - peg$c82 = { type: "any", description: "any character" }, - peg$c83 = function(char) { return char; }, - peg$c84 = "\\", - peg$c85 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c86 = /^['\\]/, - peg$c87 = { type: "class", value: "['\\\\]", description: "['\\\\]" }, - peg$c88 = /^['"\\]/, - peg$c89 = { type: "class", value: "['\"\\\\]", description: "['\"\\\\]" }, - peg$c90 = "n", - peg$c91 = { type: "literal", value: "n", description: "\"n\"" }, - peg$c92 = function() { return "\n"; }, - peg$c93 = "r", - peg$c94 = { type: "literal", value: "r", description: "\"r\"" }, - peg$c95 = function() { return "\r"; }, - peg$c96 = "t", - peg$c97 = { type: "literal", value: "t", description: "\"t\"" }, - peg$c98 = function() { return "\t"; }, + peg$c3 = [], + peg$c4 = function() {return trueFilter; }, + peg$c5 = { type: "other", description: "whitespace" }, + peg$c6 = /^[ \t\n\r]/, + peg$c7 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" }, + peg$c8 = { type: "other", description: "control character" }, + peg$c9 = /^[|&!()~"]/, + peg$c10 = { type: "class", value: "[|&!()~\"]", description: "[|&!()~\"]" }, + peg$c11 = { type: "other", description: "optional whitespace" }, + peg$c12 = "|", + peg$c13 = { type: "literal", value: "|", description: "\"|\"" }, + peg$c14 = function(first, second) { return or(first, second); }, + peg$c15 = "&", + peg$c16 = { type: "literal", value: "&", description: "\"&\"" }, + peg$c17 = function(first, second) { return and(first, second); }, + peg$c18 = "!", + peg$c19 = { type: "literal", value: "!", description: "\"!\"" }, + peg$c20 = function(expr) { return not(expr); }, + peg$c21 = "(", + peg$c22 = { type: "literal", value: "(", description: "\"(\"" }, + peg$c23 = ")", + peg$c24 = { type: "literal", value: ")", description: "\")\"" }, + peg$c25 = function(expr) { return binding(orExpr); }, + peg$c26 = "~a", + peg$c27 = { type: "literal", value: "~a", description: "\"~a\"" }, + peg$c28 = function() { return assetFilter; }, + peg$c29 = "~e", + peg$c30 = { type: "literal", value: "~e", description: "\"~e\"" }, + peg$c31 = function() { return errorFilter; }, + peg$c32 = "~q", + peg$c33 = { type: "literal", value: "~q", description: "\"~q\"" }, + peg$c34 = function() { return noResponseFilter; }, + peg$c35 = "~s", + peg$c36 = { type: "literal", value: "~s", description: "\"~s\"" }, + peg$c37 = function() { return responseFilter; }, + peg$c38 = "true", + peg$c39 = { type: "literal", value: "true", description: "\"true\"" }, + peg$c40 = function() { return trueFilter; }, + peg$c41 = "false", + peg$c42 = { type: "literal", value: "false", description: "\"false\"" }, + peg$c43 = function() { return falseFilter; }, + peg$c44 = "~c", + peg$c45 = { type: "literal", value: "~c", description: "\"~c\"" }, + peg$c46 = function(s) { return responseCode(s); }, + peg$c47 = "~d", + peg$c48 = { type: "literal", value: "~d", description: "\"~d\"" }, + peg$c49 = function(s) { return domain(s); }, + peg$c50 = "~h", + peg$c51 = { type: "literal", value: "~h", description: "\"~h\"" }, + peg$c52 = function(s) { return header(s); }, + peg$c53 = "~hq", + peg$c54 = { type: "literal", value: "~hq", description: "\"~hq\"" }, + peg$c55 = function(s) { return requestHeader(s); }, + peg$c56 = "~hs", + peg$c57 = { type: "literal", value: "~hs", description: "\"~hs\"" }, + peg$c58 = function(s) { return responseHeader(s); }, + peg$c59 = "~m", + peg$c60 = { type: "literal", value: "~m", description: "\"~m\"" }, + peg$c61 = function(s) { return method(s); }, + peg$c62 = "~t", + peg$c63 = { type: "literal", value: "~t", description: "\"~t\"" }, + peg$c64 = function(s) { return contentType(s); }, + peg$c65 = "~tq", + peg$c66 = { type: "literal", value: "~tq", description: "\"~tq\"" }, + peg$c67 = function(s) { return requestContentType(s); }, + peg$c68 = "~ts", + peg$c69 = { type: "literal", value: "~ts", description: "\"~ts\"" }, + peg$c70 = function(s) { return responseContentType(s); }, + peg$c71 = "~u", + peg$c72 = { type: "literal", value: "~u", description: "\"~u\"" }, + peg$c73 = function(s) { return url(s); }, + peg$c74 = { type: "other", description: "string" }, + peg$c75 = "\"", + peg$c76 = { type: "literal", value: "\"", description: "\"\\\"\"" }, + peg$c77 = function(chars) { return chars.join(""); }, + peg$c78 = "'", + peg$c79 = { type: "literal", value: "'", description: "\"'\"" }, + peg$c80 = void 0, + peg$c81 = /^["\\]/, + peg$c82 = { type: "class", value: "[\"\\\\]", description: "[\"\\\\]" }, + peg$c83 = { type: "any", description: "any character" }, + peg$c84 = function(char) { return char; }, + peg$c85 = "\\", + peg$c86 = { type: "literal", value: "\\", description: "\"\\\\\"" }, + peg$c87 = /^['\\]/, + peg$c88 = { type: "class", value: "['\\\\]", description: "['\\\\]" }, + peg$c89 = /^['"\\]/, + peg$c90 = { type: "class", value: "['\"\\\\]", description: "['\"\\\\]" }, + peg$c91 = "n", + peg$c92 = { type: "literal", value: "n", description: "\"n\"" }, + peg$c93 = function() { return "\n"; }, + peg$c94 = "r", + peg$c95 = { type: "literal", value: "r", description: "\"r\"" }, + peg$c96 = function() { return "\r"; }, + peg$c97 = "t", + peg$c98 = { type: "literal", value: "t", description: "\"t\"" }, + peg$c99 = function() { return "\t"; }, peg$currPos = 0, peg$reportedPos = 0, @@ -576,6 +577,15 @@ Filt = (function() { peg$currPos = s0; s0 = peg$c1; } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = []; + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c4(); + } + s0 = s1; + } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; @@ -589,17 +599,17 @@ Filt = (function() { var s0, s1; peg$silentFails++; - if (peg$c4.test(input.charAt(peg$currPos))) { + if (peg$c6.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c5); } + if (peg$silentFails === 0) { peg$fail(peg$c7); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c3); } + if (peg$silentFails === 0) { peg$fail(peg$c5); } } return s0; @@ -609,17 +619,17 @@ Filt = (function() { var s0, s1; peg$silentFails++; - if (peg$c7.test(input.charAt(peg$currPos))) { + if (peg$c9.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } + if (peg$silentFails === 0) { peg$fail(peg$c10); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + if (peg$silentFails === 0) { peg$fail(peg$c8); } } return s0; @@ -638,7 +648,7 @@ Filt = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } return s0; @@ -653,11 +663,11 @@ Filt = (function() { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 124) { - s3 = peg$c11; + s3 = peg$c12; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } + if (peg$silentFails === 0) { peg$fail(peg$c13); } } if (s3 !== peg$FAILED) { s4 = peg$parse__(); @@ -665,7 +675,7 @@ Filt = (function() { s5 = peg$parseOrExpr(); if (s5 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c13(s1, s5); + s1 = peg$c14(s1, s5); s0 = s1; } else { peg$currPos = s0; @@ -703,11 +713,11 @@ Filt = (function() { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 38) { - s3 = peg$c14; + s3 = peg$c15; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c15); } + if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s3 !== peg$FAILED) { s4 = peg$parse__(); @@ -715,7 +725,7 @@ Filt = (function() { s5 = peg$parseAndExpr(); if (s5 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c16(s1, s5); + s1 = peg$c17(s1, s5); s0 = s1; } else { peg$currPos = s0; @@ -755,7 +765,7 @@ Filt = (function() { s3 = peg$parseAndExpr(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c16(s1, s3); + s1 = peg$c17(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -782,11 +792,11 @@ Filt = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 33) { - s1 = peg$c17; + s1 = peg$c18; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c18); } + if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -794,7 +804,7 @@ Filt = (function() { s3 = peg$parseNotExpr(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c19(s3); + s1 = peg$c20(s3); s0 = s1; } else { peg$currPos = s0; @@ -820,11 +830,11 @@ Filt = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c20; + s1 = peg$c21; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c21); } + if (peg$silentFails === 0) { peg$fail(peg$c22); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -834,15 +844,15 @@ Filt = (function() { s4 = peg$parse__(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c22; + s5 = peg$c23; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c23); } + if (peg$silentFails === 0) { peg$fail(peg$c24); } } if (s5 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c24(s3); + s1 = peg$c25(s3); s0 = s1; } else { peg$currPos = s0; @@ -888,58 +898,58 @@ Filt = (function() { s0 = peg$parseBooleanLiteral(); if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c25) { - s1 = peg$c25; + if (input.substr(peg$currPos, 2) === peg$c26) { + s1 = peg$c26; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } + if (peg$silentFails === 0) { peg$fail(peg$c27); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c27(); + s1 = peg$c28(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c28) { - s1 = peg$c28; + if (input.substr(peg$currPos, 2) === peg$c29) { + s1 = peg$c29; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } + if (peg$silentFails === 0) { peg$fail(peg$c30); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c30(); + s1 = peg$c31(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c31) { - s1 = peg$c31; + if (input.substr(peg$currPos, 2) === peg$c32) { + s1 = peg$c32; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } + if (peg$silentFails === 0) { peg$fail(peg$c33); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c33(); + s1 = peg$c34(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c34) { - s1 = peg$c34; + if (input.substr(peg$currPos, 2) === peg$c35) { + s1 = peg$c35; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c35); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c36(); + s1 = peg$c37(); } s0 = s1; } @@ -954,30 +964,30 @@ Filt = (function() { var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c37) { - s1 = peg$c37; + if (input.substr(peg$currPos, 4) === peg$c38) { + s1 = peg$c38; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c39); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c39(); + s1 = peg$c40(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c40) { - s1 = peg$c40; + if (input.substr(peg$currPos, 5) === peg$c41) { + s1 = peg$c41; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } + if (peg$silentFails === 0) { peg$fail(peg$c42); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c42(); + s1 = peg$c43(); } s0 = s1; } @@ -989,12 +999,12 @@ Filt = (function() { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c43) { - s1 = peg$c43; + if (input.substr(peg$currPos, 2) === peg$c44) { + s1 = peg$c44; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c44); } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1011,7 +1021,7 @@ Filt = (function() { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c45(s3); + s1 = peg$c46(s3); s0 = s1; } else { peg$currPos = s0; @@ -1027,12 +1037,12 @@ Filt = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c46) { - s1 = peg$c46; + if (input.substr(peg$currPos, 2) === peg$c47) { + s1 = peg$c47; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c47); } + if (peg$silentFails === 0) { peg$fail(peg$c48); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1049,7 +1059,7 @@ Filt = (function() { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c48(s3); + s1 = peg$c49(s3); s0 = s1; } else { peg$currPos = s0; @@ -1065,12 +1075,12 @@ Filt = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c49) { - s1 = peg$c49; + if (input.substr(peg$currPos, 2) === peg$c50) { + s1 = peg$c50; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c50); } + if (peg$silentFails === 0) { peg$fail(peg$c51); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1087,7 +1097,7 @@ Filt = (function() { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c51(s3); + s1 = peg$c52(s3); s0 = s1; } else { peg$currPos = s0; @@ -1103,12 +1113,12 @@ Filt = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c52) { - s1 = peg$c52; + if (input.substr(peg$currPos, 3) === peg$c53) { + s1 = peg$c53; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c53); } + if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1125,7 +1135,7 @@ Filt = (function() { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c54(s3); + s1 = peg$c55(s3); s0 = s1; } else { peg$currPos = s0; @@ -1141,12 +1151,12 @@ Filt = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c55) { - s1 = peg$c55; + if (input.substr(peg$currPos, 3) === peg$c56) { + s1 = peg$c56; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c56); } + if (peg$silentFails === 0) { peg$fail(peg$c57); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1163,7 +1173,7 @@ Filt = (function() { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c57(s3); + s1 = peg$c58(s3); s0 = s1; } else { peg$currPos = s0; @@ -1179,12 +1189,12 @@ Filt = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c58) { - s1 = peg$c58; + if (input.substr(peg$currPos, 2) === peg$c59) { + s1 = peg$c59; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c59); } + if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1201,7 +1211,7 @@ Filt = (function() { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c60(s3); + s1 = peg$c61(s3); s0 = s1; } else { peg$currPos = s0; @@ -1217,12 +1227,12 @@ Filt = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c61) { - s1 = peg$c61; + if (input.substr(peg$currPos, 2) === peg$c62) { + s1 = peg$c62; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c62); } + if (peg$silentFails === 0) { peg$fail(peg$c63); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1239,7 +1249,7 @@ Filt = (function() { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c63(s3); + s1 = peg$c64(s3); s0 = s1; } else { peg$currPos = s0; @@ -1255,12 +1265,12 @@ Filt = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c64) { - s1 = peg$c64; + if (input.substr(peg$currPos, 3) === peg$c65) { + s1 = peg$c65; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c65); } + if (peg$silentFails === 0) { peg$fail(peg$c66); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1277,7 +1287,7 @@ Filt = (function() { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c66(s3); + s1 = peg$c67(s3); s0 = s1; } else { peg$currPos = s0; @@ -1293,12 +1303,12 @@ Filt = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c67) { - s1 = peg$c67; + if (input.substr(peg$currPos, 3) === peg$c68) { + s1 = peg$c68; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c68); } + if (peg$silentFails === 0) { peg$fail(peg$c69); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1315,7 +1325,7 @@ Filt = (function() { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c69(s3); + s1 = peg$c70(s3); s0 = s1; } else { peg$currPos = s0; @@ -1331,12 +1341,12 @@ Filt = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c70) { - s1 = peg$c70; + if (input.substr(peg$currPos, 2) === peg$c71) { + s1 = peg$c71; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c71); } + if (peg$silentFails === 0) { peg$fail(peg$c72); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1353,7 +1363,7 @@ Filt = (function() { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c72(s3); + s1 = peg$c73(s3); s0 = s1; } else { peg$currPos = s0; @@ -1372,7 +1382,7 @@ Filt = (function() { s1 = peg$parseStringLiteral(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c72(s1); + s1 = peg$c73(s1); } s0 = s1; } @@ -1395,11 +1405,11 @@ Filt = (function() { peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c74; + s1 = peg$c75; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$c76); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1410,15 +1420,15 @@ Filt = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c74; + s3 = peg$c75; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$c76); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c76(s2); + s1 = peg$c77(s2); s0 = s1; } else { peg$currPos = s0; @@ -1435,11 +1445,11 @@ Filt = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c77; + s1 = peg$c78; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c78); } + if (peg$silentFails === 0) { peg$fail(peg$c79); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1450,15 +1460,15 @@ Filt = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c77; + s3 = peg$c78; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c78); } + if (peg$silentFails === 0) { peg$fail(peg$c79); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c76(s2); + s1 = peg$c77(s2); s0 = s1; } else { peg$currPos = s0; @@ -1479,7 +1489,7 @@ Filt = (function() { s2 = peg$parsecc(); peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c79; + s1 = peg$c80; } else { peg$currPos = s1; s1 = peg$c1; @@ -1497,7 +1507,7 @@ Filt = (function() { } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c76(s2); + s1 = peg$c77(s2); s0 = s1; } else { peg$currPos = s0; @@ -1512,7 +1522,7 @@ Filt = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$c74); } } return s0; @@ -1524,16 +1534,16 @@ Filt = (function() { s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; - if (peg$c80.test(input.charAt(peg$currPos))) { + if (peg$c81.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$c82); } } peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c79; + s1 = peg$c80; } else { peg$currPos = s1; s1 = peg$c1; @@ -1544,11 +1554,11 @@ Filt = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c83(s2); + s1 = peg$c84(s2); s0 = s1; } else { peg$currPos = s0; @@ -1561,17 +1571,17 @@ Filt = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c84; + s1 = peg$c85; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c85); } + if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c83(s2); + s1 = peg$c84(s2); s0 = s1; } else { peg$currPos = s0; @@ -1592,16 +1602,16 @@ Filt = (function() { s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; - if (peg$c86.test(input.charAt(peg$currPos))) { + if (peg$c87.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c87); } + if (peg$silentFails === 0) { peg$fail(peg$c88); } } peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c79; + s1 = peg$c80; } else { peg$currPos = s1; s1 = peg$c1; @@ -1612,11 +1622,11 @@ Filt = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c83(s2); + s1 = peg$c84(s2); s0 = s1; } else { peg$currPos = s0; @@ -1629,17 +1639,17 @@ Filt = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c84; + s1 = peg$c85; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c85); } + if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c83(s2); + s1 = peg$c84(s2); s0 = s1; } else { peg$currPos = s0; @@ -1663,7 +1673,7 @@ Filt = (function() { s2 = peg$parsews(); peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c79; + s1 = peg$c80; } else { peg$currPos = s1; s1 = peg$c1; @@ -1674,11 +1684,11 @@ Filt = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } + if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c83(s2); + s1 = peg$c84(s2); s0 = s1; } else { peg$currPos = s0; @@ -1695,53 +1705,53 @@ Filt = (function() { function peg$parseEscapeSequence() { var s0, s1; - if (peg$c88.test(input.charAt(peg$currPos))) { + if (peg$c89.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c89); } + if (peg$silentFails === 0) { peg$fail(peg$c90); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 110) { - s1 = peg$c90; + s1 = peg$c91; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c91); } + if (peg$silentFails === 0) { peg$fail(peg$c92); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c92(); + s1 = peg$c93(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 114) { - s1 = peg$c93; + s1 = peg$c94; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c94); } + if (peg$silentFails === 0) { peg$fail(peg$c95); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c95(); + s1 = peg$c96(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 116) { - s1 = peg$c96; + s1 = peg$c97; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c98); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c98(); + s1 = peg$c99(); } s0 = s1; } @@ -1985,7 +1995,7 @@ _.extend(ListStore.prototype, EventEmitter.prototype, { reset: function (elems) { this.list = elems || []; this._build_map(); - this.emit("recalculate", this.list); + this.emit("recalculate"); }, _build_map: function () { this._pos_map = {}; @@ -2010,11 +2020,11 @@ function DictStore() { _.extend(DictStore.prototype, EventEmitter.prototype, { update: function (dict) { _.merge(this.dict, dict); - this.emit("recalculate", this.dict); + this.emit("recalculate"); }, reset: function (dict) { this.dict = dict || {}; - this.emit("recalculate", this.dict); + this.emit("recalculate"); } }); @@ -2143,7 +2153,7 @@ function StoreView(store, filt, sortfun) { this.store.addListener("remove", this.remove); this.store.addListener("recalculate", this.recalculate); - this.recalculate(this.store.list, filt, sortfun); + this.recalculate(filt, sortfun); } _.extend(StoreView.prototype, EventEmitter.prototype, { @@ -2153,7 +2163,7 @@ _.extend(StoreView.prototype, EventEmitter.prototype, { this.store.removeListener("remove", this.remove); this.store.removeListener("recalculate", this.recalculate); }, - recalculate: function (elems, filt, sortfun) { + recalculate: function (filt, sortfun) { if (filt) { this.filt = filt; } @@ -2161,7 +2171,7 @@ _.extend(StoreView.prototype, EventEmitter.prototype, { this.sortfun = sortfun.bind(this); } - this.list = elems.filter(this.filt); + this.list = this.store.list.filter(this.filt); this.list.sort(function (a, b) { return this.sortfun(a) - this.sortfun(b); }.bind(this)); @@ -3262,10 +3272,18 @@ var FlowDetail = React.createClass({displayName: 'FlowDetail', var MainView = React.createClass({displayName: 'MainView', mixins: [Navigation, State], getInitialState: function () { + this.onQueryChange(Query.FILTER, function(){ + this.state.view.recalculate(this.getViewFilt(), this.getViewSort()); + }.bind(this)); return { flows: [] }; }, + getViewFilt: function(){ + return Filt.parse(this.getQuery()[Query.FILTER]); + }, + getViewSort: function(){ + }, componentWillReceiveProps: function (nextProps) { if (nextProps.flowStore !== this.props.flowStore) { this.closeView(); @@ -3273,7 +3291,7 @@ var MainView = React.createClass({displayName: 'MainView', } }, openView: function (store) { - var view = new StoreView(store); + var view = new StoreView(store, this.getViewFilt(), this.getViewSort()); this.setState({ view: view }); @@ -3465,7 +3483,7 @@ var EventLogContents = React.createClass({displayName: 'EventLogContents', componentWillReceiveProps: function (nextProps) { if (nextProps.filter !== this.props.filter) { this.props.filter = nextProps.filter; // Dirty: Make sure that view filter sees the update. - this.state.view.recalculate(this.props.eventStore.list); + this.state.view.recalculate(); } if (nextProps.eventStore !== this.props.eventStore) { this.closeView(); diff --git a/web/src/js/components/eventlog.jsx.js b/web/src/js/components/eventlog.jsx.js index 7ef369f8c..9632eeecb 100644 --- a/web/src/js/components/eventlog.jsx.js +++ b/web/src/js/components/eventlog.jsx.js @@ -57,7 +57,7 @@ var EventLogContents = React.createClass({ componentWillReceiveProps: function (nextProps) { if (nextProps.filter !== this.props.filter) { this.props.filter = nextProps.filter; // Dirty: Make sure that view filter sees the update. - this.state.view.recalculate(this.props.eventStore.list); + this.state.view.recalculate(); } if (nextProps.eventStore !== this.props.eventStore) { this.closeView(); diff --git a/web/src/js/components/mainview.jsx.js b/web/src/js/components/mainview.jsx.js index 6e216b6ae..acafdf348 100644 --- a/web/src/js/components/mainview.jsx.js +++ b/web/src/js/components/mainview.jsx.js @@ -1,10 +1,18 @@ var MainView = React.createClass({ mixins: [Navigation, State], getInitialState: function () { + this.onQueryChange(Query.FILTER, function(){ + this.state.view.recalculate(this.getViewFilt(), this.getViewSort()); + }.bind(this)); return { flows: [] }; }, + getViewFilt: function(){ + return Filt.parse(this.getQuery()[Query.FILTER]); + }, + getViewSort: function(){ + }, componentWillReceiveProps: function (nextProps) { if (nextProps.flowStore !== this.props.flowStore) { this.closeView(); @@ -12,7 +20,7 @@ var MainView = React.createClass({ } }, openView: function (store) { - var view = new StoreView(store); + var view = new StoreView(store, this.getViewFilt(), this.getViewSort()); this.setState({ view: view }); diff --git a/web/src/js/filt/filt.js b/web/src/js/filt/filt.js index 330a50013..6d7d10bad 100644 Binary files a/web/src/js/filt/filt.js and b/web/src/js/filt/filt.js differ diff --git a/web/src/js/filt/filt.pegjs b/web/src/js/filt/filt.pegjs index c363e7748..94a5ca774 100644 --- a/web/src/js/filt/filt.pegjs +++ b/web/src/js/filt/filt.pegjs @@ -130,6 +130,7 @@ function url(regex){ start "filter expression" = __ orExpr:OrExpr __ { return orExpr; } + / {return trueFilter; } ws "whitespace" = [ \t\n\r] cc "control character" = [|&!()~"] diff --git a/web/src/js/store/store.js b/web/src/js/store/store.js index 0f94e496d..30932f18a 100644 --- a/web/src/js/store/store.js +++ b/web/src/js/store/store.js @@ -29,7 +29,7 @@ _.extend(ListStore.prototype, EventEmitter.prototype, { reset: function (elems) { this.list = elems || []; this._build_map(); - this.emit("recalculate", this.list); + this.emit("recalculate"); }, _build_map: function () { this._pos_map = {}; @@ -54,11 +54,11 @@ function DictStore() { _.extend(DictStore.prototype, EventEmitter.prototype, { update: function (dict) { _.merge(this.dict, dict); - this.emit("recalculate", this.dict); + this.emit("recalculate"); }, reset: function (dict) { this.dict = dict || {}; - this.emit("recalculate", this.dict); + this.emit("recalculate"); } }); diff --git a/web/src/js/store/view.js b/web/src/js/store/view.js index 56bc4dbd0..4dba09e9f 100644 --- a/web/src/js/store/view.js +++ b/web/src/js/store/view.js @@ -23,7 +23,7 @@ function StoreView(store, filt, sortfun) { this.store.addListener("remove", this.remove); this.store.addListener("recalculate", this.recalculate); - this.recalculate(this.store.list, filt, sortfun); + this.recalculate(filt, sortfun); } _.extend(StoreView.prototype, EventEmitter.prototype, { @@ -33,7 +33,7 @@ _.extend(StoreView.prototype, EventEmitter.prototype, { this.store.removeListener("remove", this.remove); this.store.removeListener("recalculate", this.recalculate); }, - recalculate: function (elems, filt, sortfun) { + recalculate: function (filt, sortfun) { if (filt) { this.filt = filt; } @@ -41,7 +41,7 @@ _.extend(StoreView.prototype, EventEmitter.prototype, { this.sortfun = sortfun.bind(this); } - this.list = elems.filter(this.filt); + this.list = this.store.list.filter(this.filt); this.list.sort(function (a, b) { return this.sortfun(a) - this.sortfun(b); }.bind(this));