From ab0493f53acd4c67f6622b48e6204e04dc302358 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Fri, 5 Apr 2024 15:56:31 +0100 Subject: [PATCH 01/10] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddff4460..ad12eda9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -740,6 +740,7 @@ All major and minor version changes will be documented in this file. Details of [#1765]: https://github.com/gchq/CyberChef/issues/1765 [#1767]: https://github.com/gchq/CyberChef/issues/1767 [#1769]: https://github.com/gchq/CyberChef/issues/1769 +[#1759]: https://github.com/gchq/CyberChef/issues/1759 [#1504]: https://github.com/gchq/CyberChef/issues/1504 [#512]: https://github.com/gchq/CyberChef/issues/512 [#1732]: https://github.com/gchq/CyberChef/issues/1732 From 0f0efefbf7e890c594daefe0436f38d7b0b73a8a Mon Sep 17 00:00:00 2001 From: zb3 Date: Fri, 5 Apr 2024 17:13:05 +0200 Subject: [PATCH 02/10] Make expectOutput actually check the output --- tests/browser/browserUtils.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/browser/browserUtils.js b/tests/browser/browserUtils.js index 4a559758..18a56b49 100644 --- a/tests/browser/browserUtils.js +++ b/tests/browser/browserUtils.js @@ -176,13 +176,14 @@ function loadRecipe(browser, opName, input, args) { */ function expectOutput(browser, expected) { browser.execute(expected => { - const output = window.app.manager.output.outputEditorView.state.doc.toString(); + return window.app.manager.output.outputEditorView.state.doc.toString(); + }, [expected], function({value}) { if (expected instanceof RegExp) { - return expected.test(output); + browser.expect(value).match(expected); } else { - return expected === output; + browser.expect(value).to.be.equal(expected); } - }, [expected]); + }); } /** @function From 4652608297f88e5bbf4c7cae7c1e91bcdb4eef92 Mon Sep 17 00:00:00 2001 From: zb3 Date: Fri, 5 Apr 2024 17:14:05 +0200 Subject: [PATCH 03/10] Fix character encoding io test Since the output encoding autodetection was introduced, this test was no longer correct. That wasn't detected because of the expectOutput bug. --- tests/browser/01_io.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/browser/01_io.js b/tests/browser/01_io.js index 6791c88e..c139afa9 100644 --- a/tests/browser/01_io.js +++ b/tests/browser/01_io.js @@ -383,13 +383,17 @@ module.exports = { utils.setInput(browser, CHINESE_CHARS, false); utils.setChrEnc(browser, "input", "UTF-8"); utils.bake(browser); - utils.expectOutput(browser, "\u00E4\u00B8\u008D\u00E8\u00A6\u0081\u00E6\u0081\u0090\u00E6\u0085\u008C\u00E3\u0080\u0082"); - /* Changing output to match input works as expected */ - utils.setChrEnc(browser, "output", "UTF-8"); - utils.bake(browser); + /* Output encoding should be autodetected */ + browser + .waitForElementVisible("#snackbar-container .snackbar-content", 5000) + .expect.element("#snackbar-container .snackbar-content").text.to.equal("Output character encoding has been detected and changed to UTF-8"); + utils.expectOutput(browser, CHINESE_CHARS); + /* Change the output encoding manually to test for URL presence */ + utils.setChrEnc(browser, "output", "UTF-8"); + /* Encodings appear in the URL */ browser.assert.urlContains("ienc=65001"); browser.assert.urlContains("oenc=65001"); From d3fb8bd6e9b3d3403acd6c9e6a57fee39ea66b80 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Fri, 5 Apr 2024 18:08:21 +0100 Subject: [PATCH 04/10] Fixed typos --- CHANGELOG.md | 2 +- src/core/Utils.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad12eda9..abceeda3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -725,7 +725,7 @@ All major and minor version changes will be documented in this file. Details of [#1667]: https://github.com/gchq/CyberChef/issues/1667 [#1555]: https://github.com/gchq/CyberChef/issues/1555 [#1694]: https://github.com/gchq/CyberChef/issues/1694 -[#1699]: https://github.com/gchq/CyberChef/issues/1694 +[#1699]: https://github.com/gchq/CyberChef/issues/1699 [#1757]: https://github.com/gchq/CyberChef/issues/1757 [#1752]: https://github.com/gchq/CyberChef/issues/1752 [#1753]: https://github.com/gchq/CyberChef/issues/1753 diff --git a/src/core/Utils.mjs b/src/core/Utils.mjs index 18b0e688..a9c381d7 100755 --- a/src/core/Utils.mjs +++ b/src/core/Utils.mjs @@ -893,7 +893,7 @@ class Utils { /** - * Converts a string to it's title case equivalent. + * Converts a string to its title case equivalent. * * @param {string} str * @returns string From 1b870e559e427464f4b25df5df7bc1dcaabfcc54 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Fri, 5 Apr 2024 18:09:07 +0100 Subject: [PATCH 05/10] Updated copyright declarations to a range up to the latest commit --- Gruntfile.js | 6 +++++- src/web/html/index.html | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 32ba9007..b040d98d 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -86,10 +86,12 @@ module.exports = function (grunt) { // Project configuration - const compileTime = grunt.template.today("UTC:dd/mm/yyyy HH:MM:ss") + " UTC", + const compileYear = grunt.template.today("UTC:yyyy"), + compileTime = grunt.template.today("UTC:dd/mm/yyyy HH:MM:ss") + " UTC", pkg = grunt.file.readJSON("package.json"), webpackConfig = require("./webpack.config.js"), BUILD_CONSTANTS = { + COMPILE_YEAR: JSON.stringify(compileYear), COMPILE_TIME: JSON.stringify(compileTime), COMPILE_MSG: JSON.stringify(grunt.option("compile-msg") || grunt.option("msg") || ""), PKG_VERSION: JSON.stringify(pkg.version), @@ -125,6 +127,7 @@ module.exports = function (grunt) { filename: "index.html", template: "./src/web/html/index.html", chunks: ["main"], + compileYear: compileYear, compileTime: compileTime, version: pkg.version, minify: { @@ -227,6 +230,7 @@ module.exports = function (grunt) { filename: "index.html", template: "./src/web/html/index.html", chunks: ["main"], + compileYear: compileYear, compileTime: compileTime, version: pkg.version, }) diff --git a/src/web/html/index.html b/src/web/html/index.html index 5c3c3263..02005796 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -1,10 +1,10 @@