Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
b7f24e897e | |||
f31126e2b1 | |||
d171545f18 | |||
b6b48da5fa | |||
6551f0b369 |
@ -16,17 +16,25 @@ const platforms = {
|
||||
};
|
||||
const crypto = require("crypto");
|
||||
|
||||
const defaultHWID = "recorderinthesandybridge";
|
||||
|
||||
/**
|
||||
* Returns machine hardware id.
|
||||
* Returns `undefined` if cannot determine.
|
||||
* @return {string?}
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
function getHwId() {
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
const getter = platforms[process.platform];
|
||||
if (!getter) return;
|
||||
if (getter) {
|
||||
const result = getter[1].exec(child_process.execSync(getter[0], options));
|
||||
if (!result) return;
|
||||
return crypto.createHash("md5").update(result[1]).digest("hex") ||
|
||||
undefined;
|
||||
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"));
|
||||
}
|
||||
})
|
||||
}
|
||||
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 = getHwId();
|
||||
hwid = await 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 = getHwId();
|
||||
const hwid = await getHwId();
|
||||
const username = config.get("username");
|
||||
const guest = config.get("guest");
|
||||
if (guest) return { code: 200, message: "Login as guest", guest: true };
|
||||
|
18
package-lock.json
generated
18
package-lock.json
generated
@ -1,18 +1,20 @@
|
||||
{
|
||||
"name": "ezpplauncher-next",
|
||||
"version": "2.1.2",
|
||||
"version": "2.1.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ezpplauncher-next",
|
||||
"version": "2.1.2",
|
||||
"version": "2.1.7",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/better-sqlite3": "^7.6.8",
|
||||
"axios": "^1.6.5",
|
||||
"better-sqlite3": "^9.2.2",
|
||||
"bsdiff-bin": "^0.1.0",
|
||||
"bsdiff-wasm": "^0.1.4",
|
||||
"crypto": "^1.0.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"custom-electron-titlebar": "^4.2.7",
|
||||
@ -2004,6 +2006,18 @@
|
||||
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
|
||||
}
|
||||
},
|
||||
"node_modules/bsdiff-bin": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bsdiff-bin/-/bsdiff-bin-0.1.0.tgz",
|
||||
"integrity": "sha512-hXGe3uXRgyl2BI1W8c4PdLlDHlPXlYaOaYtWjd5R5MJhF7tq5L4Ng3/qbNGJe7ZIG1htaasM+ziY1TkB1SgrwQ==",
|
||||
"license": "BSD"
|
||||
},
|
||||
"node_modules/bsdiff-wasm": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/bsdiff-wasm/-/bsdiff-wasm-0.1.4.tgz",
|
||||
"integrity": "sha512-IdD9jw9NLVrerD96nUThyoj+0HyfCbrIJPdCf6iTB7yIdc86jZugpatw20qeMyepY7UDdN5p64bhti1ruHBmSg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
|
@ -40,6 +40,8 @@
|
||||
"@types/better-sqlite3": "^7.6.8",
|
||||
"axios": "^1.6.5",
|
||||
"better-sqlite3": "^9.2.2",
|
||||
"bsdiff-bin": "^0.1.0",
|
||||
"bsdiff-wasm": "^0.1.4",
|
||||
"crypto": "^1.0.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"custom-electron-titlebar": "^4.2.7",
|
||||
|
7
test/patch.test.ts
Normal file
7
test/patch.test.ts
Normal file
@ -0,0 +1,7 @@
|
||||
const bs = require("bsdiff-bin")
|
||||
|
||||
(async () => {
|
||||
bs.patch('./osu!.exe', './osu!patched.exe', './osu!patch.diff', function(err){
|
||||
if(err) console.log("failed")
|
||||
});
|
||||
})();
|
BIN
working/bspatch.exe
Normal file
BIN
working/bspatch.exe
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user