mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
Added 'Report a bug' tab to the 'About/Support' pane.
This commit is contained in:
parent
6eacd213a3
commit
4f0d153e73
12 changed files with 65 additions and 18 deletions
|
@ -62,7 +62,15 @@
|
|||
"properties": "always"
|
||||
}],
|
||||
"semi": ["error", "always"],
|
||||
"unicode-bom": "error"
|
||||
"unicode-bom": "error",
|
||||
"require-jsdoc": ["error", {
|
||||
"require": {
|
||||
"FunctionDeclaration": true,
|
||||
"MethodDefinition": true,
|
||||
"ClassDeclaration": true,
|
||||
"ArrowFunctionExpression": true
|
||||
}
|
||||
}]
|
||||
},
|
||||
"globals": {
|
||||
/* core/* */
|
||||
|
|
|
@ -296,6 +296,9 @@ var Code = {
|
|||
|
||||
return code;
|
||||
|
||||
/**
|
||||
* Replaces a matched token with a placeholder value.
|
||||
*/
|
||||
function preserveToken(str, match, t) {
|
||||
preservedTokens[t] = match[0];
|
||||
return str.substring(0, match.index) +
|
||||
|
|
|
@ -639,6 +639,9 @@ var IP = {
|
|||
|
||||
return result;
|
||||
|
||||
/**
|
||||
* Converts a list of 4 numeric strings in the range 0-255 to a list of numbers.
|
||||
*/
|
||||
function parseBlocks(blocks) {
|
||||
if (blocks.length !== 4)
|
||||
throw "More than 4 blocks.";
|
||||
|
@ -703,6 +706,9 @@ var IP = {
|
|||
}
|
||||
return ipv6;
|
||||
|
||||
/**
|
||||
* Converts a list of 3-8 numeric hex strings in the range 0-65535 to a list of numbers.
|
||||
*/
|
||||
function parseBlocks(blocks) {
|
||||
if (blocks.length < 3 || blocks.length > 8)
|
||||
throw "Badly formatted IPv6 address.";
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* globals moment */
|
||||
|
||||
/**
|
||||
* Waiter to handle events related to the CyberChef controls (i.e. Bake, Step, Save, Load etc.)
|
||||
*
|
||||
|
@ -154,12 +156,13 @@ ControlsWaiter.prototype.initialiseSaveLink = function(recipeConfig) {
|
|||
* @param {boolean} includeRecipe - Whether to include the recipe in the URL.
|
||||
* @param {boolean} includeInput - Whether to include the input in the URL.
|
||||
* @param {Object[]} [recipeConfig] - The recipe configuration object array.
|
||||
* @param {string} [baseURL] - The CyberChef URL, set to the current URL if not included
|
||||
* @returns {string}
|
||||
*/
|
||||
ControlsWaiter.prototype.generateStateUrl = function(includeRecipe, includeInput, recipeConfig) {
|
||||
ControlsWaiter.prototype.generateStateUrl = function(includeRecipe, includeInput, recipeConfig, baseURL) {
|
||||
recipeConfig = recipeConfig || this.app.getRecipeConfig();
|
||||
|
||||
var link = window.location.protocol + "//" +
|
||||
var link = baseURL || window.location.protocol + "//" +
|
||||
window.location.host +
|
||||
window.location.pathname,
|
||||
recipeStr = JSON.stringify(recipeConfig),
|
||||
|
@ -337,3 +340,16 @@ ControlsWaiter.prototype.loadButtonClick = function() {
|
|||
this.app.alert("Invalid recipe", "danger", 2000);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Populates the bug report information box with useful technical info.
|
||||
*/
|
||||
ControlsWaiter.prototype.supportButtonClick = function() {
|
||||
var reportBugInfo = document.getElementById("report-bug-info"),
|
||||
saveLink = this.generateStateUrl(true, true, null, "https://gchq.github.io/CyberChef/");
|
||||
|
||||
reportBugInfo.innerHTML = "* CyberChef compile time: <%= compileTime %>\n" +
|
||||
"* User-Agent: \n" + navigator.userAgent + "\n" +
|
||||
"* [Link to reproduce](" + saveLink + ")\n\n";
|
||||
};
|
||||
|
|
|
@ -86,6 +86,7 @@ Manager.prototype.initialiseEventListeners = function() {
|
|||
document.getElementById("load-delete-button").addEventListener("click", this.controls.loadDeleteClick.bind(this.controls));
|
||||
document.getElementById("load-name").addEventListener("change", this.controls.loadNameChange.bind(this.controls));
|
||||
document.getElementById("load-button").addEventListener("click", this.controls.loadButtonClick.bind(this.controls));
|
||||
document.getElementById("support").addEventListener("click", this.controls.supportButtonClick.bind(this.controls));
|
||||
this.addMultiEventListener("#save-text", "keyup paste", this.controls.saveTextChange, this.controls);
|
||||
|
||||
// Operations
|
||||
|
|
|
@ -43,7 +43,7 @@ var main = function() {
|
|||
// Fix issues with browsers that don't support console.log()
|
||||
window.console = console || {log: function() {}, error: function() {}};
|
||||
|
||||
window.compileTime = moment.tz("<%= grunt.template.today() %>", "ddd MMM D YYYY HH:mm:ss", "UTC").valueOf();
|
||||
window.compileTime = moment.tz("<%= compileTime %>", "DD/MM/YYYY HH:mm:ss z", "UTC").valueOf();
|
||||
window.compileMessage = "<%= compileMsg %>";
|
||||
|
||||
document.addEventListener("DOMContentLoaded", main, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue