Merge branch 'master' into fix-ipv4-uint8array-concat

This commit is contained in:
Shivam Kumar 2026-05-23 11:25:17 +05:30 committed by GitHub
commit 6e1f05c9b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 36 additions and 11 deletions

View File

@ -89,6 +89,8 @@ module.exports = function (grunt) {
const compileYear = grunt.template.today("UTC:yyyy"), const compileYear = grunt.template.today("UTC:yyyy"),
compileTime = grunt.template.today("UTC:dd/mm/yyyy HH:MM:ss") + " UTC", compileTime = grunt.template.today("UTC:dd/mm/yyyy HH:MM:ss") + " UTC",
pkg = grunt.file.readJSON("package.json"), pkg = grunt.file.readJSON("package.json"),
version = process.env.GITHUB_SHA || `v${pkg.version}`,
downloadZipFilename = `CyberChef_${version}.zip`,
webpackConfig = require("./webpack.config.js"), webpackConfig = require("./webpack.config.js"),
BUILD_CONSTANTS = { BUILD_CONSTANTS = {
COMPILE_YEAR: JSON.stringify(compileYear), COMPILE_YEAR: JSON.stringify(compileYear),
@ -129,7 +131,9 @@ module.exports = function (grunt) {
chunks: ["main"], chunks: ["main"],
compileYear: compileYear, compileYear: compileYear,
compileTime: compileTime, compileTime: compileTime,
version: pkg.version, version: version,
latestReleaseVersion: pkg.version,
downloadZipFilename: downloadZipFilename,
minify: { minify: {
removeComments: true, removeComments: true,
collapseWhitespace: true, collapseWhitespace: true,
@ -245,7 +249,7 @@ module.exports = function (grunt) {
"!build/prod/index.html", "!build/prod/index.html",
"!build/prod/BundleAnalyzerReport.html", "!build/prod/BundleAnalyzerReport.html",
], ],
dest: `build/prod/CyberChef_v${pkg.version}.zip` dest: `build/prod/${downloadZipFilename}`
} }
}, },
connect: { connect: {
@ -333,12 +337,12 @@ module.exports = function (grunt) {
switch (process.platform) { switch (process.platform) {
case "darwin": case "darwin":
return chainCommands([ return chainCommands([
`shasum -a 256 build/prod/CyberChef_v${pkg.version}.zip | awk '{print $1;}' > build/prod/sha256digest.txt`, `shasum -a 256 build/prod/${downloadZipFilename} | awk '{print $1;}' > build/prod/sha256digest.txt`,
`sed -i '' -e "s/DOWNLOAD_HASH_PLACEHOLDER/$(cat build/prod/sha256digest.txt)/" build/prod/index.html` `sed -i '' -e "s/DOWNLOAD_HASH_PLACEHOLDER/$(cat build/prod/sha256digest.txt)/" build/prod/index.html`
]); ]);
default: default:
return chainCommands([ return chainCommands([
`sha256sum build/prod/CyberChef_v${pkg.version}.zip | awk '{print $1;}' > build/prod/sha256digest.txt`, `sha256sum build/prod/${downloadZipFilename} | awk '{print $1;}' > build/prod/sha256digest.txt`,
`sed -i -e "s/DOWNLOAD_HASH_PLACEHOLDER/$(cat build/prod/sha256digest.txt)/" build/prod/index.html` `sed -i -e "s/DOWNLOAD_HASH_PLACEHOLDER/$(cat build/prod/sha256digest.txt)/" build/prod/index.html`
]); ]);
} }

View File

@ -42,6 +42,14 @@ class App {
this.progress = 0; this.progress = 0;
this.ingId = 0; this.ingId = 0;
// stateChangeId increments on every statechange dispatch; bakeStateId records
// the stateChangeId captured when the most recent bake started. autoBake uses
// these to decide whether the output is genuinely stale, so a debounced
// autoBake firing shortly after a manual bake doesn't clobber the bake's
// hideStaleIndicator with a redundant showStaleIndicator.
this.stateChangeId = 0;
this.bakeStateId = -1;
this.appLoaded = false; this.appLoaded = false;
this.workerLoaded = false; this.workerLoaded = false;
this.waitersLoaded = false; this.waitersLoaded = false;
@ -136,6 +144,9 @@ class App {
bake(step=false) { bake(step=false) {
if (this.baking) return; if (this.baking) return;
// Record which state version this bake is covering.
this.bakeStateId = this.stateChangeId;
// Reset attemptHighlight flag // Reset attemptHighlight flag
this.options.attemptHighlight = true; this.options.attemptHighlight = true;
@ -166,7 +177,10 @@ class App {
nums: [this.manager.tabs.getActiveTab("input")], nums: [this.manager.tabs.getActiveTab("input")],
step: false step: false
}); });
} else { } else if (this.bakeStateId < this.stateChangeId) {
// Only show stale-indicator if the most recent bake didn't cover the
// current state. Without this guard, a debounced autoBake firing after
// a manual bake completed would re-show the indicator on fresh output.
this.manager.controls.showStaleIndicator(); this.manager.controls.showStaleIndicator();
} }
} }
@ -768,6 +782,10 @@ class App {
* @param {event} e * @param {event} e
*/ */
stateChange(e) { stateChange(e) {
// Bump the state-change counter synchronously so a manual bake invoked between
// here and the debounced autoBake firing can record it via bakeStateId.
this.stateChangeId++;
debounce(function() { debounce(function() {
this.progress = 0; this.progress = 0;
this.autoBake(); this.autoBake();

View File

@ -868,15 +868,15 @@
Be aware that the standalone version will never update itself, meaning it will not receive bug fixes or new features until you re-download newer versions manually. Be aware that the standalone version will never update itself, meaning it will not receive bug fixes or new features until you re-download newer versions manually.
</p> </p>
<h6>CyberChef v<%= htmlWebpackPlugin.options.version %></h6> <h6>CyberChef <%= htmlWebpackPlugin.options.version %></h6>
<ul> <ul>
<li>Build time: <%= htmlWebpackPlugin.options.compileTime %></li> <li>Build time: <%= htmlWebpackPlugin.options.compileTime %></li>
<li>The changelog for this version can be viewed <a href="https://github.com/gchq/CyberChef/blob/v<%= htmlWebpackPlugin.options.version %>/CHANGELOG.md">here</a></li> <li>The changelog for this version can be viewed <a href="https://github.com/gchq/CyberChef/blob/v<%= htmlWebpackPlugin.options.latestReleaseVersion %>/CHANGELOG.md">here</a></li>
<li>&copy; Crown Copyright 2016-<%= htmlWebpackPlugin.options.compileYear %></li> <li>&copy; Crown Copyright 2016-<%= htmlWebpackPlugin.options.compileYear %></li>
<li>Released under the Apache Licence, Version 2.0</li> <li>Released under the Apache Licence, Version 2.0</li>
<li>SHA256 hash: DOWNLOAD_HASH_PLACEHOLDER</li> <li>SHA256 hash: DOWNLOAD_HASH_PLACEHOLDER</li>
</ul> </ul>
<a href="CyberChef_v<%= htmlWebpackPlugin.options.version %>.zip" download class="btn btn-outline-primary">Download ZIP file</a> <a href="<%= htmlWebpackPlugin.options.downloadZipFilename %>" download class="btn btn-outline-primary">Download ZIP file</a>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Ok</button> <button type="button" class="btn btn-primary" data-dismiss="modal">Ok</button>

View File

@ -51,14 +51,17 @@ function setInput(browser, input, type=true) {
*/ */
function bake(browser) { function bake(browser) {
browser browser
// Let any pending debounced inputChange/stateChange (~20ms each) fire so the
// worker has the latest input buffer before we ask it to bake.
.pause(50)
// Ensure we're not currently busy // Ensure we're not currently busy
.waitForElementNotVisible("#output-loader", 5000) .waitForElementNotVisible("#output-loader", 10000)
.expect.element("#bake span").text.to.equal("BAKE!"); .expect.element("#bake span").text.to.equal("BAKE!");
browser browser
.click("#bake") .click("#bake")
.waitForElementNotVisible("#stale-indicator", 5000) .waitForElementNotVisible("#stale-indicator", 10000)
.waitForElementNotVisible("#output-loader", 5000); .waitForElementNotVisible("#output-loader", 10000);
} }
/** @function /** @function