Added 'Report a bug' tab to the 'About/Support' pane.

feature-extract-files
n1474335 2017-02-07 20:31:15 +00:00
parent 6eacd213a3
commit 4f0d153e73
12 changed files with 65 additions and 18 deletions

View File

@ -181,6 +181,7 @@ module.exports = function(grunt) {
var templateOptions = {
data: {
compileTime: grunt.template.today("dd/mm/yyyy HH:MM:ss") + " UTC",
compileMsg: grunt.option("compile-msg") || grunt.option("msg") || "",
codebaseStats: grunt.file.read("src/static/stats.txt").split("\n").join("<br>")
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -274,7 +274,7 @@
</div>
<div class="modal-body">
<img class="about-img-left" src="images/cyberchef-128x128.png" />
<p class="subtext">Compile time: <%= grunt.template.today("dd/mm/yyyy HH:MM:ss") %> UTC</p>
<p class="subtext">Compile time: <%= compileTime %></p>
<p>&copy Crown Copyright 2016.</p>
<p>Licenced under the Apache Licence, Version 2.0.</p>
<br>
@ -285,6 +285,10 @@
<img src='images/help-16x16.png' />
FAQs
</a></li>
<li role='presentation'><a href='#report-bug' aria-controls='messages' role='tab' data-toggle='tab'>
<img src='images/bug-16x16.png' />
Report a bug
</a></li>
<li role='presentation'><a href='#stats' aria-controls='messages' role='tab' data-toggle='tab'>
<img src='images/stats-16x16.png' />
Stats
@ -333,6 +337,14 @@
<p><a href='?recipe=%5B%7B"op"%3A"Fork"%2C"args"%3A%5B"%5C%5Cn"%2C"%5C%5Cn"%5D%7D%2C%7B"op"%3A"From%20UNIX%20Timestamp"%2C"args"%3A%5B"Seconds%20(s)"%5D%7D%5D&input=OTc4MzQ2ODAwCjEwMTI2NTEyMDAKMTA0NjY5NjQwMAoxMDgxMDg3MjAwCjExMTUzMDUyMDAKMTE0OTYwOTYwMA%3D%3D'>Click here</a> for an example.</p>
</div>
</div>
<div role='tabpanel' class='tab-pane' id='report-bug'>
<br>
<p>If you find a bug in CyberChef, please raise an issue in our GitHub repository explaining it in as much detail as possible. Copy and include the following information if relevant.</p>
<br>
<pre id='report-bug-info'></pre>
<br>
<a class="btn btn-primary" href="https://github.com/gchq/CyberChef/issues/new" role="button">Raise issue on GitHub</a>
</div>
<div role='tabpanel' class='tab-pane' id='stats'>
<br>
<p>If you're a nerd like me, you might find statistics really fun! Here's some about the CyberChef code base:</p>

View File

@ -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/* */

View File

@ -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) +

View File

@ -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.";

View File

@ -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";
};

View File

@ -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

View File

@ -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);

View File

@ -1,9 +1,9 @@
212 source files
115060 lines
115106 lines
4.3M size
142 JavaScript source files
105900 lines
105926 lines
3.8M size
83 third party JavaScript source files
@ -11,10 +11,10 @@
3.0M size
59 first party JavaScript source files
19642 lines
19668 lines
740K size
3.4M uncompressed JavaScript size
3.5M uncompressed JavaScript size
1.9M compressed JavaScript size
15 categories