Compare commits
14 Commits
5f2e05b4b9
...
2.1.7
Author | SHA1 | Date | |
---|---|---|---|
f046746037 | |||
b8f45ad0b8 | |||
86c9bc4a60 | |||
6ccc285c61 | |||
ecf329dd69 | |||
2bb4a86df3 | |||
144d1bb86a | |||
c3f0882951 | |||
4c33323e9e | |||
eb166c0165 | |||
6bca0b32a9 | |||
401be3c977 | |||
d2d2a618c5 | |||
fc6ec3bd69 |
@@ -16,24 +16,17 @@ const platforms = {
|
||||
};
|
||||
const crypto = require("crypto");
|
||||
|
||||
const defaultHWID = "recorderinthesandybridge";
|
||||
|
||||
/**
|
||||
* Returns machine hardware id.
|
||||
* @return {Promise<string>}
|
||||
* Returns `undefined` if cannot determine.
|
||||
* @return {string?}
|
||||
*/
|
||||
function getHwId() {
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
const getter = platforms[process.platform];
|
||||
if (getter) {
|
||||
const result = getter[1].exec(child_process.execSync(getter[0], options));
|
||||
if (result) resolve(crypto.createHash("md5").update(result[1]).digest("hex"));
|
||||
}
|
||||
resolve(crypto.createHash("md5").update(defaultHWID).digest("hex"));
|
||||
} catch {
|
||||
resolve(crypto.createHash("md5").update(defaultHWID).digest("hex"));
|
||||
}
|
||||
})
|
||||
const getter = platforms[process.platform];
|
||||
if (!getter) return;
|
||||
const result = getter[1].exec(child_process.execSync(getter[0], options));
|
||||
if (!result) return;
|
||||
return crypto.createHash("md5").update(result[1]).digest("hex") ||
|
||||
undefined;
|
||||
}
|
||||
exports.getHwId = getHwId;
|
||||
|
4
main.js
4
main.js
@@ -248,7 +248,7 @@ function registerIPCPipes() {
|
||||
ipcMain.handle("ezpplauncher:login", async (e, args) => {
|
||||
let hwid = "";
|
||||
try {
|
||||
hwid = await getHwId();
|
||||
hwid = getHwId();
|
||||
} catch (err) {
|
||||
logger.error(`Failed to get HWID.`, err);
|
||||
return {
|
||||
@@ -315,7 +315,7 @@ function registerIPCPipes() {
|
||||
});
|
||||
|
||||
ipcMain.handle("ezpplauncher:autologin", async (e) => {
|
||||
const hwid = await getHwId();
|
||||
const hwid = getHwId();
|
||||
const username = config.get("username");
|
||||
const guest = config.get("guest");
|
||||
if (guest) return { code: 200, message: "Login as guest", guest: true };
|
||||
|
Reference in New Issue
Block a user