Skip to content

Commit f9354c8

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 328c0ad + 01f0625 commit f9354c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5465
-3308
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
src/core/vendor/**
2+
src/web/static/clippy_assets/**

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ deploy:
3030
skip_cleanup: true
3131
api_key:
3232
secure: "HV1WSKv4l/0Y2bKKs1iBJocBcmLj08PCRUeEM/jTwA4jqJ8EiLHWiXtER/D5sEg2iibRVKd2OQjfrmS6bo4AiwdeVgAKmv0FtS2Jw+391N8Nd5AkEANHa5Om/IpHLTL2YRAjpJTsDpY72bMUTJIwjQA3TFJkgrpOw6KYfohOcgbxLpZ4XuNJRU3VL4Hsxdv5V9aOVmfFOmMOVPQlakXy7NgtW5POp1f2WJwgcZxylkR1CjwaqMyXmSoVl46pyH3tr5+dptsQoKSGdi6sIHGA60oDotFPcm+0ifa47wZw+vapuuDi4tdNxhrHGaDMG8xiE0WFDHwQUDlk2/+W7j9SEX0H3Em7us371JXRp56EDwEcDa34VpVkC6i8HGcHK55hnxVbMZXGf3qhOFD8wY7qMbjMRvIpucrMHBi86OfkDfv0vDj2LyvIl5APj/AX50BrE0tfH1MZbH26Jkx4NdlkcxQ14GumarmUqfmVvbX/fsoA6oUuAAE9ZgRRi3KHO4wci6KUcRfdm+XOeUkaBFsL86G3EEYIvrtBTuaypdz+Cx7nd1iPZyWMx5Y1gXnVzha4nBdV4+7l9JIsFggD8QVpw2uHXQiS1KXFjOeqA3DBD8tjMB7q26Fl2fD3jkOo4BTbQ2NrRIZUu/iL+fOmMPsyMt2qulB0yaSBCfkbEq8xrUA="
33+
file_glob: true
3334
file:
34-
- build/prod/cyberchef.htm
35+
- build/prod/*.zip
3536
- build/node/CyberChef.js
3637
on:
3738
repo: gchq/CyberChef

CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
All major and minor version changes will be documented in this file. Details of patch-level version changes can be found in [commit messages](https://github.com/gchq/CyberChef/commits/master).
33

44

5+
### [8.31.0] - 2019-04-12
6+
- The downloadable version of CyberChef is now a .zip file containing separate modules rather than a single .htm file. It is still completely standalone and will not make any external network requests. This change reduces the complexity of the build process significantly. [@n1474335]
7+
8+
### [8.30.0] - 2019-04-12
9+
- 'Decode Protobuf' operation added [@n1474335] | [#533]
10+
11+
### [8.29.0] - 2019-03-31
12+
- 'BLAKE2s' and 'BLAKE2b' hashing operations added [@h345983745] | [#525]
13+
14+
### [8.28.0] - 2019-03-31
15+
- 'Heatmap Chart', 'Hex Density Chart', 'Scatter Chart' and 'Series Chart' operation added [@artemisbot] [@tlwr] | [#496] [#143]
16+
517
### [8.27.0] - 2019-03-14
618
- 'Enigma', 'Typex', 'Bombe' and 'Multiple Bombe' operations added [@s2224834] | [#516]
719
- See [this wiki article](https://github.com/gchq/CyberChef/wiki/Enigma,-the-Bombe,-and-Typex) for a full explanation of these operations.
@@ -118,6 +130,10 @@ All major and minor version changes will be documented in this file. Details of
118130

119131

120132

133+
[8.31.0]: https://github.com/gchq/CyberChef/releases/tag/v8.31.0
134+
[8.30.0]: https://github.com/gchq/CyberChef/releases/tag/v8.30.0
135+
[8.29.0]: https://github.com/gchq/CyberChef/releases/tag/v8.29.0
136+
[8.28.0]: https://github.com/gchq/CyberChef/releases/tag/v8.28.0
121137
[8.27.0]: https://github.com/gchq/CyberChef/releases/tag/v8.27.0
122138
[8.26.0]: https://github.com/gchq/CyberChef/releases/tag/v8.26.0
123139
[8.25.0]: https://github.com/gchq/CyberChef/releases/tag/v8.25.0
@@ -159,6 +175,7 @@ All major and minor version changes will be documented in this file. Details of
159175
[@h345983745]: https://github.com/h345983745
160176
[@s2224834]: https://github.com/s2224834
161177
[@artemisbot]: https://github.com/artemisbot
178+
[@tlwr]: https://github.com/tlwr
162179
[@picapi]: https://github.com/picapi
163180
[@Dachande663]: https://github.com/Dachande663
164181
[@JustAnotherMark]: https://github.com/JustAnotherMark
@@ -175,6 +192,7 @@ All major and minor version changes will be documented in this file. Details of
175192

176193
[#95]: https://github.com/gchq/CyberChef/pull/299
177194
[#173]: https://github.com/gchq/CyberChef/pull/173
195+
[#143]: https://github.com/gchq/CyberChef/pull/143
178196
[#224]: https://github.com/gchq/CyberChef/pull/224
179197
[#239]: https://github.com/gchq/CyberChef/pull/239
180198
[#248]: https://github.com/gchq/CyberChef/pull/248
@@ -209,5 +227,8 @@ All major and minor version changes will be documented in this file. Details of
209227
[#468]: https://github.com/gchq/CyberChef/pull/468
210228
[#476]: https://github.com/gchq/CyberChef/pull/476
211229
[#489]: https://github.com/gchq/CyberChef/pull/489
230+
[#496]: https://github.com/gchq/CyberChef/pull/496
212231
[#506]: https://github.com/gchq/CyberChef/pull/506
213232
[#516]: https://github.com/gchq/CyberChef/pull/516
233+
[#525]: https://github.com/gchq/CyberChef/pull/525
234+
[#533]: https://github.com/gchq/CyberChef/pull/533

Gruntfile.js

+55-66
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const webpack = require("webpack");
44
const HtmlWebpackPlugin = require("html-webpack-plugin");
55
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
66
const NodeExternals = require("webpack-node-externals");
7-
const Inliner = require("web-resource-inliner");
87
const glob = require("glob");
98
const path = require("path");
109

@@ -43,18 +42,16 @@ module.exports = function (grunt) {
4342

4443
grunt.registerTask("prod",
4544
"Creates a production-ready build. Use the --msg flag to add a compile message.",
46-
["eslint", "clean:prod", "clean:config", "exec:generateConfig", "webpack:web", "inline", "chmod"]);
45+
[
46+
"eslint", "clean:prod", "clean:config", "exec:generateConfig", "webpack:web",
47+
"copy:standalone", "zip:standalone", "clean:standalone", "chmod"
48+
]);
4749

4850
grunt.registerTask("default",
4951
"Lints the code base",
5052
["eslint", "exec:repoSize"]);
5153

52-
grunt.registerTask("inline",
53-
"Compiles a production build of CyberChef into a single, portable web page.",
54-
["exec:generateConfig", "webpack:webInline", "runInliner", "clean:inlineScripts"]);
5554

56-
57-
grunt.registerTask("runInliner", runInliner);
5855
grunt.registerTask("doc", "docs");
5956
grunt.registerTask("tests", "test");
6057
grunt.registerTask("lint", "eslint");
@@ -72,6 +69,7 @@ module.exports = function (grunt) {
7269
grunt.loadNpmTasks("grunt-accessibility");
7370
grunt.loadNpmTasks("grunt-concurrent");
7471
grunt.loadNpmTasks("grunt-contrib-connect");
72+
grunt.loadNpmTasks("grunt-zip");
7573

7674

7775
// Project configuration
@@ -94,32 +92,6 @@ module.exports = function (grunt) {
9492
},
9593
moduleEntryPoints = listEntryModules();
9694

97-
/**
98-
* Compiles a production build of CyberChef into a single, portable web page.
99-
*/
100-
function runInliner() {
101-
const done = this.async();
102-
Inliner.html({
103-
relativeTo: "build/prod/",
104-
fileContent: grunt.file.read("build/prod/cyberchef.htm"),
105-
images: true,
106-
svgs: true,
107-
scripts: true,
108-
links: true,
109-
strict: true
110-
}, function(error, result) {
111-
if (error) {
112-
if (error instanceof Error) {
113-
done(error);
114-
} else {
115-
done(new Error(error));
116-
}
117-
} else {
118-
grunt.file.write("build/prod/cyberchef.htm", result);
119-
done(true);
120-
}
121-
});
122-
}
12395

12496
/**
12597
* Generates an entry list for all the modules.
@@ -130,7 +102,7 @@ module.exports = function (grunt) {
130102
glob.sync("./src/core/config/modules/*.mjs").forEach(file => {
131103
const basename = path.basename(file);
132104
if (basename !== "Default.mjs" && basename !== "OpModules.mjs")
133-
entryModules[basename.split(".mjs")[0]] = path.resolve(file);
105+
entryModules["modules/" + basename.split(".mjs")[0]] = path.resolve(file);
134106
});
135107

136108
return entryModules;
@@ -143,15 +115,15 @@ module.exports = function (grunt) {
143115
node: ["build/node/*"],
144116
config: ["src/core/config/OperationConfig.json", "src/core/config/modules/*", "src/code/operations/index.mjs"],
145117
docs: ["docs/*", "!docs/*.conf.json", "!docs/*.ico", "!docs/*.png"],
146-
inlineScripts: ["build/prod/scripts.js"],
118+
standalone: ["build/prod/CyberChef*.html"]
147119
},
148120
eslint: {
149121
options: {
150122
configFile: "./.eslintrc.json"
151123
},
152124
configs: ["*.{js,mjs}"],
153125
core: ["src/core/**/*.{js,mjs}", "!src/core/vendor/**/*", "!src/core/operations/legacy/**/*"],
154-
web: ["src/web/**/*.{js,mjs}"],
126+
web: ["src/web/**/*.{js,mjs}", "!src/web/static/**/*"],
155127
node: ["src/node/**/*.{js,mjs}"],
156128
tests: ["tests/**/*.{js,mjs}"],
157129
},
@@ -195,6 +167,9 @@ module.exports = function (grunt) {
195167
}, moduleEntryPoints),
196168
output: {
197169
path: __dirname + "/build/prod",
170+
filename: chunkData => {
171+
return chunkData.chunk.name === "main" ? "assets/[name].js": "[name].js";
172+
},
198173
globalObject: "this"
199174
},
200175
resolve: {
@@ -225,33 +200,6 @@ module.exports = function (grunt) {
225200
]
226201
};
227202
},
228-
webInline: {
229-
mode: "production",
230-
target: "web",
231-
entry: "./src/web/index.js",
232-
output: {
233-
filename: "scripts.js",
234-
path: __dirname + "/build/prod"
235-
},
236-
plugins: [
237-
new webpack.DefinePlugin(Object.assign({}, BUILD_CONSTANTS, {
238-
INLINE: "true"
239-
})),
240-
new HtmlWebpackPlugin({
241-
filename: "cyberchef.htm",
242-
template: "./src/web/html/index.html",
243-
compileTime: compileTime,
244-
version: pkg.version + "s",
245-
inline: true,
246-
minify: {
247-
removeComments: true,
248-
collapseWhitespace: true,
249-
minifyJS: true,
250-
minifyCSS: true
251-
}
252-
}),
253-
]
254-
},
255203
node: {
256204
mode: "production",
257205
target: "node",
@@ -284,7 +232,8 @@ module.exports = function (grunt) {
284232
warningsFilter: [
285233
/source-map/,
286234
/dependency is an expression/,
287-
/export 'default'/
235+
/export 'default'/,
236+
/Can't resolve 'sodium'/
288237
],
289238
}
290239
},
@@ -316,6 +265,18 @@ module.exports = function (grunt) {
316265
}
317266
}
318267
},
268+
zip: {
269+
standalone: {
270+
cwd: "build/prod/",
271+
src: [
272+
"build/prod/**/*",
273+
"!build/prod/index.html",
274+
"!build/prod/BundleAnalyzerReport.html",
275+
"!build/prod/sitemap.js"
276+
],
277+
dest: `build/prod/CyberChef_v${pkg.version}.zip`
278+
}
279+
},
319280
connect: {
320281
prod: {
321282
options: {
@@ -328,10 +289,16 @@ module.exports = function (grunt) {
328289
ghPages: {
329290
options: {
330291
process: function (content, srcpath) {
331-
// Add Google Analytics code to index.html
332292
if (srcpath.indexOf("index.html") >= 0) {
293+
// Add Google Analytics code to index.html
333294
content = content.replace("</body></html>",
334295
grunt.file.read("src/web/static/ga.html") + "</body></html>");
296+
297+
// Add Structured Data for SEO
298+
content = content.replace("</head>",
299+
"<script type='application/ld+json'>" +
300+
JSON.stringify(JSON.parse(grunt.file.read("src/web/static/structuredData.json"))) +
301+
"</script></head>");
335302
return grunt.template.process(content, srcpath);
336303
} else {
337304
return content;
@@ -350,6 +317,28 @@ module.exports = function (grunt) {
350317
dest: "build/prod/"
351318
},
352319
]
320+
},
321+
standalone: {
322+
options: {
323+
process: function (content, srcpath) {
324+
if (srcpath.indexOf("index.html") >= 0) {
325+
// Replace download link with version number
326+
content = content.replace(/<a [^>]+>Download CyberChef.+?<\/a>/,
327+
`<span>Version ${pkg.version}</span>`);
328+
329+
return grunt.template.process(content, srcpath);
330+
} else {
331+
return content;
332+
}
333+
},
334+
noProcess: ["**", "!**/*.html"]
335+
},
336+
files: [
337+
{
338+
src: "build/prod/index.html",
339+
dest: `build/prod/CyberChef_v${pkg.version}.html`
340+
}
341+
]
353342
}
354343
},
355344
chmod: {
@@ -405,7 +394,7 @@ module.exports = function (grunt) {
405394
command: "node --experimental-modules --no-warnings --no-deprecation tests/operations/index.mjs"
406395
},
407396
browserTests: {
408-
command: "./node_modules/.bin/nightwatch --env prod,inline"
397+
command: "./node_modules/.bin/nightwatch --env prod"
409398
}
410399
},
411400
});

babel.config.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,22 @@ module.exports = function(api) {
1111
"node": "6.5"
1212
},
1313
"modules": false,
14-
"useBuiltIns": "entry"
14+
"useBuiltIns": "entry",
15+
"corejs": 3
1516
}]
1617
],
1718
"plugins": [
1819
"babel-plugin-syntax-dynamic-import",
19-
["babel-plugin-transform-builtin-extend", {
20-
"globals": ["Error"]
21-
}]
20+
[
21+
"babel-plugin-transform-builtin-extend", {
22+
"globals": ["Error"]
23+
}
24+
],
25+
[
26+
"@babel/plugin-transform-runtime", {
27+
"regenerator": true
28+
}
29+
]
2230
]
2331
};
2432
};

nightwatch.json

-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323

2424
"prod": {
2525
"launch_url": "http://localhost:8000/index.html"
26-
},
27-
28-
"inline": {
29-
"launch_url": "http://localhost:8000/cyberchef.htm"
3026
}
3127

3228
}

0 commit comments

Comments
 (0)