mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Merge conflict
This commit is contained in:
commit
80cdf0c014
76 changed files with 1504 additions and 809 deletions
|
@ -12,7 +12,7 @@ import Utils from "../core/Utils.js";
|
|||
* @param {App} app - The main view object for CyberChef.
|
||||
* @param {Manager} manager - The CyberChef event manager.
|
||||
*/
|
||||
var ControlsWaiter = function(app, manager) {
|
||||
const ControlsWaiter = function(app, manager) {
|
||||
this.app = app;
|
||||
this.manager = manager;
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ var ControlsWaiter = function(app, manager) {
|
|||
* without wrapping or overflowing.
|
||||
*/
|
||||
ControlsWaiter.prototype.adjustWidth = function() {
|
||||
var controls = document.getElementById("controls"),
|
||||
let controls = document.getElementById("controls"),
|
||||
step = document.getElementById("step"),
|
||||
clrBreaks = document.getElementById("clr-breaks"),
|
||||
saveImg = document.querySelector("#save img"),
|
||||
|
@ -66,7 +66,7 @@ ControlsWaiter.prototype.adjustWidth = function() {
|
|||
* @param {boolean} value - The new value for Auto Bake.
|
||||
*/
|
||||
ControlsWaiter.prototype.setAutoBake = function(value) {
|
||||
var autoBakeCheckbox = document.getElementById("auto-bake");
|
||||
const autoBakeCheckbox = document.getElementById("auto-bake");
|
||||
|
||||
if (autoBakeCheckbox.checked !== value) {
|
||||
autoBakeCheckbox.click();
|
||||
|
@ -79,7 +79,7 @@ ControlsWaiter.prototype.setAutoBake = function(value) {
|
|||
*/
|
||||
ControlsWaiter.prototype.bakeClick = function() {
|
||||
this.app.bake();
|
||||
var outputText = document.getElementById("output-text");
|
||||
const outputText = document.getElementById("output-text");
|
||||
outputText.focus();
|
||||
outputText.setSelectionRange(0, 0);
|
||||
};
|
||||
|
@ -90,7 +90,7 @@ ControlsWaiter.prototype.bakeClick = function() {
|
|||
*/
|
||||
ControlsWaiter.prototype.stepClick = function() {
|
||||
this.app.bake(true);
|
||||
var outputText = document.getElementById("output-text");
|
||||
const outputText = document.getElementById("output-text");
|
||||
outputText.focus();
|
||||
outputText.setSelectionRange(0, 0);
|
||||
};
|
||||
|
@ -100,7 +100,7 @@ ControlsWaiter.prototype.stepClick = function() {
|
|||
* Handler for changes made to the Auto Bake checkbox.
|
||||
*/
|
||||
ControlsWaiter.prototype.autoBakeChange = function() {
|
||||
var autoBakeLabel = document.getElementById("auto-bake-label"),
|
||||
let autoBakeLabel = document.getElementById("auto-bake-label"),
|
||||
autoBakeCheckbox = document.getElementById("auto-bake");
|
||||
|
||||
this.app.autoBake_ = autoBakeCheckbox.checked;
|
||||
|
@ -128,9 +128,9 @@ ControlsWaiter.prototype.clearRecipeClick = function() {
|
|||
* recipe.
|
||||
*/
|
||||
ControlsWaiter.prototype.clearBreaksClick = function() {
|
||||
var bps = document.querySelectorAll("#rec-list li.operation .breakpoint");
|
||||
const bps = document.querySelectorAll("#rec-list li.operation .breakpoint");
|
||||
|
||||
for (var i = 0; i < bps.length; i++) {
|
||||
for (let i = 0; i < bps.length; i++) {
|
||||
bps[i].setAttribute("break", "false");
|
||||
bps[i].classList.remove("breakpoint-selected");
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ ControlsWaiter.prototype.clearBreaksClick = function() {
|
|||
ControlsWaiter.prototype.initialiseSaveLink = function(recipeConfig) {
|
||||
recipeConfig = recipeConfig || this.app.getRecipeConfig();
|
||||
|
||||
var includeRecipe = document.getElementById("save-link-recipe-checkbox").checked,
|
||||
let includeRecipe = document.getElementById("save-link-recipe-checkbox").checked,
|
||||
includeInput = document.getElementById("save-link-input-checkbox").checked,
|
||||
saveLinkEl = document.getElementById("save-link"),
|
||||
saveLink = this.generateStateUrl(includeRecipe, includeInput, recipeConfig);
|
||||
|
@ -167,7 +167,7 @@ ControlsWaiter.prototype.initialiseSaveLink = function(recipeConfig) {
|
|||
ControlsWaiter.prototype.generateStateUrl = function(includeRecipe, includeInput, recipeConfig, baseURL) {
|
||||
recipeConfig = recipeConfig || this.app.getRecipeConfig();
|
||||
|
||||
var link = baseURL || window.location.protocol + "//" +
|
||||
let link = baseURL || window.location.protocol + "//" +
|
||||
window.location.host +
|
||||
window.location.pathname,
|
||||
recipeStr = JSON.stringify(recipeConfig),
|
||||
|
@ -195,7 +195,7 @@ ControlsWaiter.prototype.generateStateUrl = function(includeRecipe, includeInput
|
|||
*/
|
||||
ControlsWaiter.prototype.saveTextChange = function() {
|
||||
try {
|
||||
var recipeConfig = JSON.parse(document.getElementById("save-text").value);
|
||||
const recipeConfig = JSON.parse(document.getElementById("save-text").value);
|
||||
this.initialiseSaveLink(recipeConfig);
|
||||
} catch (err) {}
|
||||
};
|
||||
|
@ -205,7 +205,7 @@ ControlsWaiter.prototype.saveTextChange = function() {
|
|||
* Handler for the 'Save' command. Pops up the save dialog box.
|
||||
*/
|
||||
ControlsWaiter.prototype.saveClick = function() {
|
||||
var recipeConfig = this.app.getRecipeConfig(),
|
||||
let recipeConfig = this.app.getRecipeConfig(),
|
||||
recipeStr = JSON.stringify(recipeConfig).replace(/},{/g, "},\n{");
|
||||
|
||||
document.getElementById("save-text").value = recipeStr;
|
||||
|
@ -244,15 +244,15 @@ ControlsWaiter.prototype.loadClick = function() {
|
|||
* Saves the recipe specified in the save textarea to local storage.
|
||||
*/
|
||||
ControlsWaiter.prototype.saveButtonClick = function() {
|
||||
var recipeName = document.getElementById("save-name").value,
|
||||
recipeStr = document.getElementById("save-text").value;
|
||||
let recipeName = Utils.escapeHtml(document.getElementById("save-name").value);
|
||||
let recipeStr = document.getElementById("save-text").value;
|
||||
|
||||
if (!recipeName) {
|
||||
this.app.alert("Please enter a recipe name", "danger", 2000);
|
||||
return;
|
||||
}
|
||||
|
||||
var savedRecipes = localStorage.savedRecipes ?
|
||||
let savedRecipes = localStorage.savedRecipes ?
|
||||
JSON.parse(localStorage.savedRecipes) : [],
|
||||
recipeId = localStorage.recipeId || 0;
|
||||
|
||||
|
@ -273,22 +273,23 @@ ControlsWaiter.prototype.saveButtonClick = function() {
|
|||
* Populates the list of saved recipes in the load dialog box from local storage.
|
||||
*/
|
||||
ControlsWaiter.prototype.populateLoadRecipesList = function() {
|
||||
var loadNameEl = document.getElementById("load-name");
|
||||
const loadNameEl = document.getElementById("load-name");
|
||||
|
||||
// Remove current recipes from select
|
||||
var i = loadNameEl.options.length;
|
||||
let i = loadNameEl.options.length;
|
||||
while (i--) {
|
||||
loadNameEl.remove(i);
|
||||
}
|
||||
|
||||
// Add recipes to select
|
||||
var savedRecipes = localStorage.savedRecipes ?
|
||||
const savedRecipes = localStorage.savedRecipes ?
|
||||
JSON.parse(localStorage.savedRecipes) : [];
|
||||
|
||||
for (i = 0; i < savedRecipes.length; i++) {
|
||||
var opt = document.createElement("option");
|
||||
const opt = document.createElement("option");
|
||||
opt.value = savedRecipes[i].id;
|
||||
opt.innerHTML = savedRecipes[i].name;
|
||||
// Unescape then re-escape in case localStorage has been corrupted
|
||||
opt.innerHTML = Utils.escapeHtml(Utils.unescapeHtml(savedRecipes[i].name));
|
||||
|
||||
loadNameEl.appendChild(opt);
|
||||
}
|
||||
|
@ -302,7 +303,7 @@ ControlsWaiter.prototype.populateLoadRecipesList = function() {
|
|||
* Removes the currently selected recipe from local storage.
|
||||
*/
|
||||
ControlsWaiter.prototype.loadDeleteClick = function() {
|
||||
var id = parseInt(document.getElementById("load-name").value, 10),
|
||||
let id = parseInt(document.getElementById("load-name").value, 10),
|
||||
savedRecipes = localStorage.savedRecipes ?
|
||||
JSON.parse(localStorage.savedRecipes) : [];
|
||||
|
||||
|
@ -319,12 +320,12 @@ ControlsWaiter.prototype.loadDeleteClick = function() {
|
|||
* Displays the selected recipe in the load text box.
|
||||
*/
|
||||
ControlsWaiter.prototype.loadNameChange = function(e) {
|
||||
var el = e.target,
|
||||
let el = e.target,
|
||||
savedRecipes = localStorage.savedRecipes ?
|
||||
JSON.parse(localStorage.savedRecipes) : [],
|
||||
id = parseInt(el.value, 10);
|
||||
|
||||
var recipe = savedRecipes.filter(function(r) {
|
||||
const recipe = savedRecipes.filter(function(r) {
|
||||
return r.id === id;
|
||||
})[0];
|
||||
|
||||
|
@ -337,7 +338,7 @@ ControlsWaiter.prototype.loadNameChange = function(e) {
|
|||
*/
|
||||
ControlsWaiter.prototype.loadButtonClick = function() {
|
||||
try {
|
||||
var recipeConfig = JSON.parse(document.getElementById("load-text").value);
|
||||
const recipeConfig = JSON.parse(document.getElementById("load-text").value);
|
||||
this.app.setRecipeConfig(recipeConfig);
|
||||
|
||||
$("#rec-list [data-toggle=popover]").popover();
|
||||
|
@ -351,7 +352,7 @@ ControlsWaiter.prototype.loadButtonClick = function() {
|
|||
* Populates the bug report information box with useful technical info.
|
||||
*/
|
||||
ControlsWaiter.prototype.supportButtonClick = function() {
|
||||
var reportBugInfo = document.getElementById("report-bug-info"),
|
||||
let reportBugInfo = document.getElementById("report-bug-info"),
|
||||
saveLink = this.generateStateUrl(true, true, null, "https://gchq.github.io/CyberChef/");
|
||||
|
||||
reportBugInfo.innerHTML = "* CyberChef compile time: " + COMPILE_TIME + "\n" +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue