diff --git a/src/main.js b/src/main.js index 6e16cfda..e0d3cab7 100644 --- a/src/main.js +++ b/src/main.js @@ -51,6 +51,12 @@ function createWindow() { checkForUpdates(); setInterval(() => checkForUpdates(), 600_000); }); + MainWindow.webContents.executeJavaScript("localStorage.getItem(\"UUID\")").then(value => { + if (!value) { + const uuid = require("uuid").v4(); + MainWindow.webContents.executeJavaScript(`localStorage.setItem("UUID","${uuid}")`); + } + }); MainWindow.webContents.executeJavaScript("localStorage.getItem(\"init\")").then(value => { if (!value) { MainWindow.webContents.executeJavaScript("localStorage.setItem(\"init\",true)").then(v => { diff --git a/src/package-lock.json b/src/package-lock.json index 8068128f..1cc03f63 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -20,6 +20,7 @@ "node-fetch": "^2.6.7", "require-reload": "^0.2.2", "speak-tts": "^2.0.8", + "uuid": "^9.0.1", "ws": "^8.14.2" }, "devDependencies": { @@ -5474,6 +5475,18 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", diff --git a/src/package.json b/src/package.json index 07c88f75..dfd0e039 100644 --- a/src/package.json +++ b/src/package.json @@ -78,6 +78,7 @@ "node-fetch": "^2.6.7", "require-reload": "^0.2.2", "speak-tts": "^2.0.8", + "uuid": "^9.0.1", "ws": "^8.14.2" } -} \ No newline at end of file +}