mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 06:55:08 -04:00
Merged esm branch into feature-magic. Ported FileType ops.
This commit is contained in:
commit
ee519c7352
385 changed files with 34205 additions and 39954 deletions
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
import "babel-polyfill";
|
||||
import Chef from "./Chef.js";
|
||||
import OperationConfig from "./config/MetaConfig.js";
|
||||
import OpModules from "./config/modules/Default.js";
|
||||
import Chef from "./Chef";
|
||||
import OperationConfig from "./config/OperationConfig.json";
|
||||
import OpModules from "./config/modules/Default";
|
||||
|
||||
// Add ">" to the start of all log messages in the Chef Worker
|
||||
import loglevelMessagePrefix from "loglevel-message-prefix";
|
||||
|
@ -60,6 +60,9 @@ self.addEventListener("message", function(e) {
|
|||
case "silentBake":
|
||||
silentBake(r.data);
|
||||
break;
|
||||
case "getDishAs":
|
||||
getDishAs(r.data);
|
||||
break;
|
||||
case "docURL":
|
||||
// Used to set the URL of the current document so that scripts can be
|
||||
// imported into an inline worker.
|
||||
|
@ -125,6 +128,22 @@ function silentBake(data) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translates the dish to a given type.
|
||||
*/
|
||||
async function getDishAs(data) {
|
||||
const value = await self.chef.getDishAs(data.dish, data.type);
|
||||
|
||||
self.postMessage({
|
||||
action: "dishReturned",
|
||||
data: {
|
||||
value: value,
|
||||
id: data.id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculates highlight offsets if possible.
|
||||
*
|
||||
|
@ -151,12 +170,13 @@ function calculateHighlights(recipeConfig, direction, pos) {
|
|||
*/
|
||||
self.loadRequiredModules = function(recipeConfig) {
|
||||
recipeConfig.forEach(op => {
|
||||
let module = self.OperationConfig[op.op].module;
|
||||
const module = self.OperationConfig[op.op].module;
|
||||
|
||||
if (!OpModules.hasOwnProperty(module)) {
|
||||
log.info("Loading module " + module);
|
||||
self.sendStatusMessage("Loading module " + module);
|
||||
self.importScripts(self.docURL + "/" + module + ".js");
|
||||
log.info(`Loading ${module} module`);
|
||||
self.sendStatusMessage(`Loading ${module} module`);
|
||||
self.importScripts(`${self.docURL}/${module}.js`);
|
||||
self.sendStatusMessage("");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue