mirror of
https://github.com/OpenFusionProject/Client.git
synced 2024-11-22 13:40:06 +00:00
Added WebPlayer verification/reinstallation logic
This commit is contained in:
parent
d0f947c4a5
commit
101de9d68b
21
index.js
21
index.js
@ -10,7 +10,20 @@ var mainWindow = null;
|
|||||||
app.commandLine.appendSwitch("--enable-npapi");
|
app.commandLine.appendSwitch("--enable-npapi");
|
||||||
|
|
||||||
function verifyUnity() {
|
function verifyUnity() {
|
||||||
console.log("Unimplemented!");
|
var dllpath =
|
||||||
|
app.getPath("appData") +
|
||||||
|
"\\..\\LocalLow\\Unity\\WebPlayer\\player\\fusion-2.x.x\\webplayer_win.dll";
|
||||||
|
|
||||||
|
if (fs.existsSync(dllpath)) {
|
||||||
|
var buff = fs.readFileSync(dllpath);
|
||||||
|
var hash = require("crypto")
|
||||||
|
.createHash("md5")
|
||||||
|
.update(buff)
|
||||||
|
.digest("hex");
|
||||||
|
if (hash == "e5028405b4483de9e5e5fe9cd5f1e98f") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +43,7 @@ function installUnity(callback) {
|
|||||||
child.on("exit", function () {
|
child.on("exit", function () {
|
||||||
// overwrite 3.5.2 loader/player with FF's custom version
|
// overwrite 3.5.2 loader/player with FF's custom version
|
||||||
var dstfolder =
|
var dstfolder =
|
||||||
process.env.USERPROFILE + "\\AppData\\LocalLow\\Unity\\WebPlayer";
|
app.getPath("appData") + "..\\LocalLow\\Unity\\WebPlayer";
|
||||||
fs.copySync(utilsdir + "\\WebPlayer", dstfolder, {
|
fs.copySync(utilsdir + "\\WebPlayer", dstfolder, {
|
||||||
clobber: true,
|
clobber: true,
|
||||||
});
|
});
|
||||||
@ -133,7 +146,11 @@ app.on("ready", function () {
|
|||||||
console.log("Pre-1.4 config detected. Running migration.");
|
console.log("Pre-1.4 config detected. Running migration.");
|
||||||
initialSetup(false);
|
initialSetup(false);
|
||||||
} else {
|
} else {
|
||||||
|
if (verifyUnity()) {
|
||||||
showMainWindow();
|
showMainWindow();
|
||||||
|
} else {
|
||||||
|
installUnity(showMainWindow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user