Text can be horizontally or vertically aligned, or the position can be manually specified. Variants of the Roboto font face are available in any size or colour.";
+ this.description =
+ "Adds text onto an image.
Note: GIF files are supported for input, but cannot be outputted.";
+ this.description =
+ "Converts an image between different formats. Supported formats:
Autocrop Automatically crops same-colour borders from the image.
Autocrop tolerance A percentage value for the tolerance of colour difference between pixels.
Only autocrop frames Only crop real frames (all sides must have the same border)
Symmetric autocrop Force autocrop to be symmetric (top/bottom and left/right are cropped by the same amount)
Autocrop keep border The number of pixels of border to leave around the image.";
+ this.description =
+ "Crops an image to the specified region, or automatically crops edges.
Autocrop Automatically crops same-colour borders from the image.
Autocrop tolerance A percentage value for the tolerance of colour difference between pixels.
Only autocrop frames Only crop real frames (all sides must have the same border)
Symmetric autocrop Force autocrop to be symmetric (top/bottom and left/right are cropped by the same amount)
Autocrop keep border The number of pixels of border to leave around the image.";
this.infoURL = "https://wikipedia.org/wiki/Cropping_(image)";
this.inputType = "ArrayBuffer";
this.outputType = "ArrayBuffer";
@@ -34,30 +34,30 @@ class CropImage extends Operation {
name: "X Position",
type: "number",
value: 0,
- min: 0
+ min: 0,
},
{
name: "Y Position",
type: "number",
value: 0,
- min: 0
+ min: 0,
},
{
name: "Width",
type: "number",
value: 10,
- min: 1
+ min: 1,
},
{
name: "Height",
type: "number",
value: 10,
- min: 1
+ min: 1,
},
{
name: "Autocrop",
type: "boolean",
- value: false
+ value: false,
},
{
name: "Autocrop tolerance (%)",
@@ -65,24 +65,24 @@ class CropImage extends Operation {
value: 0.02,
min: 0,
max: 100,
- step: 0.01
+ step: 0.01,
},
{
name: "Only autocrop frames",
type: "boolean",
- value: true
+ value: true,
},
{
name: "Symmetric autocrop",
type: "boolean",
- value: false
+ value: false,
},
{
name: "Autocrop keep border (px)",
type: "number",
value: 0,
- min: 0
- }
+ min: 0,
+ },
];
}
@@ -92,7 +92,17 @@ class CropImage extends Operation {
* @returns {byteArray}
*/
async run(input, args) {
- const [xPos, yPos, width, height, autocrop, autoTolerance, autoFrames, autoSymmetric, autoBorder] = args;
+ const [
+ xPos,
+ yPos,
+ width,
+ height,
+ autocrop,
+ autoTolerance,
+ autoFrames,
+ autoSymmetric,
+ autoBorder,
+ ] = args;
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}
@@ -108,20 +118,25 @@ class CropImage extends Operation {
self.sendStatusMessage("Cropping image...");
if (autocrop) {
image.autocrop({
- tolerance: (autoTolerance / 100),
+ tolerance: autoTolerance / 100,
cropOnlyFrames: autoFrames,
cropSymmetric: autoSymmetric,
- leaveBorder: autoBorder
+ leaveBorder: autoBorder,
});
} else {
- image.crop(xPos, yPos, width, height);
+ image.crop({
+ x: xPos,
+ y: yPos,
+ w: width,
+ h: height,
+ });
}
let imageBuffer;
- if (image.getMIME() === "image/gif") {
- imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
+ if (image.mime === "image/gif") {
+ imageBuffer = await image.getBuffer(JimpMime.png);
} else {
- imageBuffer = await image.getBufferAsync(Jimp.AUTO);
+ imageBuffer = await image.getBuffer(image.mime);
}
return imageBuffer.buffer;
} catch (err) {
@@ -145,7 +160,6 @@ class CropImage extends Operation {
return ``;
}
-
}
export default CropImage;
diff --git a/src/core/operations/DitherImage.mjs b/src/core/operations/DitherImage.mjs
index 17051480..f21c1f88 100644
--- a/src/core/operations/DitherImage.mjs
+++ b/src/core/operations/DitherImage.mjs
@@ -9,13 +9,12 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs";
-import Jimp from "jimp/es/index.js";
+import { Jimp, JimpMime } from "jimp";
/**
* Image Dither operation
*/
class DitherImage extends Operation {
-
/**
* DitherImage constructor
*/
@@ -51,17 +50,19 @@ class DitherImage extends Operation {
try {
if (isWorkerEnvironment())
self.sendStatusMessage("Applying dither to image...");
- image.dither565();
+ image.dither();
let imageBuffer;
- if (image.getMIME() === "image/gif") {
- imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
+ if (image.mime === "image/gif") {
+ imageBuffer = await image.getBuffer(JimpMime.png);
} else {
- imageBuffer = await image.getBufferAsync(Jimp.AUTO);
+ imageBuffer = await image.getBuffer(image.mime);
}
return imageBuffer.buffer;
} catch (err) {
- throw new OperationError(`Error applying dither to image. (${err})`);
+ throw new OperationError(
+ `Error applying dither to image. (${err})`,
+ );
}
}
@@ -81,7 +82,6 @@ class DitherImage extends Operation {
return ``;
}
-
}
export default DitherImage;
diff --git a/src/core/operations/EscapeUnicodeCharacters.mjs b/src/core/operations/EscapeUnicodeCharacters.mjs
index db2680c0..08d68581 100644
--- a/src/core/operations/EscapeUnicodeCharacters.mjs
+++ b/src/core/operations/EscapeUnicodeCharacters.mjs
@@ -44,23 +44,6 @@ class EscapeUnicodeCharacters extends Operation {
"value": true
}
];
- this.checks = [
- {
- pattern: "\\\\u(?:[\\da-f]{4,6})",
- flags: "i",
- args: ["\\u"]
- },
- {
- pattern: "%u(?:[\\da-f]{4,6})",
- flags: "i",
- args: ["%u"]
- },
- {
- pattern: "U\\+(?:[\\da-f]{4,6})",
- flags: "i",
- args: ["U+"]
- }
- ];
}
/**
diff --git a/src/core/operations/ExtractLSB.mjs b/src/core/operations/ExtractLSB.mjs
index d5c80406..e64831b1 100644
--- a/src/core/operations/ExtractLSB.mjs
+++ b/src/core/operations/ExtractLSB.mjs
@@ -9,13 +9,12 @@ import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs";
import { fromBinary } from "../lib/Binary.mjs";
import { isImage } from "../lib/FileType.mjs";
-import Jimp from "jimp/es/index.js";
+import { Jimp } from "jimp";
/**
* Extract LSB operation
*/
class ExtractLSB extends Operation {
-
/**
* ExtractLSB constructor
*/
@@ -24,8 +23,10 @@ class ExtractLSB extends Operation {
this.name = "Extract LSB";
this.module = "Image";
- this.description = "Extracts the Least Significant Bit data from each pixel in an image. This is a common way to hide data in Steganography.";
- this.infoURL = "https://wikipedia.org/wiki/Bit_numbering#Least_significant_bit_in_digital_steganography";
+ this.description =
+ "Extracts the Least Significant Bit data from each pixel in an image. This is a common way to hide data in Steganography.";
+ this.infoURL =
+ "https://wikipedia.org/wiki/Bit_numbering#Least_significant_bit_in_digital_steganography";
this.inputType = "ArrayBuffer";
this.outputType = "byteArray";
this.args = [
@@ -57,8 +58,8 @@ class ExtractLSB extends Operation {
{
name: "Bit",
type: "number",
- value: 0
- }
+ value: 0,
+ },
];
}
@@ -68,21 +69,27 @@ class ExtractLSB extends Operation {
* @returns {byteArray}
*/
async run(input, args) {
- if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
+ if (!isImage(input))
+ throw new OperationError("Please enter a valid image file.");
const bit = 7 - args.pop(),
pixelOrder = args.pop(),
- colours = args.filter(option => option !== "").map(option => COLOUR_OPTIONS.indexOf(option)),
+ colours = args
+ .filter((option) => option !== "")
+ .map((option) => COLOUR_OPTIONS.indexOf(option)),
parsedImage = await Jimp.read(input),
width = parsedImage.bitmap.width,
height = parsedImage.bitmap.height,
rgba = parsedImage.bitmap.data;
if (bit < 0 || bit > 7) {
- throw new OperationError("Error: Bit argument must be between 0 and 7");
+ throw new OperationError(
+ "Error: Bit argument must be between 0 and 7",
+ );
}
- let i, combinedBinary = "";
+ let i,
+ combinedBinary = "";
if (pixelOrder === "Row") {
for (i = 0; i < rgba.length; i += 4) {
@@ -106,7 +113,6 @@ class ExtractLSB extends Operation {
return fromBinary(combinedBinary);
}
-
}
const COLOUR_OPTIONS = ["R", "G", "B", "A"];
diff --git a/src/core/operations/ExtractRGBA.mjs b/src/core/operations/ExtractRGBA.mjs
index 3339a2a7..b0fe3888 100644
--- a/src/core/operations/ExtractRGBA.mjs
+++ b/src/core/operations/ExtractRGBA.mjs
@@ -7,15 +7,14 @@
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs";
-import Jimp from "jimp/es/index.js";
+import { Jimp } from "jimp";
-import {RGBA_DELIM_OPTIONS} from "../lib/Delim.mjs";
+import { RGBA_DELIM_OPTIONS } from "../lib/Delim.mjs";
/**
* Extract RGBA operation
*/
class ExtractRGBA extends Operation {
-
/**
* ExtractRGBA constructor
*/
@@ -24,7 +23,8 @@ class ExtractRGBA extends Operation {
this.name = "Extract RGBA";
this.module = "Image";
- this.description = "Extracts each pixel's RGBA value in an image. These are sometimes used in Steganography to hide text or data.";
+ this.description =
+ "Extracts each pixel's RGBA value in an image. These are sometimes used in Steganography to hide text or data.";
this.infoURL = "https://wikipedia.org/wiki/RGBA_color_space";
this.inputType = "ArrayBuffer";
this.outputType = "string";
@@ -32,13 +32,13 @@ class ExtractRGBA extends Operation {
{
name: "Delimiter",
type: "editableOption",
- value: RGBA_DELIM_OPTIONS
+ value: RGBA_DELIM_OPTIONS,
},
{
name: "Include Alpha",
type: "boolean",
- value: true
- }
+ value: true,
+ },
];
}
@@ -48,18 +48,20 @@ class ExtractRGBA extends Operation {
* @returns {string}
*/
async run(input, args) {
- if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
+ if (!isImage(input))
+ throw new OperationError("Please enter a valid image file.");
const delimiter = args[0],
includeAlpha = args[1],
parsedImage = await Jimp.read(input);
let bitmap = parsedImage.bitmap.data;
- bitmap = includeAlpha ? bitmap : bitmap.filter((val, idx) => idx % 4 !== 3);
+ bitmap = includeAlpha ?
+ bitmap :
+ bitmap.filter((val, idx) => idx % 4 !== 3);
return bitmap.join(delimiter);
}
-
}
export default ExtractRGBA;
diff --git a/src/core/operations/FlipImage.mjs b/src/core/operations/FlipImage.mjs
index f4b7cba9..cf9c747f 100644
--- a/src/core/operations/FlipImage.mjs
+++ b/src/core/operations/FlipImage.mjs
@@ -9,13 +9,12 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs";
-import Jimp from "jimp/es/index.js";
+import { Jimp, JimpMime } from "jimp";
/**
* Flip Image operation
*/
class FlipImage extends Operation {
-
/**
* FlipImage constructor
*/
@@ -33,8 +32,8 @@ class FlipImage extends Operation {
{
name: "Axis",
type: "option",
- value: ["Horizontal", "Vertical"]
- }
+ value: ["Horizontal", "Vertical"],
+ },
];
}
@@ -60,18 +59,24 @@ class FlipImage extends Operation {
self.sendStatusMessage("Flipping image...");
switch (flipAxis) {
case "Horizontal":
- image.flip(true, false);
+ image.flip({
+ horizontal: true,
+ vertical: false,
+ });
break;
case "Vertical":
- image.flip(false, true);
+ image.flip({
+ horizontal: false,
+ vertical: true,
+ });
break;
}
let imageBuffer;
- if (image.getMIME() === "image/gif") {
- imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
+ if (image.mime === "image/gif") {
+ imageBuffer = await image.getBuffer(JimpMime.png);
} else {
- imageBuffer = await image.getBufferAsync(Jimp.AUTO);
+ imageBuffer = await image.getBuffer(image.mime);
}
return imageBuffer.buffer;
} catch (err) {
@@ -95,7 +100,6 @@ class FlipImage extends Operation {
return ``;
}
-
}
export default FlipImage;
diff --git a/src/core/operations/FromBech32.mjs b/src/core/operations/FromBech32.mjs
new file mode 100644
index 00000000..8a01d4db
--- /dev/null
+++ b/src/core/operations/FromBech32.mjs
@@ -0,0 +1,149 @@
+/**
+ * @author Medjedtxm
+ * @copyright Crown Copyright 2025
+ * @license Apache-2.0
+ */
+
+import Operation from "../Operation.mjs";
+import { decode } from "../lib/Bech32.mjs";
+import { toHex } from "../lib/Hex.mjs";
+
+/**
+ * From Bech32 operation
+ */
+class FromBech32 extends Operation {
+
+ /**
+ * FromBech32 constructor
+ */
+ constructor() {
+ super();
+
+ this.name = "From Bech32";
+ this.module = "Default";
+ this.description = "Bech32 is an encoding scheme primarily used for Bitcoin SegWit addresses (BIP-0173). It uses a 32-character alphabet that excludes easily confused characters (1, b, i, o) and includes a checksum for error detection.
Bech32m (BIP-0350) is an updated version used for Bitcoin Taproot addresses.
Auto-detect will attempt Bech32 first, then Bech32m if the checksum fails.
e.g. The quoted-printable encoded string hello=20world becomes hello world";
+ this.description = "Converts QP-encoded text back to standard text. This format is a content transfer encoding common in email messages.
Normalise Image Attempts to normalise the image before parsing it to improve detection of a QR code.";
+ this.description =
+ "Reads an image file and attempts to detect and read a Quick Response (QR) code from the image.
Normalise Image Attempts to normalise the image before parsing it to improve detection of a QR code.";
this.infoURL = "https://wikipedia.org/wiki/QR_code";
this.inputType = "ArrayBuffer";
this.outputType = "string";
this.args = [
{
- "name": "Normalise image",
- "type": "boolean",
- "value": false
- }
+ name: "Normalise image",
+ type: "boolean",
+ value: false,
+ },
];
this.checks = [
{
- "pattern": "^(?:\\xff\\xd8\\xff|\\x89\\x50\\x4e\\x47|\\x47\\x49\\x46|.{8}\\x57\\x45\\x42\\x50|\\x42\\x4d)",
- "flags": "",
- "args": [false],
- "useful": true
- }
+ pattern:
+ "^(?:\\xff\\xd8\\xff|\\x89\\x50\\x4e\\x47|\\x47\\x49\\x46|.{8}\\x57\\x45\\x42\\x50|\\x42\\x4d)",
+ flags: "",
+ args: [false],
+ useful: true,
+ },
];
}
@@ -54,9 +55,8 @@ class ParseQRCode extends Operation {
if (!isImage(input)) {
throw new OperationError("Invalid file type.");
}
- return await parseQrCode(input, normalise);
+ return parseQrCode(input, normalise);
}
-
}
export default ParseQRCode;
diff --git a/src/core/operations/RandomizeColourPalette.mjs b/src/core/operations/RandomizeColourPalette.mjs
index fa8fa59e..186023c2 100644
--- a/src/core/operations/RandomizeColourPalette.mjs
+++ b/src/core/operations/RandomizeColourPalette.mjs
@@ -10,13 +10,12 @@ import Utils from "../Utils.mjs";
import { isImage } from "../lib/FileType.mjs";
import { runHash } from "../lib/Hash.mjs";
import { toBase64 } from "../lib/Base64.mjs";
-import Jimp from "jimp/es/index.js";
+import { Jimp } from "jimp";
/**
* Randomize Colour Palette operation
*/
class RandomizeColourPalette extends Operation {
-
/**
* RandomizeColourPalette constructor
*/
@@ -25,7 +24,8 @@ class RandomizeColourPalette extends Operation {
this.name = "Randomize Colour Palette";
this.module = "Image";
- this.description = "Randomizes each colour in an image's colour palette. This can often reveal text or symbols that were previously a very similar colour to their surroundings, a technique sometimes used in Steganography.";
+ this.description =
+ "Randomizes each colour in an image's colour palette. This can often reveal text or symbols that were previously a very similar colour to their surroundings, a technique sometimes used in Steganography.";
this.infoURL = "https://wikipedia.org/wiki/Indexed_color";
this.inputType = "ArrayBuffer";
this.outputType = "ArrayBuffer";
@@ -34,8 +34,8 @@ class RandomizeColourPalette extends Operation {
{
name: "Seed",
type: "string",
- value: ""
- }
+ value: "",
+ },
];
}
@@ -45,23 +45,24 @@ class RandomizeColourPalette extends Operation {
* @returns {ArrayBuffer}
*/
async run(input, args) {
- if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
+ if (!isImage(input))
+ throw new OperationError("Please enter a valid image file.");
- const seed = args[0] || (Math.random().toString().substr(2)),
+ const seed = args[0] || Math.random().toString().substr(2),
parsedImage = await Jimp.read(input),
width = parsedImage.bitmap.width,
height = parsedImage.bitmap.height;
let rgbString, rgbHash, rgbHex;
- parsedImage.scan(0, 0, width, height, function(x, y, idx) {
- rgbString = this.bitmap.data.slice(idx, idx+3).join(".");
+ parsedImage.scan(0, 0, width, height, function (x, y, idx) {
+ rgbString = this.bitmap.data.slice(idx, idx + 3).join(".");
rgbHash = runHash("md5", Utils.strToArrayBuffer(seed + rgbString));
rgbHex = rgbHash.substr(0, 6) + "ff";
parsedImage.setPixelColor(parseInt(rgbHex, 16), x, y);
});
- const imageBuffer = await parsedImage.getBufferAsync(Jimp.AUTO);
+ const imageBuffer = await parsedImage.getBuffer(parsedImage.mime);
return new Uint8Array(imageBuffer).buffer;
}
@@ -77,7 +78,6 @@ class RandomizeColourPalette extends Operation {
return ``;
}
-
}
export default RandomizeColourPalette;
diff --git a/src/core/operations/ResizeImage.mjs b/src/core/operations/ResizeImage.mjs
index 2d2af045..bec07c4e 100644
--- a/src/core/operations/ResizeImage.mjs
+++ b/src/core/operations/ResizeImage.mjs
@@ -9,13 +9,12 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs";
-import Jimp from "jimp/es/index.js";
+import { Jimp, JimpMime, ResizeStrategy } from "jimp";
/**
* Resize Image operation
*/
class ResizeImage extends Operation {
-
/**
* ResizeImage constructor
*/
@@ -24,7 +23,8 @@ class ResizeImage extends Operation {
this.name = "Resize Image";
this.module = "Image";
- this.description = "Resizes an image to the specified width and height values.";
+ this.description =
+ "Resizes an image to the specified width and height values.";
this.infoURL = "https://wikipedia.org/wiki/Image_scaling";
this.inputType = "ArrayBuffer";
this.outputType = "ArrayBuffer";
@@ -34,23 +34,23 @@ class ResizeImage extends Operation {
name: "Width",
type: "number",
value: 100,
- min: 1
+ min: 1,
},
{
name: "Height",
type: "number",
value: 100,
- min: 1
+ min: 1,
},
{
name: "Unit type",
type: "option",
- value: ["Pixels", "Percent"]
+ value: ["Pixels", "Percent"],
},
{
name: "Maintain aspect ratio",
type: "boolean",
- value: false
+ value: false,
},
{
name: "Resizing algorithm",
@@ -60,10 +60,10 @@ class ResizeImage extends Operation {
"Bilinear",
"Bicubic",
"Hermite",
- "Bezier"
+ "Bezier",
],
- defaultIndex: 1
- }
+ defaultIndex: 1,
+ },
];
}
@@ -80,11 +80,11 @@ class ResizeImage extends Operation {
resizeAlg = args[4];
const resizeMap = {
- "Nearest Neighbour": Jimp.RESIZE_NEAREST_NEIGHBOR,
- "Bilinear": Jimp.RESIZE_BILINEAR,
- "Bicubic": Jimp.RESIZE_BICUBIC,
- "Hermite": Jimp.RESIZE_HERMITE,
- "Bezier": Jimp.RESIZE_BEZIER
+ "Nearest Neighbour": ResizeStrategy.NEAREST_NEIGHBOR,
+ Bilinear: ResizeStrategy.BILINEAR,
+ Bicubic: ResizeStrategy.BICUBIC,
+ Hermite: ResizeStrategy.HERMITE,
+ Bezier: ResizeStrategy.BEZIER,
};
if (!isImage(input)) {
@@ -99,23 +99,31 @@ class ResizeImage extends Operation {
}
try {
if (unit === "Percent") {
- width = image.getWidth() * (width / 100);
- height = image.getHeight() * (height / 100);
+ width = image.width * (width / 100);
+ height = image.height * (height / 100);
}
if (isWorkerEnvironment())
self.sendStatusMessage("Resizing image...");
if (aspect) {
- image.scaleToFit(width, height, resizeMap[resizeAlg]);
+ image.scaleToFit({
+ w: width,
+ h: height,
+ mode: resizeMap[resizeAlg],
+ });
} else {
- image.resize(width, height, resizeMap[resizeAlg]);
+ image.resize({
+ w: width,
+ h: height,
+ mode: resizeMap[resizeAlg],
+ });
}
let imageBuffer;
- if (image.getMIME() === "image/gif") {
- imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
+ if (image.mime === "image/gif") {
+ imageBuffer = await image.getBuffer(JimpMime.png);
} else {
- imageBuffer = await image.getBufferAsync(Jimp.AUTO);
+ imageBuffer = await image.getBuffer(image.mime);
}
return imageBuffer.buffer;
} catch (err) {
@@ -139,7 +147,6 @@ class ResizeImage extends Operation {
return ``;
}
-
}
export default ResizeImage;
diff --git a/src/core/operations/RotateImage.mjs b/src/core/operations/RotateImage.mjs
index 894ec785..5a96ffab 100644
--- a/src/core/operations/RotateImage.mjs
+++ b/src/core/operations/RotateImage.mjs
@@ -9,13 +9,12 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs";
-import Jimp from "jimp/es/index.js";
+import { Jimp, JimpMime } from "jimp";
/**
* Rotate Image operation
*/
class RotateImage extends Operation {
-
/**
* RotateImage constructor
*/
@@ -24,7 +23,8 @@ class RotateImage extends Operation {
this.name = "Rotate Image";
this.module = "Image";
- this.description = "Rotates an image by the specified number of degrees.";
+ this.description =
+ "Rotates an image by the specified number of degrees.";
this.infoURL = "";
this.inputType = "ArrayBuffer";
this.outputType = "ArrayBuffer";
@@ -33,8 +33,8 @@ class RotateImage extends Operation {
{
name: "Rotation amount (degrees)",
type: "number",
- value: 90
- }
+ value: 90,
+ },
];
}
@@ -62,10 +62,10 @@ class RotateImage extends Operation {
image.rotate(degrees);
let imageBuffer;
- if (image.getMIME() === "image/gif") {
- imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
+ if (image.mime === "image/gif") {
+ imageBuffer = await image.getBuffer(JimpMime.png);
} else {
- imageBuffer = await image.getBufferAsync(Jimp.AUTO);
+ imageBuffer = await image.getBuffer(image.mime);
}
return imageBuffer.buffer;
} catch (err) {
@@ -89,7 +89,6 @@ class RotateImage extends Operation {
return ``;
}
-
}
export default RotateImage;
diff --git a/src/core/operations/SQLBeautify.mjs b/src/core/operations/SQLBeautify.mjs
index 0f3d2e3c..2171f7fc 100644
--- a/src/core/operations/SQLBeautify.mjs
+++ b/src/core/operations/SQLBeautify.mjs
@@ -3,8 +3,7 @@
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
-
-import vkbeautify from "vkbeautify";
+import { format } from "sql-formatter";
import Operation from "../Operation.mjs";
/**
@@ -39,7 +38,26 @@ class SQLBeautify extends Operation {
*/
run(input, args) {
const indentStr = args[0];
- return vkbeautify.sql(input, indentStr);
+ // Extract and replace bind variables like :Bind1 with __BIND_0__
+ const bindRegex = /:\w+/g;
+ const bindMap = {};
+ let bindCounter=0;
+ const placeholderInput = input.replace(bindRegex, (match) => {
+ const placeholder = `__BIND_${bindCounter++}__`;
+ bindMap[placeholder] = match;
+ return placeholder;
+ });
+ // Format the SQL with chosen options
+ let formatted= format(placeholderInput, {
+ language: "mysql", // Use MySQL as the default dialect for better compatibility with real-world SQL
+ useTabs: indentStr==="\t", // true if tab, false if spaces
+ tabWidth: indentStr.length || 4, // fallback if empty
+ indentStyle: "standard" // fine for most SQL
+ });
+ // Replace placeholders back with original bind variables
+ formatted = formatted.replace(/__BIND_\d+__/g, match => bindMap[match] || match);
+
+ return formatted;
}
}
diff --git a/src/core/operations/SharpenImage.mjs b/src/core/operations/SharpenImage.mjs
index 5cf6b606..1f5461f2 100644
--- a/src/core/operations/SharpenImage.mjs
+++ b/src/core/operations/SharpenImage.mjs
@@ -8,15 +8,13 @@ import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs";
-import { gaussianBlur } from "../lib/ImageManipulation.mjs";
import { isWorkerEnvironment } from "../Utils.mjs";
-import Jimp from "jimp/es/index.js";
+import { Jimp, JimpMime } from "jimp";
/**
* Sharpen Image operation
*/
class SharpenImage extends Operation {
-
/**
* SharpenImage constructor
*/
@@ -35,22 +33,22 @@ class SharpenImage extends Operation {
name: "Radius",
type: "number",
value: 2,
- min: 1
+ min: 1,
},
{
name: "Amount",
type: "number",
value: 1,
min: 0,
- step: 0.1
+ step: 0.1,
},
{
name: "Threshold",
type: "number",
value: 10,
min: 0,
- max: 100
- }
+ max: 100,
+ },
];
}
@@ -79,67 +77,102 @@ class SharpenImage extends Operation {
const blurMask = image.clone();
if (isWorkerEnvironment())
- self.sendStatusMessage("Sharpening image... (Blurring cloned image)");
- const blurImage = gaussianBlur(image.clone(), radius);
-
+ self.sendStatusMessage(
+ "Sharpening image... (Blurring cloned image)",
+ );
+ const blurImage = image.clone().gaussian(radius);
if (isWorkerEnvironment())
- self.sendStatusMessage("Sharpening image... (Creating unsharp mask)");
- blurMask.scan(0, 0, blurMask.bitmap.width, blurMask.bitmap.height, function(x, y, idx) {
- const blurRed = blurImage.bitmap.data[idx];
- const blurGreen = blurImage.bitmap.data[idx + 1];
- const blurBlue = blurImage.bitmap.data[idx + 2];
+ self.sendStatusMessage(
+ "Sharpening image... (Creating unsharp mask)",
+ );
+ blurMask.scan(
+ 0,
+ 0,
+ blurMask.bitmap.width,
+ blurMask.bitmap.height,
+ function (x, y, idx) {
+ const blurRed = blurImage.bitmap.data[idx];
+ const blurGreen = blurImage.bitmap.data[idx + 1];
+ const blurBlue = blurImage.bitmap.data[idx + 2];
- const normalRed = this.bitmap.data[idx];
- const normalGreen = this.bitmap.data[idx + 1];
- const normalBlue = this.bitmap.data[idx + 2];
+ const normalRed = this.bitmap.data[idx];
+ const normalGreen = this.bitmap.data[idx + 1];
+ const normalBlue = this.bitmap.data[idx + 2];
- // Subtract blurred pixel value from normal image
- this.bitmap.data[idx] = (normalRed > blurRed) ? normalRed - blurRed : 0;
- this.bitmap.data[idx + 1] = (normalGreen > blurGreen) ? normalGreen - blurGreen : 0;
- this.bitmap.data[idx + 2] = (normalBlue > blurBlue) ? normalBlue - blurBlue : 0;
- });
+ // Subtract blurred pixel value from normal image
+ this.bitmap.data[idx] =
+ normalRed > blurRed ? normalRed - blurRed : 0;
+ this.bitmap.data[idx + 1] =
+ normalGreen > blurGreen ? normalGreen - blurGreen : 0;
+ this.bitmap.data[idx + 2] =
+ normalBlue > blurBlue ? normalBlue - blurBlue : 0;
+ },
+ );
if (isWorkerEnvironment())
- self.sendStatusMessage("Sharpening image... (Merging with unsharp mask)");
- image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) {
- let maskRed = blurMask.bitmap.data[idx];
- let maskGreen = blurMask.bitmap.data[idx + 1];
- let maskBlue = blurMask.bitmap.data[idx + 2];
+ self.sendStatusMessage(
+ "Sharpening image... (Merging with unsharp mask)",
+ );
+ image.scan(
+ 0,
+ 0,
+ image.bitmap.width,
+ image.bitmap.height,
+ function (x, y, idx) {
+ let maskRed = blurMask.bitmap.data[idx];
+ let maskGreen = blurMask.bitmap.data[idx + 1];
+ let maskBlue = blurMask.bitmap.data[idx + 2];
- const normalRed = this.bitmap.data[idx];
- const normalGreen = this.bitmap.data[idx + 1];
- const normalBlue = this.bitmap.data[idx + 2];
+ const normalRed = this.bitmap.data[idx];
+ const normalGreen = this.bitmap.data[idx + 1];
+ const normalBlue = this.bitmap.data[idx + 2];
- // Calculate luminance
- const maskLuminance = (0.2126 * maskRed + 0.7152 * maskGreen + 0.0722 * maskBlue);
- const normalLuminance = (0.2126 * normalRed + 0.7152 * normalGreen + 0.0722 * normalBlue);
+ // Calculate luminance
+ const maskLuminance =
+ 0.2126 * maskRed +
+ 0.7152 * maskGreen +
+ 0.0722 * maskBlue;
+ const normalLuminance =
+ 0.2126 * normalRed +
+ 0.7152 * normalGreen +
+ 0.0722 * normalBlue;
- let luminanceDiff;
- if (maskLuminance > normalLuminance) {
- luminanceDiff = maskLuminance - normalLuminance;
- } else {
- luminanceDiff = normalLuminance - maskLuminance;
- }
+ let luminanceDiff;
+ if (maskLuminance > normalLuminance) {
+ luminanceDiff = maskLuminance - normalLuminance;
+ } else {
+ luminanceDiff = normalLuminance - maskLuminance;
+ }
- // Scale mask colours by amount
- maskRed = maskRed * amount;
- maskGreen = maskGreen * amount;
- maskBlue = maskBlue * amount;
+ // Scale mask colours by amount
+ maskRed = maskRed * amount;
+ maskGreen = maskGreen * amount;
+ maskBlue = maskBlue * amount;
- // Only change pixel value if the difference is higher than threshold
- if ((luminanceDiff / 255) * 100 >= threshold) {
- this.bitmap.data[idx] = (normalRed + maskRed) <= 255 ? normalRed + maskRed : 255;
- this.bitmap.data[idx + 1] = (normalGreen + maskGreen) <= 255 ? normalGreen + maskGreen : 255;
- this.bitmap.data[idx + 2] = (normalBlue + maskBlue) <= 255 ? normalBlue + maskBlue : 255;
- }
- });
+ // Only change pixel value if the difference is higher than threshold
+ if ((luminanceDiff / 255) * 100 >= threshold) {
+ this.bitmap.data[idx] =
+ normalRed + maskRed <= 255 ?
+ normalRed + maskRed :
+ 255;
+ this.bitmap.data[idx + 1] =
+ normalGreen + maskGreen <= 255 ?
+ normalGreen + maskGreen :
+ 255;
+ this.bitmap.data[idx + 2] =
+ normalBlue + maskBlue <= 255 ?
+ normalBlue + maskBlue :
+ 255;
+ }
+ },
+ );
let imageBuffer;
- if (image.getMIME() === "image/gif") {
- imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
+ if (image.mime === "image/gif") {
+ imageBuffer = await image.getBuffer(JimpMime.png);
} else {
- imageBuffer = await image.getBufferAsync(Jimp.AUTO);
+ imageBuffer = await image.getBuffer(image.mime);
}
return imageBuffer.buffer;
} catch (err) {
@@ -163,7 +196,6 @@ class SharpenImage extends Operation {
return ``;
}
-
}
export default SharpenImage;
diff --git a/src/core/operations/SplitColourChannels.mjs b/src/core/operations/SplitColourChannels.mjs
index d5a26a2d..3a33b78c 100644
--- a/src/core/operations/SplitColourChannels.mjs
+++ b/src/core/operations/SplitColourChannels.mjs
@@ -7,14 +7,13 @@
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs";
-import {isImage} from "../lib/FileType.mjs";
-import Jimp from "jimp/es/index.js";
+import { isImage } from "../lib/FileType.mjs";
+import { Jimp, JimpMime } from "jimp";
/**
* Split Colour Channels operation
*/
class SplitColourChannels extends Operation {
-
/**
* SplitColourChannels constructor
*/
@@ -23,7 +22,8 @@ class SplitColourChannels extends Operation {
this.name = "Split Colour Channels";
this.module = "Image";
- this.description = "Splits the given image into its red, green and blue colour channels.";
+ this.description =
+ "Splits the given image into its red, green and blue colour channels.";
this.infoURL = "https://wikipedia.org/wiki/Channel_(digital_image)";
this.inputType = "ArrayBuffer";
this.outputType = "List";
@@ -48,26 +48,44 @@ class SplitColourChannels extends Operation {
const split = parsedImage
.clone()
.color([
- {apply: "blue", params: [-255]},
- {apply: "green", params: [-255]}
+ { apply: "blue", params: [-255] },
+ { apply: "green", params: [-255] },
])
- .getBufferAsync(Jimp.MIME_PNG);
- resolve(new File([new Uint8Array((await split).values())], "red.png", {type: "image/png"}));
+ .getBuffer(JimpMime.png);
+ resolve(
+ new File(
+ [new Uint8Array((await split).values())],
+ "red.png",
+ { type: "image/png" },
+ ),
+ );
} catch (err) {
- reject(new OperationError(`Could not split red channel: ${err}`));
+ reject(
+ new OperationError(`Could not split red channel: ${err}`),
+ );
}
});
const green = new Promise(async (resolve, reject) => {
try {
- const split = parsedImage.clone()
+ const split = parsedImage
+ .clone()
.color([
- {apply: "red", params: [-255]},
- {apply: "blue", params: [-255]},
- ]).getBufferAsync(Jimp.MIME_PNG);
- resolve(new File([new Uint8Array((await split).values())], "green.png", {type: "image/png"}));
+ { apply: "red", params: [-255] },
+ { apply: "blue", params: [-255] },
+ ])
+ .getBuffer(JimpMime.png);
+ resolve(
+ new File(
+ [new Uint8Array((await split).values())],
+ "green.png",
+ { type: "image/png" },
+ ),
+ );
} catch (err) {
- reject(new OperationError(`Could not split green channel: ${err}`));
+ reject(
+ new OperationError(`Could not split green channel: ${err}`),
+ );
}
});
@@ -75,12 +93,21 @@ class SplitColourChannels extends Operation {
try {
const split = parsedImage
.color([
- {apply: "red", params: [-255]},
- {apply: "green", params: [-255]},
- ]).getBufferAsync(Jimp.MIME_PNG);
- resolve(new File([new Uint8Array((await split).values())], "blue.png", {type: "image/png"}));
+ { apply: "red", params: [-255] },
+ { apply: "green", params: [-255] },
+ ])
+ .getBuffer(JimpMime.png);
+ resolve(
+ new File(
+ [new Uint8Array((await split).values())],
+ "blue.png",
+ { type: "image/png" },
+ ),
+ );
} catch (err) {
- reject(new OperationError(`Could not split blue channel: ${err}`));
+ reject(
+ new OperationError(`Could not split blue channel: ${err}`),
+ );
}
});
@@ -96,7 +123,6 @@ class SplitColourChannels extends Operation {
async present(files) {
return await Utils.displayFilesAsHTML(files);
}
-
}
export default SplitColourChannels;
diff --git a/src/core/operations/ToBase85.mjs b/src/core/operations/ToBase85.mjs
index 839ef1e4..e9b0a485 100644
--- a/src/core/operations/ToBase85.mjs
+++ b/src/core/operations/ToBase85.mjs
@@ -33,7 +33,7 @@ class ToBase85 extends Operation {
value: ALPHABET_OPTIONS
},
{
- name: "Include delimeter",
+ name: "Include delimiter",
type: "boolean",
value: false
}
diff --git a/src/core/operations/ToBech32.mjs b/src/core/operations/ToBech32.mjs
new file mode 100644
index 00000000..a7c97355
--- /dev/null
+++ b/src/core/operations/ToBech32.mjs
@@ -0,0 +1,92 @@
+/**
+ * @author Medjedtxm
+ * @copyright Crown Copyright 2025
+ * @license Apache-2.0
+ */
+
+import Operation from "../Operation.mjs";
+import { encode } from "../lib/Bech32.mjs";
+import { fromHex } from "../lib/Hex.mjs";
+
+/**
+ * To Bech32 operation
+ */
+class ToBech32 extends Operation {
+
+ /**
+ * ToBech32 constructor
+ */
+ constructor() {
+ super();
+
+ this.name = "To Bech32";
+ this.module = "Default";
+ this.description = "Bech32 is an encoding scheme primarily used for Bitcoin SegWit addresses (BIP-0173). It uses a 32-character alphabet that excludes easily confused characters (1, b, i, o) and includes a checksum for error detection.
Bech32m (BIP-0350) is an updated version that fixes a weakness in the original Bech32 checksum and is used for Bitcoin Taproot addresses.
The Human-Readable Part (HRP) identifies the network or purpose (e.g., 'bc' for Bitcoin mainnet, 'tb' for testnet, 'age' for AGE encryption keys).
Maximum output length is 90 characters as per specification.";
+ this.infoURL = "https://wikipedia.org/wiki/Bech32";
+ this.inputType = "ArrayBuffer";
+ this.outputType = "string";
+ this.args = [
+ {
+ "name": "Human-Readable Part (HRP)",
+ "type": "string",
+ "value": "bc"
+ },
+ {
+ "name": "Encoding",
+ "type": "option",
+ "value": ["Bech32", "Bech32m"]
+ },
+ {
+ "name": "Input Format",
+ "type": "option",
+ "value": ["Raw bytes", "Hex"]
+ },
+ {
+ "name": "Mode",
+ "type": "option",
+ "value": ["Generic", "Bitcoin SegWit"]
+ },
+ {
+ "name": "Witness Version",
+ "type": "number",
+ "value": 0,
+ "hint": "SegWit witness version (0-16). Only used in Bitcoin SegWit mode."
+ }
+ ];
+ }
+
+ /**
+ * @param {ArrayBuffer} input
+ * @param {Object[]} args
+ * @returns {string}
+ */
+ run(input, args) {
+ const hrp = args[0];
+ const encoding = args[1];
+ const inputFormat = args[2];
+ const mode = args[3];
+ const witnessVersion = args[4];
+
+ let inputArray;
+ if (inputFormat === "Hex") {
+ // Convert hex string to bytes
+ const hexStr = new TextDecoder().decode(new Uint8Array(input)).replace(/\s/g, "");
+ inputArray = fromHex(hexStr);
+ } else {
+ inputArray = new Uint8Array(input);
+ }
+
+ if (mode === "Bitcoin SegWit") {
+ // Prepend witness version to the input data
+ const withVersion = new Uint8Array(inputArray.length + 1);
+ withVersion[0] = witnessVersion;
+ withVersion.set(inputArray, 1);
+ return encode(hrp, withVersion, encoding, true);
+ }
+
+ return encode(hrp, inputArray, encoding, false);
+ }
+
+}
+
+export default ToBech32;
diff --git a/src/core/operations/ToQuotedPrintable.mjs b/src/core/operations/ToQuotedPrintable.mjs
index 9db5c5a5..2ea204f9 100644
--- a/src/core/operations/ToQuotedPrintable.mjs
+++ b/src/core/operations/ToQuotedPrintable.mjs
@@ -23,7 +23,7 @@ class ToQuotedPrintable extends Operation {
this.name = "To Quoted Printable";
this.module = "Default";
- this.description = "Quoted-Printable, or QP encoding, is an encoding using printable ASCII characters (alphanumeric and the equals sign '=') to transmit 8-bit data over a 7-bit data path or, generally, over a medium which is not 8-bit clean. It is defined as a MIME content transfer encoding for use in e-mail.
QP works by using the equals sign '=' as an escape character. It also limits line length to 76, as some software has limits on line length.";
+ this.description = "Quoted-Printable, or QP encoding, is an encoding using printable ASCII characters (alphanumeric and the equals sign '=') to transmit 8-bit data over a 7-bit data path or, generally, over a medium which is not 8-bit clean. It is defined as a MIME content transfer encoding for use in email.
QP works by using the equals sign '=' as an escape character. It also limits line length to 76, as some software has limits on line length.";
this.infoURL = "https://wikipedia.org/wiki/Quoted-printable";
this.inputType = "ArrayBuffer";
this.outputType = "string";
diff --git a/src/core/operations/UnescapeUnicodeCharacters.mjs b/src/core/operations/UnescapeUnicodeCharacters.mjs
index 5bb0e5ac..02d16662 100644
--- a/src/core/operations/UnescapeUnicodeCharacters.mjs
+++ b/src/core/operations/UnescapeUnicodeCharacters.mjs
@@ -30,6 +30,23 @@ class UnescapeUnicodeCharacters extends Operation {
"value": ["\\u", "%u", "U+"]
}
];
+ this.checks = [
+ {
+ pattern: "\\\\u(?:[\\da-f]{4,6})",
+ flags: "i",
+ args: ["\\u"]
+ },
+ {
+ pattern: "%u(?:[\\da-f]{4,6})",
+ flags: "i",
+ args: ["%u"]
+ },
+ {
+ pattern: "U\\+(?:[\\da-f]{4,6})",
+ flags: "i",
+ args: ["U+"]
+ }
+ ];
}
/**
diff --git a/src/core/operations/ViewBitPlane.mjs b/src/core/operations/ViewBitPlane.mjs
index 8c93f16c..3740c10d 100644
--- a/src/core/operations/ViewBitPlane.mjs
+++ b/src/core/operations/ViewBitPlane.mjs
@@ -9,13 +9,12 @@ import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs";
import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs";
-import Jimp from "jimp/es/index.js";
+import { Jimp } from "jimp";
/**
* View Bit Plane operation
*/
class ViewBitPlane extends Operation {
-
/**
* ViewBitPlane constructor
*/
@@ -24,7 +23,8 @@ class ViewBitPlane extends Operation {
this.name = "View Bit Plane";
this.module = "Image";
- this.description = "Extracts and displays a bit plane of any given image. These show only a single bit from each pixel, and can be used to hide messages in Steganography.";
+ this.description =
+ "Extracts and displays a bit plane of any given image. These show only a single bit from each pixel, and can be used to hide messages in Steganography.";
this.infoURL = "https://wikipedia.org/wiki/Bit_plane";
this.inputType = "ArrayBuffer";
this.outputType = "ArrayBuffer";
@@ -33,13 +33,13 @@ class ViewBitPlane extends Operation {
{
name: "Colour",
type: "option",
- value: COLOUR_OPTIONS
+ value: COLOUR_OPTIONS,
},
{
name: "Bit",
type: "number",
- value: 0
- }
+ value: 0,
+ },
];
}
@@ -49,36 +49,38 @@ class ViewBitPlane extends Operation {
* @returns {ArrayBuffer}
*/
async run(input, args) {
- if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
+ if (!isImage(input))
+ throw new OperationError("Please enter a valid image file.");
const [colour, bit] = args,
parsedImage = await Jimp.read(input),
width = parsedImage.bitmap.width,
height = parsedImage.bitmap.height,
colourIndex = COLOUR_OPTIONS.indexOf(colour),
- bitIndex = 7-bit;
+ bitIndex = 7 - bit;
if (bit < 0 || bit > 7) {
- throw new OperationError("Error: Bit argument must be between 0 and 7");
+ throw new OperationError(
+ "Error: Bit argument must be between 0 and 7",
+ );
}
let pixel, bin, newPixelValue;
- parsedImage.scan(0, 0, width, height, function(x, y, idx) {
+ parsedImage.scan(0, 0, width, height, function (x, y, idx) {
pixel = this.bitmap.data[idx + colourIndex];
bin = Utils.bin(pixel);
newPixelValue = 255;
if (bin.charAt(bitIndex) === "1") newPixelValue = 0;
- for (let i=0; i < 3; i++) {
+ for (let i = 0; i < 3; i++) {
this.bitmap.data[idx + i] = newPixelValue;
}
this.bitmap.data[idx + 3] = 255;
-
});
- const imageBuffer = await parsedImage.getBufferAsync(Jimp.AUTO);
+ const imageBuffer = await parsedImage.getBuffer(parsedImage.mime);
return new Uint8Array(imageBuffer).buffer;
}
@@ -94,14 +96,8 @@ class ViewBitPlane extends Operation {
return ``;
}
-
}
-const COLOUR_OPTIONS = [
- "Red",
- "Green",
- "Blue",
- "Alpha"
-];
+const COLOUR_OPTIONS = ["Red", "Green", "Blue", "Alpha"];
export default ViewBitPlane;
diff --git a/src/node/apiUtils.mjs b/src/node/apiUtils.mjs
index 64688073..9d1c43cc 100644
--- a/src/node/apiUtils.mjs
+++ b/src/node/apiUtils.mjs
@@ -66,7 +66,7 @@ export function removeSubheadingsFromArray(array) {
* @param str
*/
export function sanitise(str) {
- return str.replace(/ /g, "").toLowerCase();
+ return str.replace(/[/\s.-]/g, "").toLowerCase();
}
diff --git a/src/web/App.mjs b/src/web/App.mjs
index 7071854a..143545d6 100644
--- a/src/web/App.mjs
+++ b/src/web/App.mjs
@@ -650,7 +650,7 @@ class App {
// const compareURL = `https://github.com/gchq/CyberChef/compare/v${prev.join(".")}...v${PKG_VERSION}`;
- let compileInfo = `Last build: ${timeSinceCompile.substr(0, 1).toUpperCase() + timeSinceCompile.substr(1)} ago`;
+ let compileInfo = `Last build: ${timeSinceCompile.substring(0, 1).toUpperCase() + timeSinceCompile.substring(1)} ago`;
if (window.compileMessage !== "") {
compileInfo += " - " + window.compileMessage;
diff --git a/src/web/HTMLIngredient.mjs b/src/web/HTMLIngredient.mjs
index 7eddb32c..91cbed89 100755
--- a/src/web/HTMLIngredient.mjs
+++ b/src/web/HTMLIngredient.mjs
@@ -49,15 +49,14 @@ class HTMLIngredient {
toHtml() {
let html = "",
i, m, eventFn;
+ const hintHtml = this.hint ? `data-toggle="tooltip" title="${this.hint}"` : "";
switch (this.type) {
case "string":
case "binaryString":
case "byteArray":
- html += `