diff --git a/release/new_cyber_chef.pl b/release/new_cyber_chef.pl index 3fcbf4a1fd..7a97778a3e 100755 --- a/release/new_cyber_chef.pl +++ b/release/new_cyber_chef.pl @@ -46,17 +46,23 @@ } }) .then((result) => { + data = result.data; + }) + .catch((error) => { + console.log('error', error); + }).finally(() => { interval = setInterval(() => { if (typeof app !== 'undefined') { // THIS IS A HACK TO GET AROUND A CYBERCHEF BUG // https://github.com/gchq/CyberChef/issues/1468 // https://github.com/gchq/CyberChef/pull/1549 + // replaces the addOperation function app.manager.recipe.addOperation = (name) => { const item = document.createElement('li'); item.classList.add('operation'); - if (app.operations[name] != null) { + if (app.operations[name] != null) { // THIS is the fix item.innerHTML = name; } @@ -68,14 +74,14 @@ return item; }; - app.manager.recipe.addOperation('From Hex'); - app.setInput(result.data); + if (data) { + app.manager.recipe.addOperation('From Hex'); + app.setInput(data); + } + clearInterval(interval); } }, 100); - }) - .catch((error) => { - console.log('error', error); }); setTimeout(() => {