Browse Source

WIP - Parsing the urlencoded query params

main
Levi Olson 1 year ago
parent
commit
eb6d1171de
2 changed files with 21 additions and 8 deletions
  1. +16
    -4
      unpacked/panel/assets/javascripts/app.js
  2. +5
    -4
      unpacked/panel/assets/javascripts/panel.js

+ 16
- 4
unpacked/panel/assets/javascripts/app.js View File

@ -2,6 +2,7 @@ var BNPChrome = angular
.module("BNPChrome", [])
.factory("parse", function () {
const parser = function (input, level, depthOverride) {
chrome.extension.getBackgroundPage().console.debug(`In parser: Attempting Parse %s/%s`, level, depthOverride);
const depth = depthOverride || 3;
if (level > depth) return input;
@ -19,10 +20,21 @@ var BNPChrome = angular
if (typeof input === "string") {
try {
chrome.extension.getBackgroundPage().console.debug("In parser: Attempting String Parse");
input = parser(JSON.parse(input), level ? level + 1 : 1, depth);
return input;
} catch (e) {
// not a stringified node
// could be URL Encoded
try {
chrome.extension.getBackgroundPage().console.debug("In parser: Attempting URL Decode", decodeURI(input), level, depth);
input = parser(decodeURI(input), level ? level + 1 : 1, depth);
return input;
} catch(e) {
// not url encoded
chrome.extension.getBackgroundPage().console.debug("In parser: Could Not Decode");
return input;
}
return input;
}
} else if (typeof input === "object") {
@ -32,7 +44,7 @@ var BNPChrome = angular
});
} else {
// unless there is a datatype I'm not checking for....
// console.log('shouldnt get here')
chrome.extension.getBackgroundPage().console.debug('In parser: Data Type Unaccounted For');
}
return input;
@ -74,7 +86,7 @@ var BNPChrome = angular
}
};
})
.directive("resizableColumns", function ($parse) {
.directive("resizableColumns", function () {
return {
link: function (scope, element, attrs) {
const options = { minWidth: 5 };
@ -116,7 +128,7 @@ var BNPChrome = angular
}
};
})
.directive("scrollToNew", function ($parse) {
.directive("scrollToNew", function () {
return function (scope, element, attrs) {
if (scope.scrollToNew && scope.$last) {
const $container = $(element).parents(".data-container").first();
@ -137,7 +149,7 @@ var BNPChrome = angular
}
});
};
}).directive('ngRightClick', function($parse) {
}).directive('ngRightClick', function() {
return function(scope, element, attrs) {
element.bind('contextmenu', function(event) {
scope.$apply(function() {

+ 5
- 4
unpacked/panel/assets/javascripts/panel.js View File

@ -6,7 +6,8 @@ BNPChrome.controller("PanelController", function PanelController($scope, toolbar
const CHANGELOG = {
"What's New": {
"v1.0.2:": {
"Added Settings": HOST + "/posts/bnp-changelog#added-settings"
"Added Settings": HOST + "/posts/bnp-changelog#added-settings",
"Auto URL Decoding": ""
},
"v1.0.1:": {
"Panel Settings": HOST + "/posts/bnp-changelog#panel-settings",
@ -69,7 +70,7 @@ BNPChrome.controller("PanelController", function PanelController($scope, toolbar
_createToolbar();
const options = {
mode: 'preview',
mode: 'view',
modes: ['code', 'view', 'preview'],
onEditable: function (node) {
if (!node.path) {
@ -443,10 +444,10 @@ BNPChrome.controller("PanelController", function PanelController($scope, toolbar
$("#tabs a[href='#" + tabId + "']").trigger("click");
}
if (tabId === "tab-response") {
$scope.displayCode("responseJsonEditor", $scope.activeCode, 3);
$scope.displayCode("responseJsonEditor", $scope.activeCode, $scope.autoJSONParseDepthRes);
}
if (tabId === "tab-request") {
$scope.displayCode("requestJsonEditor", $scope.activePostData, 6);
$scope.displayCode("requestJsonEditor", $scope.activePostData, $scope.autoJSONParseDepthReq);
}
};

Loading…
Cancel
Save