Skip to content

Commit

Permalink
Merge pull request #620 from nearbeach/develop
Browse files Browse the repository at this point in the history
Hotfix - issue with crypto.randomUUID not working on http
  • Loading branch information
robotichead committed May 20, 2024
2 parents 5581e34 + 6b04365 commit c5bf82c
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion NearBeach/static/NearBeach/NearBeach.min.js

Large diffs are not rendered by default.

Binary file modified NearBeach/static/NearBeach/NearBeach.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion NearBeach/static/NearBeach/diagnostic-information.min.js

Large diffs are not rendered by default.

Binary file modified NearBeach/static/NearBeach/diagnostic-information.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion NearBeach/static/NearBeach/gantt-information.min.js

Large diffs are not rendered by default.

Binary file modified NearBeach/static/NearBeach/gantt-information.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion NearBeach/static/NearBeach/sprint-information.min.js

Large diffs are not rendered by default.

Binary file modified NearBeach/static/NearBeach/sprint-information.min.js.gz
Binary file not shown.
6 changes: 5 additions & 1 deletion src/js/components/diagnostic/DiagnosticUploadTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
//VueX
import { mapGetters } from "vuex";
//Mixins
import { getRandomID } from "../../mixins/randomMixin";
export default {
name: "DiagnosticUpload",
data() {
Expand All @@ -68,7 +71,8 @@ export default {
this.uploadState = "sending";
//Create a simple uuid
const uuid = crypto.randomUUID();
console.log("GET RANDOM ID: ", getRandomID());
const uuid = getRandomID();
//Create the file we are uploading
const document = new Blob([uuid], { type: "text/plain"});
Expand Down
18 changes: 18 additions & 0 deletions src/js/mixins/randomMixin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export function getRandomID() {
//If crypto.randomUUID works on browser - use that by default
if (crypto.randomUUID !== undefined) return crypto.randomUUID();

//Cryptop Random UUID did not work - default is to manually create uuid
let results = "";
const characters = "abcdefghijklmnopqrstuvwxyz0123456789";

//Loop through to create random 6 string
for (let i = 0; i < 6; i++) {
results += characters.charAt(
Math.floor(Math.random() * characters.length)
);
}

//Return our random string
return results;
}
4 changes: 3 additions & 1 deletion src/js/vuex/toastsVueX.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { getRandomID } from "../mixins/randomMixin"

export const moduleToasts = {
state: () => ({
toastList: [],
Expand All @@ -20,7 +22,7 @@ export const moduleToasts = {
message: "",
timestamp: timestamp.getTime(),
unique_type: "",
unique_uuid: crypto.randomUUID(),
unique_uuid: getRandomID(),
};

//Loop through each keys for the payload, and update the relevant field
Expand Down

0 comments on commit c5bf82c

Please sign in to comment.