mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-26 09:46:17 -04:00
Input and Output encodings are now saved per tab
This commit is contained in:
parent
5efd125d9b
commit
bdb8c02d5a
9 changed files with 87 additions and 33 deletions
|
@ -30,6 +30,7 @@ self.pendingFiles = [];
|
|||
* @property {string} file.type
|
||||
* @property {string} status
|
||||
* @property {number} progress
|
||||
* @property {number} encoding
|
||||
*/
|
||||
self.inputs = {};
|
||||
self.loaderWorkers = [];
|
||||
|
@ -512,6 +513,7 @@ self.updateInputProgress = function(inputData) {
|
|||
* @param {object} inputData
|
||||
* @param {number} inputData.inputNum - The input that's having its value updated
|
||||
* @param {ArrayBuffer} inputData.buffer - The new value of the input as a buffer
|
||||
* @param {number} [inputData.encoding] - The character encoding of the input data
|
||||
* @param {string} [inputData.stringSample] - A sample of the value as a string (truncated to 4096 chars)
|
||||
*/
|
||||
self.updateInputValue = function(inputData) {
|
||||
|
@ -522,6 +524,9 @@ self.updateInputValue = function(inputData) {
|
|||
throw new Error(`No input with ID ${inputNum} exists`);
|
||||
|
||||
self.inputs[inputNum].buffer = inputData.buffer;
|
||||
if ("encoding" in inputData) {
|
||||
self.inputs[inputNum].encoding = inputData.encoding;
|
||||
}
|
||||
if (!("stringSample" in inputData)) {
|
||||
inputData.stringSample = Utils.arrayBufferToStr(inputData.buffer.slice(0, 4096));
|
||||
}
|
||||
|
@ -756,7 +761,8 @@ self.addInput = function(
|
|||
stringSample: "",
|
||||
file: null,
|
||||
status: "pending",
|
||||
progress: 0
|
||||
progress: 0,
|
||||
encoding: 0
|
||||
};
|
||||
|
||||
switch (type) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue