2
0
mirror of https://github.com/gchq/CyberChef synced 2025-12-05 23:53:27 +00:00

Merge pull request #1786 from zb3/fix-overwritten-output

This commit is contained in:
a3957273
2024-04-15 01:17:49 +01:00
committed by GitHub
3 changed files with 69 additions and 1 deletions

View File

@@ -160,7 +160,12 @@ class App {
// has completed.
if (this.autoBakePause) return false;
if (this.autoBake_ && !this.baking) {
if (this.baking) {
this.manager.worker.cancelBakeForAutoBake();
this.baking = false;
}
if (this.autoBake_) {
log.debug("Auto-baking");
this.manager.worker.bakeInputs({
nums: [this.manager.tabs.getActiveTab("input")],

View File

@@ -322,6 +322,28 @@ class WorkerWaiter {
};
}
/**
* Cancels the current bake making it possible to autobake again
*/
cancelBakeForAutoBake() {
if (this.totalOutputs > 1) {
this.cancelBake();
} else {
// In this case the UI changes can be skipped
for (let i = this.chefWorkers.length - 1; i >= 0; i--) {
if (this.chefWorkers[i].active) {
this.removeChefWorker(this.chefWorkers[i]);
}
}
this.inputs = [];
this.inputNums = [];
this.totalOutputs = 0;
this.loadingOutputs = 0;
}
}
/**
* Cancels the current bake by terminating and removing all ChefWorkers
*