mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-10 16:25:01 -04:00
Add special case for Magic (flow control) to node api
This commit is contained in:
parent
3ca1c22945
commit
a80c8ae0c0
3 changed files with 359 additions and 30 deletions
|
@ -191,7 +191,30 @@ export function _wrap(OpClass) {
|
|||
*/
|
||||
wrapped = async (input, args=null) => {
|
||||
const {transformedInput, transformedArgs} = prepareOp(opInstance, input, args);
|
||||
|
||||
// SPECIAL CASE for Magic.
|
||||
if (opInstance.flowControl) {
|
||||
opInstance.ingValues = transformedArgs;
|
||||
|
||||
let state = {
|
||||
"progress": 0,
|
||||
"dish": ensureIsDish(transformedInput),
|
||||
"opList": [opInstance],
|
||||
"numJumps": 0,
|
||||
"numRegisters": 0,
|
||||
"forkOffset": 0
|
||||
}
|
||||
|
||||
const updatedState = await opInstance.run(state);
|
||||
|
||||
return new NodeDish({
|
||||
value: updatedState.dish.value,
|
||||
type: opInstance.outputType,
|
||||
});
|
||||
}
|
||||
|
||||
const result = await opInstance.run(transformedInput, transformedArgs);
|
||||
|
||||
return new NodeDish({
|
||||
value: result,
|
||||
type: opInstance.outputType,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue