mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-24 00:36:16 -04:00
Calls to window and document in src/core/ no longer break non-browser environments
This commit is contained in:
parent
dd5bd5d5e7
commit
6d396dbb9e
3 changed files with 7 additions and 3 deletions
|
@ -58,6 +58,10 @@ const URL_ = {
|
|||
* @returns {string}
|
||||
*/
|
||||
runParse: function(input, args) {
|
||||
if (!document) {
|
||||
throw "This operation only works in a browser.";
|
||||
}
|
||||
|
||||
var a = document.createElement("a");
|
||||
|
||||
// Overwrite base href which will be the current CyberChef URL to reduce confusion.
|
||||
|
|
|
@ -17,7 +17,7 @@ const UUID = {
|
|||
* @returns {string}
|
||||
*/
|
||||
runGenerateV4: function(input, args) {
|
||||
if (typeof(window.crypto) !== "undefined" && typeof(window.crypto.getRandomValues) !== "undefined") {
|
||||
if (window && typeof(window.crypto) !== "undefined" && typeof(window.crypto.getRandomValues) !== "undefined") {
|
||||
var buf = new Uint32Array(4),
|
||||
i = 0;
|
||||
window.crypto.getRandomValues(buf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue