mirror of
https://github.com/gchq/CyberChef
synced 2025-01-19 16:04:00 +00:00
Line ending sequences for the current tab are included in the deep link URL
This commit is contained in:
parent
f6ae89587c
commit
570206af77
4 changed files with 41 additions and 4 deletions
|
@ -502,6 +502,16 @@ class App {
|
|||
this.manager.output.chrEncChange(parseInt(this.uriParams.oenc, 10));
|
||||
}
|
||||
|
||||
// Input EOL sequence
|
||||
if (this.uriParams.ieol) {
|
||||
this.manager.input.eolChange(this.uriParams.ieol);
|
||||
}
|
||||
|
||||
// Output EOL sequence
|
||||
if (this.uriParams.oeol) {
|
||||
this.manager.output.eolChange(this.uriParams.oeol);
|
||||
}
|
||||
|
||||
// Read in input data from URI params
|
||||
if (this.uriParams.input) {
|
||||
try {
|
||||
|
|
|
@ -140,12 +140,16 @@ class ControlsWaiter {
|
|||
|
||||
const inputChrEnc = this.manager.input.getChrEnc();
|
||||
const outputChrEnc = this.manager.output.getChrEnc();
|
||||
const inputEOLSeq = this.manager.input.getEOLSeq();
|
||||
const outputEOLSeq = this.manager.output.getEOLSeq();
|
||||
|
||||
const params = [
|
||||
includeRecipe ? ["recipe", recipeStr] : undefined,
|
||||
includeInput && input.length ? ["input", Utils.escapeHtml(input)] : undefined,
|
||||
inputChrEnc !== 0 ? ["ienc", inputChrEnc] : undefined,
|
||||
outputChrEnc !== 0 ? ["oenc", outputChrEnc] : undefined
|
||||
outputChrEnc !== 0 ? ["oenc", outputChrEnc] : undefined,
|
||||
inputEOLSeq !== "\n" ? ["ieol", inputEOLSeq] : undefined,
|
||||
outputEOLSeq !== "\n" ? ["oeol", outputEOLSeq] : undefined
|
||||
];
|
||||
|
||||
const hash = params
|
||||
|
|
|
@ -142,6 +142,14 @@ class InputWaiter {
|
|||
this.setInput(oldInputVal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the input EOL sequence
|
||||
* @returns {string}
|
||||
*/
|
||||
getEOLSeq() {
|
||||
return this.inputEditorView.state.lineBreak;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for Chr Enc change events
|
||||
* Sets the input character encoding
|
||||
|
@ -179,7 +187,7 @@ class InputWaiter {
|
|||
*/
|
||||
getInput() {
|
||||
const doc = this.inputEditorView.state.doc;
|
||||
const eol = this.inputEditorView.state.lineBreak;
|
||||
const eol = this.getEOLSeq();
|
||||
return doc.sliceString(0, doc.length, eol);
|
||||
}
|
||||
|
||||
|
@ -644,7 +652,7 @@ class InputWaiter {
|
|||
buffer: buffer,
|
||||
stringSample: stringSample,
|
||||
encoding: this.getChrEnc(),
|
||||
eolSequence: this.inputEditorView.state.lineBreak
|
||||
eolSequence: this.getEOLSeq()
|
||||
}
|
||||
}, transferable);
|
||||
}
|
||||
|
|
|
@ -142,7 +142,22 @@ class OutputWaiter {
|
|||
});
|
||||
|
||||
// Reset the output so that lines are recalculated, preserving the old EOL values
|
||||
this.setOutput(oldOutputVal);
|
||||
this.setOutput(oldOutputVal, true);
|
||||
// Update the URL manually since we aren't firing a statechange event
|
||||
this.app.updateURL(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the output EOL sequence
|
||||
* Prefer reading value from `this.outputs` since the editor may not have updated yet.
|
||||
* @returns {string}
|
||||
*/
|
||||
getEOLSeq() {
|
||||
const currentTabNum = this.manager.tabs.getActiveTab("output");
|
||||
if (currentTabNum < 0) {
|
||||
return this.outputEditorConf.state.lineBreak;
|
||||
}
|
||||
return this.outputs[currentTabNum].eolSequence;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue