mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Replaced jsHint with eslint. Fixes #4.
This commit is contained in:
parent
e2e68dd876
commit
af4644c9eb
48 changed files with 1741 additions and 1685 deletions
|
@ -35,33 +35,33 @@ Chef.prototype.bake = function(input_text, recipe_config, options, progress, ste
|
|||
recipe = new Recipe(recipe_config),
|
||||
contains_fc = recipe.contains_flow_control(),
|
||||
error = false;
|
||||
|
||||
|
||||
// Reset attempt_highlight flag
|
||||
if (options.hasOwnProperty("attempt_highlight")) {
|
||||
options.attempt_highlight = true;
|
||||
}
|
||||
|
||||
|
||||
if (contains_fc) options.attempt_highlight = false;
|
||||
|
||||
|
||||
// Clean up progress
|
||||
if (progress >= recipe_config.length) {
|
||||
progress = 0;
|
||||
}
|
||||
|
||||
|
||||
if (step) {
|
||||
// Unset breakpoint on this step
|
||||
recipe.set_breakpoint(progress, false);
|
||||
// Set breakpoint on next step
|
||||
recipe.set_breakpoint(progress + 1, true);
|
||||
}
|
||||
|
||||
|
||||
// If stepping with flow control, we have to start from the beginning
|
||||
// but still want to skip all previous breakpoints
|
||||
if (progress > 0 && contains_fc) {
|
||||
recipe.remove_breaks_up_to(progress);
|
||||
progress = 0;
|
||||
}
|
||||
|
||||
|
||||
// If starting from scratch, load data
|
||||
if (progress === 0) {
|
||||
this.dish.set(input_text, Dish.STRING);
|
||||
|
@ -70,22 +70,22 @@ Chef.prototype.bake = function(input_text, recipe_config, options, progress, ste
|
|||
try {
|
||||
progress = recipe.execute(this.dish, progress);
|
||||
} catch (err) {
|
||||
// We can't throw the error from here as we will return in the finally block and ignore it
|
||||
// so we return the error in the result instead.
|
||||
// Return the error in the result so that everything else gets correctly updated
|
||||
// rather than throwing it here and losing state info.
|
||||
error = err;
|
||||
progress = err.progress;
|
||||
} finally {
|
||||
return {
|
||||
result: this.dish.type == Dish.HTML ?
|
||||
this.dish.get(Dish.HTML) :
|
||||
this.dish.get(Dish.STRING),
|
||||
type: Dish.enum_lookup(this.dish.type),
|
||||
progress: progress,
|
||||
options: options,
|
||||
duration: new Date().getTime() - start_time,
|
||||
error: error
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
result: this.dish.type === Dish.HTML ?
|
||||
this.dish.get(Dish.HTML) :
|
||||
this.dish.get(Dish.STRING),
|
||||
type: Dish.enum_lookup(this.dish.type),
|
||||
progress: progress,
|
||||
options: options,
|
||||
duration: new Date().getTime() - start_time,
|
||||
error: error
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
@ -94,12 +94,12 @@ Chef.prototype.bake = function(input_text, recipe_config, options, progress, ste
|
|||
* it swaps out the memory for that tab. If the CyberChef tab has been unfocused for more than a
|
||||
* minute, we run a silent bake which will force the browser to load and cache all the relevant
|
||||
* JavaScript code needed to do a real bake.
|
||||
*
|
||||
*
|
||||
* This will stop baking taking a long time when the CyberChef browser tab has been unfocused for a
|
||||
* long time and the browser has swapped out all its memory.
|
||||
*
|
||||
*
|
||||
* The output will not be modified (hence "silent" bake).
|
||||
*
|
||||
*
|
||||
* This will only actually execute the recipe if auto-bake is enabled, otherwise it will just load
|
||||
* the recipe, ingredients and dish.
|
||||
*
|
||||
|
@ -110,7 +110,7 @@ Chef.prototype.silent_bake = function(recipe_config) {
|
|||
var start_time = new Date().getTime(),
|
||||
recipe = new Recipe(recipe_config),
|
||||
dish = new Dish("", Dish.STRING);
|
||||
|
||||
|
||||
try {
|
||||
recipe.execute(dish);
|
||||
} catch(err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue