mirror of
https://github.com/gchq/CyberChef
synced 2025-01-09 11:08:47 +00:00
Fix some more autobake weirdness.
Input passed in the URL is now set on load. Added a new progress bar.
This commit is contained in:
parent
8e9717906f
commit
e9d60f73f4
5 changed files with 16 additions and 10 deletions
|
@ -198,7 +198,10 @@ class App {
|
||||||
* @param {boolean} [silent=false] - Suppress statechange event
|
* @param {boolean} [silent=false] - Suppress statechange event
|
||||||
*/
|
*/
|
||||||
setInput(input, silent=false) {
|
setInput(input, silent=false) {
|
||||||
this.manager.input.set(input, silent);
|
// Assume that there aren't any inputs
|
||||||
|
let inputNum = this.manager.input.getActiveTab();
|
||||||
|
if (inputNum === -1) inputNum = 1;
|
||||||
|
this.manager.input.updateInputValue(inputNum, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -446,7 +449,7 @@ class App {
|
||||||
if (this.uriParams.input) {
|
if (this.uriParams.input) {
|
||||||
try {
|
try {
|
||||||
const inputData = fromBase64(this.uriParams.input);
|
const inputData = fromBase64(this.uriParams.input);
|
||||||
this.setInput(inputData, true);
|
this.setInput(inputData, false);
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -387,19 +387,19 @@ ${navigator.userAgent}
|
||||||
const bakeButton = document.getElementById("bake"),
|
const bakeButton = document.getElementById("bake"),
|
||||||
btnText = bakeButton.querySelector("span");
|
btnText = bakeButton.querySelector("span");
|
||||||
|
|
||||||
bakeButton.style.background = "";
|
|
||||||
|
|
||||||
if (cancel) {
|
if (cancel) {
|
||||||
btnText.innerText = "Cancel";
|
btnText.innerText = "Cancel";
|
||||||
bakeButton.classList.remove("btn-success");
|
bakeButton.classList.remove("btn-success");
|
||||||
bakeButton.classList.remove("btn-warning");
|
bakeButton.classList.remove("btn-warning");
|
||||||
bakeButton.classList.add("btn-danger");
|
bakeButton.classList.add("btn-danger");
|
||||||
} else if (loading) {
|
} else if (loading) {
|
||||||
|
bakeButton.style.background = "";
|
||||||
btnText.innerText = "Loading...";
|
btnText.innerText = "Loading...";
|
||||||
bakeButton.classList.remove("btn-success");
|
bakeButton.classList.remove("btn-success");
|
||||||
bakeButton.classList.remove("btn-danger");
|
bakeButton.classList.remove("btn-danger");
|
||||||
bakeButton.classList.add("btn-warning");
|
bakeButton.classList.add("btn-warning");
|
||||||
} else {
|
} else {
|
||||||
|
bakeButton.style.background = "";
|
||||||
btnText.innerText = "Bake!";
|
btnText.innerText = "Bake!";
|
||||||
bakeButton.classList.remove("btn-danger");
|
bakeButton.classList.remove("btn-danger");
|
||||||
bakeButton.classList.remove("btn-warning");
|
bakeButton.classList.remove("btn-warning");
|
||||||
|
|
|
@ -745,6 +745,14 @@ class InputWaiter {
|
||||||
|
|
||||||
this.updateFileProgress(loadedData.activeProgress.inputNum, loadedData.activeProgress.progress);
|
this.updateFileProgress(loadedData.activeProgress.inputNum, loadedData.activeProgress.progress);
|
||||||
|
|
||||||
|
const inputTitle = document.getElementById("input").firstElementChild;
|
||||||
|
if (loaded < total) {
|
||||||
|
const percentComplete = (loaded + loading) / total * 100;
|
||||||
|
inputTitle.style.background = `linear-gradient(to right, var(--title-background-colour) ${percentComplete}%, var(--primary-background-colour) ${percentComplete}%)`;
|
||||||
|
} else {
|
||||||
|
inputTitle.style.background = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (loaded < total && autoRefresh) {
|
if (loaded < total && autoRefresh) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
this.inputWorker.postMessage({
|
this.inputWorker.postMessage({
|
||||||
|
|
|
@ -127,7 +127,7 @@ self.autoBake = function(inputNum) {
|
||||||
data: {
|
data: {
|
||||||
input: inputData,
|
input: inputData,
|
||||||
inputNum: parseInt(inputNum, 10),
|
inputNum: parseInt(inputNum, 10),
|
||||||
override: true
|
override: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.postMessage({
|
self.postMessage({
|
||||||
|
|
|
@ -322,7 +322,6 @@ class WorkerWaiter {
|
||||||
if (typeof nextInput.inputNum === "string") nextInput.inputNum = parseInt(nextInput.inputNum, 10);
|
if (typeof nextInput.inputNum === "string") nextInput.inputNum = parseInt(nextInput.inputNum, 10);
|
||||||
|
|
||||||
log.debug(`Baking input ${nextInput.inputNum}.`);
|
log.debug(`Baking input ${nextInput.inputNum}.`);
|
||||||
this.setBakingStatus(true);
|
|
||||||
this.manager.output.updateOutputStatus("baking", nextInput.inputNum);
|
this.manager.output.updateOutputStatus("baking", nextInput.inputNum);
|
||||||
this.manager.output.updateOutputMessage(`Baking input ${nextInput.inputNum}...`, nextInput.inputNum);
|
this.manager.output.updateOutputMessage(`Baking input ${nextInput.inputNum}...`, nextInput.inputNum);
|
||||||
|
|
||||||
|
@ -404,12 +403,8 @@ class WorkerWaiter {
|
||||||
|
|
||||||
|
|
||||||
if (inputData.override) {
|
if (inputData.override) {
|
||||||
for (let i = this.chefWorkers.length - 1; i >= 0; i--) {
|
|
||||||
this.removeChefWorker(this.chefWorkers[i]);
|
|
||||||
}
|
|
||||||
this.totalOutputs = 1;
|
this.totalOutputs = 1;
|
||||||
this.inputs = [inputData];
|
this.inputs = [inputData];
|
||||||
this.bakeNextInput(this.addChefWorker());
|
|
||||||
} else {
|
} else {
|
||||||
this.totalOutputs++;
|
this.totalOutputs++;
|
||||||
this.inputs.push(inputData);
|
this.inputs.push(inputData);
|
||||||
|
|
Loading…
Reference in a new issue