Permalink
Browse files

add request authentication (refs #23), lint codebase (fixes #38)

  • Loading branch information...
1 parent d61ec10 commit 74f09748d50a75ba48b5bce916f1e606defe336d @mhils committed Dec 24, 2012
Showing with 673 additions and 628 deletions.
  1. +5 −0 .project
  2. +6 −0 .settings/com.eclipsesource.jshint.ui.prefs
  3. +2 −2 gui/js/HoneyProxy/MainLayout.js
  4. +1 −1 gui/js/HoneyProxy/TableSorter.js
  5. +1 −1 gui/js/HoneyProxy/config.js
  6. +16 −14 gui/js/HoneyProxy/dirdump.js
  7. +2 −1 gui/js/HoneyProxy/flows/CssFlow.js
  8. +1 −0 gui/js/HoneyProxy/flows/DocumentFlow.js
  9. +1 −0 gui/js/HoneyProxy/flows/HtmlFlow.js
  10. +1 −0 gui/js/HoneyProxy/flows/JsFlow.js
  11. +5 −5 gui/js/HoneyProxy/flows/NotModifiedFlow.js
  12. +2 −2 gui/js/HoneyProxy/flows/PrettyFlow.js
  13. +4 −4 gui/js/HoneyProxy/flows/RedirectFlow.js
  14. +1 −0 gui/js/HoneyProxy/flows/XmlFlow.js
  15. +7 −12 gui/js/HoneyProxy/flows/flowModels.js
  16. +1 −0 gui/js/HoneyProxy/main.js
  17. +3 −2 gui/js/HoneyProxy/models/Flow.js
  18. +6 −5 gui/js/HoneyProxy/models/Request.js
  19. +2 −1 gui/js/HoneyProxy/models/Response.js
  20. +7 −7 gui/js/HoneyProxy/models/Traffic.js
  21. +14 −14 gui/js/HoneyProxy/models/sharedFlowProperties.js
  22. +61 −62 gui/js/HoneyProxy/search.js
  23. +1 −1 gui/js/HoneyProxy/traffic.js
  24. +1 −0 gui/js/HoneyProxy/tutorial.js
  25. +78 −72 gui/js/HoneyProxy/util/_DynamicTemplatedMixin.js
  26. +1 −1 gui/js/HoneyProxy/util/_DynamicTemplatedWidget.js
  27. +2 −1 gui/js/HoneyProxy/util/_UpdateNodeTextMixin.js
  28. +4 −4 gui/js/HoneyProxy/util/flowlist.js
  29. +3 −1 gui/js/HoneyProxy/util/formatSize.js
  30. +31 −0 gui/js/HoneyProxy/util/requestAuthenticator.js
  31. +42 −44 gui/js/HoneyProxy/util/sampleFlow.js
  32. +3 −3 gui/js/HoneyProxy/util/versionCheck.js
  33. +15 −19 gui/js/HoneyProxy/utilities.js
  34. +27 −26 gui/js/HoneyProxy/views/DetailPane.js
  35. +34 −33 gui/js/HoneyProxy/views/DetailPane/DetailsPane.js
  36. +38 −44 gui/js/HoneyProxy/views/DetailPane/PreviewPane.js
  37. +42 −42 gui/js/HoneyProxy/views/DetailPane/RawPane.js
  38. +32 −34 gui/js/HoneyProxy/views/DetailPane/_DetailViewPane.js
  39. +5 −5 gui/js/HoneyProxy/views/FlowView.js
  40. +29 −33 gui/js/HoneyProxy/views/HeaderPane.js
  41. +62 −63 gui/js/HoneyProxy/views/ReportEditor.js
  42. +8 −10 gui/js/HoneyProxy/views/ReportOutput.js
  43. +3 −1 gui/js/HoneyProxy/views/ReportPane.js
  44. +1 −0 gui/js/HoneyProxy/views/TrafficPane.js
  45. +8 −10 gui/js/HoneyProxy/views/TrafficSidebar.js
  46. +8 −10 gui/js/HoneyProxy/views/TrafficTable.js
  47. +3 −2 gui/js/HoneyProxy/views/TrafficView.js
  48. +43 −36 gui/js/HoneyProxy/websocket.js
View
@@ -10,6 +10,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>com.eclipsesource.jshint.ui.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+excluded=//*.ejs
+globals=$\: false, _\: false, Backbone\: false, require\: false, define\: false, console\: true, window\: false, document\: false, localStorage\: false, WebSocket\: false
+included=gui/js/HoneyProxy//*
+options=es5\: true, laxbreak\:true, latedef\: true, newcap\: true, noarg\: true, noempty\:true, nonew\:true, undef\:true, unused\: true
+projectSpecificOptions=true
@@ -12,7 +12,7 @@ define([
"./traffic",
"dojo/domReady!"
], function(exports,query, BorderContainer, TabContainer, StackContainer, ContentPane, HeaderPane, TrafficPane, ReportPane, TrafficView, traffic) {
-
+
//appLayout covers everything
var appLayout = new BorderContainer({
design: "headline",
@@ -61,7 +61,7 @@ define([
el: $("#trafficTable .data tbody")[0]
});
- trafficView.$el.on("click", "tr", function(e) {
+ trafficView.$el.on("click", "tr", function() {
trafficPane.selectFlow($(this).data("flow-id"));
});
@@ -4,8 +4,8 @@
* of the closure library in the future as it's too big/bloated
* for our needs.
*/
+/*global goog: false*/
define(["dojo/domReady!"],function(){
-
var trafficTableSorter = new goog.ui.TableSorter();
trafficTableSorter.decorate(goog.dom.getElement('traffictable'));
@@ -11,7 +11,7 @@ define(["dojo/json","dojo/text!/api/config"], function(JSON,configstr){
};
Config.prototype.set = function(id,val){
this.storage[id] = val;
- }
+ };
var config = new Config(JSON.parse(configstr));
@@ -1,17 +1,19 @@
/**
* Add a small link to the directory listener if dirdump is active.
*/
-define(["dijit/form/Button","./config","./MainLayout"],function(Button,config,MainLayout){
- if(config.get("dumpdir") === true) {
-
- new Button({
- label: "Show dumped files",
- iconClass: "dijitIcon dijitIconFolderOpen",
- onClick: function(){
- window.open("/dump");
- }
- }).placeAt(MainLayout.header.toolbarNode);
-
- }
- return config.get("dumpdir");
-});
+define([ "dijit/form/Button", "./config", "./MainLayout" ],
+ function(Button, config, MainLayout) {
+
+ if (config.get("dumpdir") === true) {
+
+ new Button({
+ label: "Show dumped files",
+ iconClass: "dijitIcon dijitIconFolderOpen",
+ onClick: function() {
+ window.open("/dump");
+ }
+ }).placeAt(MainLayout.header.toolbarNode);
+
+ }
+ return config.get("dumpdir");
+ });
@@ -2,6 +2,7 @@
* Flow subclass responsible for proper display of CSS files.
*/
define(["./PrettyFlow"],function(PrettyFlow){
+
return PrettyFlow.extend({}, {
matches : function(data) {
if (data.contentType)
@@ -14,4 +15,4 @@ define(["./PrettyFlow"],function(PrettyFlow){
return "css";
}
});
-})
+});
@@ -4,6 +4,7 @@
* this.
*/
define(["../models/Flow"],function(Flow){
+
return Flow.extend(
{},
{
@@ -2,6 +2,7 @@
* Flow subclass responsible for proper display of CSS files.
*/
define(["./PrettyFlow"],function(PrettyFlow){
+
return PrettyFlow.extend({
}, {
@@ -2,6 +2,7 @@
* Flow subclass responsible for proper display of JavaScript
*/
define(["dojo/Deferred","./PrettyFlow","./DocumentFlow"],function(Deferred,PrettyFlow, DocumentFlow){
+
return PrettyFlow.extend({
getPreview : function(){
var deferred = new Deferred();
@@ -8,7 +8,7 @@ define(["require",
"dojo/Deferred",
"../models/Flow",
"../util/flowlist"],function(require,on,query,domConstruct,Deferred,Flow,flowlist){
-
+
function preview(parentPreviewFunc){
return function(){
var deferred = new Deferred();
@@ -22,17 +22,17 @@ define(["require",
});
flows = _.filter(flows, function(f) {
return (f.response.contentLength > 0);
- })
+ });
var similarFlows = domConstruct.create("span");
if(flows.length > 0){
domConstruct.place("<h3>Similar Flows with Content:</h3>",similarFlows);
domConstruct.place(flowlist(flows),similarFlows);
} else {
- domConstruct.place("<p>No similar flows found.</p>",similarFlows)
+ domConstruct.place("<p>No similar flows found.</p>",similarFlows);
}
- var parentPreview = parentPreviewFunc.apply(this,arguments).then(function(content){
+ parentPreviewFunc.apply(this,arguments).then(function(content){
var span = domConstruct.create("span");
domConstruct.place(content,span);
domConstruct.place(similarFlows,span);
@@ -41,7 +41,7 @@ define(["require",
});
}).bind(this));
return deferred;
- }
+ };
}
return Flow.extend({
@@ -17,10 +17,10 @@ define(["dojo/Deferred","./DocumentFlow","highlight","dojo/dom-construct","dojo/
} else if (contentLength < askPretty) {
var span = domConstruct.create("span");
var prettifyButton = domConstruct.create("div",{className:"pre-menu-item", innerHTML: "Prettify (slow)"},span);
- on(prettifyButton,"click",function(evt){
+ on(prettifyButton,"click",function(){
hljs.highlightBlock(pre);
domConstruct.destroy(prettifyButton);
- })
+ });
domConstruct.place(pre,span);
return span;
}
@@ -8,9 +8,9 @@ define([
"../models/Flow",
"../util/flowlist"
],function(require, Deferred, domConstruct, Flow, flowlist){
-
+
function preview(parentPreviewFunc){
- return function(domPromise){
+ return function(){
var deferred = new Deferred();
var flow = this;
@@ -35,7 +35,7 @@ define([
domConstruct.place("<p>No subsequent requests found.</p>",nextFlows);
}
- var parentPreview = parentPreviewFunc.apply(this,arguments).then(function(content){
+ parentPreviewFunc.apply(this,arguments).then(function(content){
var container = domConstruct.create("div");
domConstruct.place(content,container);
domConstruct.place(nextFlows,container);
@@ -47,7 +47,7 @@ define([
return parentPreviewFunc.apply(this,arguments);
}
return deferred;
- }
+ };
}
return Flow.extend({
@@ -2,6 +2,7 @@
* Flow subclass responsible for proper display of XML
*/
define(["./PrettyFlow"],function(PrettyFlow){
+
return PrettyFlow.extend({
}, {
@@ -1,12 +1,7 @@
-define(["./RedirectFlow",
- "./NotModifiedFlow",
- "./ImageFlow",
- "./HtmlFlow",
- "./XmlFlow",
- "./JsFlow",
- "./CssFlow",
- "./PrettyFlow",
- "./DocumentFlow"],
- function(NotModifiedFlow,ImageFlow,HtmlFlow,XmlFlow,JsFlow,CssFlow,PrettyFlow,DocumentFlow){
- return [NotModifiedFlow,ImageFlow,HtmlFlow,XmlFlow,JsFlow,CssFlow,PrettyFlow,DocumentFlow];
-});
+define([ "./RedirectFlow", "./NotModifiedFlow", "./ImageFlow", "./HtmlFlow",
+ "./XmlFlow", "./JsFlow", "./CssFlow", "./PrettyFlow", "./DocumentFlow" ],
+ function(NotModifiedFlow, ImageFlow, HtmlFlow, XmlFlow, JsFlow, CssFlow,
+ PrettyFlow, DocumentFlow) {
+ return [ NotModifiedFlow, ImageFlow, HtmlFlow, XmlFlow, JsFlow, CssFlow,
+ PrettyFlow, DocumentFlow ];
+ });
@@ -12,6 +12,7 @@ require({
"HoneyProxy/websocket",
"HoneyProxy/traffic",
"HoneyProxy/util/versionCheck",
+ "HoneyProxy/util/requestAuthenticator",
"HoneyProxy/tutorial",
"HoneyProxy/search",
"HoneyProxy/dirdump",
@@ -11,6 +11,7 @@
* be in the model though.
*/
define(["./Request","./Response","dojo/Deferred","dojo/dom-construct"],function(Request,Response,Deferred,domConstruct){
+
return Backbone.Model.extend({
/**
* @return {number} the id of the current flow
@@ -98,6 +99,6 @@ define(["./Request","./Response","dojo/Deferred","dojo/dom-construct"],function(
*/
matches: function(){
return false; //favor subclasses
- },
+ }
});
-})
+});
@@ -1,8 +1,9 @@
/**
- * Proxy object for better access to Flows.
- * Be aware that both Request and Response objects are stateless!
+ * Proxy object for better access to Flows. Be aware that both Request and
+ * Response objects are stateless!
*/
define(["dojo/Deferred","../utilities","./sharedFlowProperties"],function(Deferred,utilities,sharedFlowProperties){
+
var Request = function(flow){
this._flow = flow;
};
@@ -45,7 +46,7 @@ define(["dojo/Deferred","../utilities","./sharedFlowProperties"],function(Deferr
var self = this;
var deferred = new Deferred();
this.getContent().then(function(data){
- var formData = utilities.parseParameters(data)
+ var formData = utilities.parseParameters(data);
self._flow.set("formDataParsed",formData);
deferred.resolve(formData);
});
@@ -72,10 +73,10 @@ define(["dojo/Deferred","../utilities","./sharedFlowProperties"],function(Deferr
},
get rawFirstLine() {
return [this.method,this.path,"HTTP/" + this.httpversion.join(".")]
- .join(" ")+"\n";
+ .join(" ")+"\n";
}
};
- //depends on https://github.com/documentcloud/underscore/pull/694
+ // depends on https://github.com/documentcloud/underscore/pull/694
_.extend(Request.prototype,sharedFlowProperties);
return Request;
@@ -3,6 +3,7 @@
* Be aware that both Request and Response objects are stateless!
*/
define(["../utilities","./sharedFlowProperties"],function(utilities,sharedFlowProperties){
+
var Response = function(flow){
this._flow = flow;
};
@@ -26,7 +27,7 @@ define(["../utilities","./sharedFlowProperties"],function(utilities,sharedFlowPr
},
get rawFirstLine() {
return ["HTTP/" + this.httpversion.join("."),this.code,this.msg]
- .join(" ")+"\n";
+ .join(" ")+"\n";
}
};
_.extend(Response.prototype,sharedFlowProperties);
@@ -13,7 +13,7 @@ define(["./Flow","../utilities","../flows/flowModels","dojo/Deferred"],function(
//based on http://stackoverflow.com/a/8843181/934719
return new (Function.bind.apply(Cls,
[0].concat(Array.prototype.slice.call(args)))
- );
+ )();
}
return function factory() {
@@ -29,7 +29,7 @@ define(["./Flow","../utilities","../flows/flowModels","dojo/Deferred"],function(
model = model || fallback;
return newCall(model,arguments);
- }
+ };
}
@@ -45,8 +45,8 @@ define(["./Flow","../utilities","../flows/flowModels","dojo/Deferred"],function(
return {
contentType : utilities.getContentTypeFromHeaders(data.response.headers),
path : data.request.path,
- responseCode: data.response.code,
- }
+ responseCode: data.response.code
+ };
});
/**
* HoneyProxy Traffic Model - Stores a list of flows.
@@ -55,13 +55,13 @@ define(["./Flow","../utilities","../flows/flowModels","dojo/Deferred"],function(
var Traffic = Backbone.Collection.extend({
initialize: function(){
this.firstFlow = new Deferred();
- function firstFlowTrigger() {
+ var firstFlowTrigger = function() {
if(this.length > 0) {
- this.firstFlow.resolve("firstflow")
+ this.firstFlow.resolve("firstflow");
this.off("newflow",firstFlowTrigger);
this.off("reset",firstFlowTrigger);
}
- }
+ };
this.on("add",firstFlowTrigger);
this.on("reset",firstFlowTrigger);
},
Oops, something went wrong.

0 comments on commit 74f0974

Please sign in to comment.