Compare commits

..

No commits in common. "b6b48da5fad42483a6d4cc7575bf68c129548167" and "f046746037c79939ad0c42848804ccd11d58f6f9" have entirely different histories.

2 changed files with 9 additions and 13 deletions

View File

@ -16,21 +16,17 @@ const platforms = {
};
const crypto = require("crypto");
const defaultHWID = "recorderinthesandybridge";
/**
* Returns machine hardware id.
* Returns `undefined` if cannot determine.
* @return {Promise<string>}
* @return {string?}
*/
function getHwId() {
return new Promise((resolve) => {
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"));
})
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;

View File

@ -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 };