mirror of
https://github.com/OpenFusionProject/Client.git
synced 2025-10-16 20:40:17 +00:00
Compare commits
11 Commits
043bf219e7
...
1.5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b73329c6de | ||
![]() |
2e7dc51aa1 | ||
![]() |
3fc6cabe33 | ||
![]() |
71e4694ff6 | ||
![]() |
76f4a05287 | ||
![]() |
97144aad59 | ||
![]() |
4a465ca689 | ||
![]() |
43f0c8c684 | ||
![]() |
d4dc403e90 | ||
![]() |
ab5de9488d | ||
![]() |
dabb8bf484 |
19
.editorconfig
Normal file
19
.editorconfig
Normal file
@@ -0,0 +1,19 @@
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# 4 space indentation
|
||||
[*.js, *.css, *.html, *.json]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# Don't enforce anything in vendored code
|
||||
[*.min.*]
|
||||
end_of_line = unset
|
||||
insert_final_newline = unset
|
||||
indent_style = unset
|
||||
indent_style = unset
|
@@ -1,6 +1,6 @@
|
||||
# OpenFusionClient
|
||||
|
||||
[](https://github.com/OpenFusionProject/OpenFusionClient/releases/latest) [](https://discord.gg/DYavckB)[](https://github.com/OpenFusionProject/OpenFusionClient/blob/master/LICENSE.md)
|
||||
[](https://github.com/OpenFusionProject/OpenFusionClient/releases/latest) [](https://discord.gg/DYavckB)[](https://github.com/OpenFusionProject/OpenFusionClient/blob/master/LICENSE.md)
|
||||
|
||||
An Electron app that allows you to easily join FusionFall servers.
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 72 KiB |
@@ -1,10 +1,8 @@
|
||||
// You're kind of ruining the surprise by reading this, but whatever
|
||||
var today = new Date();
|
||||
|
||||
// Check Christmas season: Date constructor in Javascript uses an index
|
||||
// so 11 is Dec. of this year, and 12 is Jan. of the next
|
||||
var christmasBegin = new Date(today.getFullYear(), 11, 23);
|
||||
var christmasEnd = new Date(today.getFullYear(), 12, 8);
|
||||
var christmasBegin = new Date(today.getFullYear(), 11, 21);
|
||||
var christmasEnd = new Date(today.getFullYear(), 11, 31);
|
||||
var sf;
|
||||
|
||||
if (today >= christmasBegin && today <= christmasEnd) {
|
||||
|
@@ -61,7 +61,7 @@ function launchGame() {
|
||||
object.setAttribute("height", "661");
|
||||
|
||||
var embed = document.createElement("embed");
|
||||
embed.setAttribute("type", "application/vnd.unity");
|
||||
embed.setAttribute("type", "application/vnd.ffuwp");
|
||||
embed.setAttribute(
|
||||
"pluginspage",
|
||||
"http://www.unity3d.com/unity-web-player-2.x"
|
||||
@@ -80,14 +80,6 @@ function launchGame() {
|
||||
"progressframeimage",
|
||||
"assets/img/unity-loadingframe.png"
|
||||
);
|
||||
embed.setAttribute(
|
||||
"autoupdateurlsignature",
|
||||
"42180ee5edc4e3d4dd706bcc17cedd8d6ec7b7ac463071fd34ab97fe181f1a78df31db5feb4526677e4f69ef53acaff44471591e68b87f041c80fd54765f0d5725b08aa28f5acf7716ffb2a04e971269f35925c7e38d57dd78f6a206530caaa3da7e32f07f19810efc0ebf29a4eae976a925ad9cc5beb4dd51564c67dc489033"
|
||||
);
|
||||
embed.setAttribute(
|
||||
"autoupdateurl",
|
||||
"http://wp-cartoonnetwork.unity3d.com/ff/big/beta-20111013/autodownload_webplugin_beta"
|
||||
);
|
||||
|
||||
var div = document.getElementById("client");
|
||||
object.appendChild(embed);
|
||||
|
@@ -1,8 +1,13 @@
|
||||
var remote = require("remote");
|
||||
var remotefs = remote.require("fs-extra");
|
||||
var dns = remote.require("dns");
|
||||
var path = remote.require("path");
|
||||
|
||||
var userData = remote.require("app").getPath("userData");
|
||||
var configPath = path.join(userData, "config.json");
|
||||
var serversPath = path.join(userData, "servers.json");
|
||||
var versionsPath = path.join(userData, "versions.json");
|
||||
|
||||
var userDir = remote.require("app").getPath("userData");
|
||||
var versionArray;
|
||||
var serverArray;
|
||||
var config;
|
||||
@@ -28,7 +33,7 @@ function disableServerListButtons() {
|
||||
function getAppVersion() {
|
||||
appVersion = remote.require("app").getVersion();
|
||||
|
||||
// simplify version, ex. 1.4.0 -> 1.4,
|
||||
// Simplify version, ex. 1.4.0 -> 1.4,
|
||||
// but only if a revision number isn't present
|
||||
if (appVersion.endsWith(".0")) {
|
||||
return appVersion.substr(0, appVersion.length - 2);
|
||||
@@ -43,9 +48,7 @@ function setAppVersionText() {
|
||||
}
|
||||
|
||||
function addServer() {
|
||||
var jsonToModify = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\servers.json")
|
||||
);
|
||||
var jsonToModify = remotefs.readJsonSync(serversPath);
|
||||
|
||||
var server = {};
|
||||
server["uuid"] = uuidv4();
|
||||
@@ -62,17 +65,12 @@ function addServer() {
|
||||
|
||||
jsonToModify["servers"].push(server);
|
||||
|
||||
remotefs.writeFileSync(
|
||||
userDir + "\\servers.json",
|
||||
JSON.stringify(jsonToModify, null, 4)
|
||||
);
|
||||
remotefs.writeFileSync(serversPath, JSON.stringify(jsonToModify, null, 4));
|
||||
loadServerList();
|
||||
}
|
||||
|
||||
function editServer() {
|
||||
var jsonToModify = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\servers.json")
|
||||
);
|
||||
var jsonToModify = remotefs.readJsonSync(serversPath);
|
||||
$.each(jsonToModify["servers"], function (key, value) {
|
||||
if (value["uuid"] == getSelectedServer()) {
|
||||
value["description"] =
|
||||
@@ -89,17 +87,12 @@ function editServer() {
|
||||
}
|
||||
});
|
||||
|
||||
remotefs.writeFileSync(
|
||||
userDir + "\\servers.json",
|
||||
JSON.stringify(jsonToModify, null, 4)
|
||||
);
|
||||
remotefs.writeFileSync(serversPath, JSON.stringify(jsonToModify, null, 4));
|
||||
loadServerList();
|
||||
}
|
||||
|
||||
function deleteServer() {
|
||||
var jsonToModify = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\servers.json")
|
||||
);
|
||||
var jsonToModify = remotefs.readJsonSync(serversPath);
|
||||
var result = jsonToModify["servers"].filter(function (obj) {
|
||||
return obj.uuid === getSelectedServer();
|
||||
})[0];
|
||||
@@ -108,25 +101,20 @@ function deleteServer() {
|
||||
|
||||
jsonToModify["servers"].splice(resultindex, 1);
|
||||
|
||||
remotefs.writeFileSync(
|
||||
userDir + "\\servers.json",
|
||||
JSON.stringify(jsonToModify, null, 4)
|
||||
);
|
||||
remotefs.writeFileSync(serversPath, JSON.stringify(jsonToModify, null, 4));
|
||||
loadServerList();
|
||||
}
|
||||
|
||||
function restoreDefaultServers() {
|
||||
remotefs.copySync(
|
||||
__dirname + "\\defaults\\servers.json",
|
||||
userDir + "\\servers.json"
|
||||
path.join(__dirname, "/defaults/servers.json"),
|
||||
serversPath
|
||||
);
|
||||
loadServerList();
|
||||
}
|
||||
|
||||
function loadGameVersions() {
|
||||
var versionJson = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\versions.json")
|
||||
);
|
||||
var versionJson = remotefs.readJsonSync(versionsPath);
|
||||
versionArray = versionJson["versions"];
|
||||
$.each(versionArray, function (key, value) {
|
||||
$(new Option(value.name, "val")).appendTo("#addserver-versionselect");
|
||||
@@ -135,14 +123,12 @@ function loadGameVersions() {
|
||||
}
|
||||
|
||||
function loadConfig() {
|
||||
// load config object globally
|
||||
config = JSON.parse(remotefs.readFileSync(userDir + "\\config.json"));
|
||||
// Load config object globally
|
||||
config = remotefs.readJsonSync(configPath);
|
||||
}
|
||||
|
||||
function loadServerList() {
|
||||
var serverJson = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\servers.json")
|
||||
);
|
||||
var serverJson = remotefs.readJsonSync(serversPath);
|
||||
serverArray = serverJson["servers"];
|
||||
|
||||
$(".server-listing-entry").remove(); // Clear out old stuff, if any
|
||||
@@ -173,47 +159,50 @@ function loadServerList() {
|
||||
}
|
||||
|
||||
function performCacheSwap(newVersion) {
|
||||
var cacheRoot = userDir + "\\..\\..\\LocalLow\\Unity\\Web Player\\Cache";
|
||||
var currentCache = cacheRoot + "\\Fusionfall";
|
||||
var newCache = cacheRoot + "\\" + newVersion;
|
||||
var record = userDir + "\\.lastver";
|
||||
var cacheRoot = path.join(
|
||||
userData,
|
||||
"/../../LocalLow/Unity/Web Player/Cache"
|
||||
);
|
||||
var currentCache = path.join(cacheRoot, "FusionFall");
|
||||
var newCache = path.join(cacheRoot, newVersion);
|
||||
var record = path.join(userData, ".lastver");
|
||||
|
||||
// if cache renaming would result in a no-op (ex. launching the same version
|
||||
// two times), then skip it. this avoids permissions errors with multiple clients
|
||||
// If cache renaming would result in a no-op (ex. launching the same version
|
||||
// two times), then skip it. This avoids permissions errors with multiple clients
|
||||
// (file/folder is already open in another process)
|
||||
var skip = false;
|
||||
|
||||
if (remotefs.existsSync(currentCache)) {
|
||||
// cache already exists, find out what version it belongs to
|
||||
// Cache already exists, find out what version it belongs to
|
||||
if (remotefs.existsSync(record)) {
|
||||
lastVersion = remotefs.readFileSync(record);
|
||||
var lastVersion = remotefs.readFileSync(record, (encoding = "utf8"));
|
||||
if (lastVersion != newVersion) {
|
||||
// Remove the directory we're trying to store the
|
||||
// existing cache to if it already exists for whatever
|
||||
// reason, as it would cause an EPERM error otherwise.
|
||||
// This is a no-op if the directory doesn't exist
|
||||
remotefs.removeSync(path.join(cacheRoot, lastVersion));
|
||||
// Store old cache to named directory
|
||||
remotefs.renameSync(
|
||||
currentCache,
|
||||
cacheRoot + "\\" + lastVersion
|
||||
path.join(cacheRoot, lastVersion)
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
"Cached version unchanged, renaming will be skipped"
|
||||
);
|
||||
console.log("Cached version unchanged, skipping rename");
|
||||
skip = true;
|
||||
}
|
||||
console.log("Current cache is " + lastVersion);
|
||||
} else {
|
||||
console.log(
|
||||
"Couldn't find last version record; cache may get overwritten"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (remotefs.existsSync(newCache) || !skip) {
|
||||
// rename saved cache to FusionFall
|
||||
// Make note of what version we are launching for next launch
|
||||
remotefs.writeFileSync(record, newVersion);
|
||||
|
||||
if (remotefs.existsSync(newCache) && !skip) {
|
||||
// Rename saved cache to FusionFall
|
||||
remotefs.renameSync(newCache, currentCache);
|
||||
console.log("Current cache swapped to " + newVersion);
|
||||
}
|
||||
|
||||
// make note of what version we are launching for next launch
|
||||
remotefs.writeFileSync(record, newVersion);
|
||||
}
|
||||
|
||||
// For writing loginInfo.php, assetInfo.php, etc.
|
||||
@@ -225,7 +214,7 @@ function setGameInfo(serverUUID) {
|
||||
return obj.name === result.version;
|
||||
})[0];
|
||||
|
||||
// if cache swapping property exists AND is `true`, run cache swapping logic
|
||||
// If cache swapping property exists AND is `true`, run cache swapping logic
|
||||
if (config["cache-swapping"]) {
|
||||
try {
|
||||
performCacheSwap(gameVersion.name);
|
||||
@@ -238,31 +227,34 @@ function setGameInfo(serverUUID) {
|
||||
|
||||
window.assetUrl = gameVersion.url; // game-client.js needs to access this
|
||||
|
||||
remotefs.writeFileSync(__dirname + "\\assetInfo.php", assetUrl);
|
||||
remotefs.writeFileSync(path.join(__dirname, "assetInfo.php"), assetUrl);
|
||||
if (result.hasOwnProperty("endpoint")) {
|
||||
var httpEndpoint = result.endpoint.replace("https://", "http://");
|
||||
remotefs.writeFileSync(
|
||||
__dirname + "\\rankurl.txt",
|
||||
path.join(__dirname, "rankurl.txt"),
|
||||
httpEndpoint + "getranks"
|
||||
);
|
||||
// Write these out too
|
||||
remotefs.writeFileSync(
|
||||
__dirname + "\\sponsor.php",
|
||||
path.join(__dirname, "sponsor.php"),
|
||||
httpEndpoint + "upsell/sponsor.png"
|
||||
);
|
||||
remotefs.writeFileSync(
|
||||
__dirname + "\\images.php",
|
||||
path.join(__dirname, "images.php"),
|
||||
httpEndpoint + "upsell/"
|
||||
);
|
||||
} else {
|
||||
// Remove/default the endpoint related stuff, this server won't be using it
|
||||
if (remotefs.existsSync(__dirname + "\\rankurl.txt")) {
|
||||
remotefs.unlinkSync(__dirname + "\\rankurl.txt");
|
||||
if (remotefs.existsSync(path.join(__dirname, "rankurl.txt"))) {
|
||||
remotefs.unlinkSync(path.join(__dirname, "rankurl.txt"));
|
||||
remotefs.writeFileSync(
|
||||
__dirname + "\\sponsor.php",
|
||||
path.join(__dirname, "sponsor.php"),
|
||||
"assets/img/welcome.png"
|
||||
);
|
||||
remotefs.writeFileSync(__dirname + "\\images.php", "assets/img/");
|
||||
remotefs.writeFileSync(
|
||||
path.join(__dirname, "images.php"),
|
||||
"assets/img/"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,10 +272,10 @@ function setGameInfo(serverUUID) {
|
||||
|
||||
// DNS resolution. there is no synchronous version for some stupid reason
|
||||
if (!address.match(/^[0-9.]+$/))
|
||||
dns.resolve4(address, function (err, res) {
|
||||
dns.lookup(address, (family = 4), function (err, resolvedAddress) {
|
||||
if (!err) {
|
||||
console.log("Resolved " + address + " to " + res[0]);
|
||||
address = res[0];
|
||||
console.log("Resolved " + address + " to " + resolvedAddress);
|
||||
address = resolvedAddress;
|
||||
} else {
|
||||
console.log("Err: " + err.code);
|
||||
}
|
||||
@@ -298,7 +290,7 @@ function setGameInfo(serverUUID) {
|
||||
function prepConnection(address, port) {
|
||||
var full = address + ":" + port;
|
||||
console.log("Will connect to " + full);
|
||||
remotefs.writeFileSync(__dirname + "\\loginInfo.php", full);
|
||||
remotefs.writeFileSync(path.join(__dirname, "loginInfo.php"), full);
|
||||
launchGame();
|
||||
}
|
||||
|
||||
@@ -341,8 +333,8 @@ $("#server-table").on("dblclick", ".server-listing-entry", function (event) {
|
||||
});
|
||||
|
||||
$("#of-editservermodal").on("show.bs.modal", function (e) {
|
||||
var jsonToModify = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\servers.json")
|
||||
var jsonToModify = remotefs.readJsonSync(
|
||||
path.join(userData, "servers.json")
|
||||
);
|
||||
$.each(jsonToModify["servers"], function (key, value) {
|
||||
if (value["uuid"] == getSelectedServer()) {
|
||||
|
8
build/OpenFusionClient.exe.manifest
Normal file
8
build/OpenFusionClient.exe.manifest
Normal file
@@ -0,0 +1,8 @@
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">
|
||||
<activeCodePage>UTF-8</activeCodePage>
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.5b4</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>50</string>
|
||||
</dict>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.5b4</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>50</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.5.2f2</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>4c6ee796dacc</string>
|
||||
</dict>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.5b4</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>50</string>
|
||||
</dict>
|
||||
</plist>
|
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.5b4</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>50</string>
|
||||
<key>monoVersion</key>
|
||||
<string>fusion-2.x.x</string>
|
||||
<key>monoMinimumRevision</key>
|
||||
<string>2.0.0f6</string>
|
||||
</dict>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.5b4</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>50</string>
|
||||
<key>monoVersion</key>
|
||||
<string>fusion-2.x.x</string>
|
||||
<key>monoMinimumRevision</key>
|
||||
<string>2.0.0f6</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"autoupdate-check": true,
|
||||
"cache-swapping": true,
|
||||
"last-version-initialized": "1.4"
|
||||
"last-version-initialized": "1.5"
|
||||
}
|
||||
|
@@ -2,6 +2,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta
|
||||
http-equiv="Content-Type"
|
||||
contentType="text/html; charset=UTF-8"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>OpenFusion: Server Selector</title>
|
||||
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
|
||||
|
154
index.js
154
index.js
@@ -1,115 +1,56 @@
|
||||
var app = require("app"); // Module to control application life.
|
||||
var ipc = require("ipc");
|
||||
var fs = require("fs-extra");
|
||||
var os = require("os");
|
||||
var dialog = require("dialog");
|
||||
var BrowserWindow = require("browser-window");
|
||||
var fs = require("fs-extra");
|
||||
var ipc = require("ipc");
|
||||
var os = require("os");
|
||||
var path = require("path");
|
||||
|
||||
var BrowserWindow = require("browser-window");
|
||||
var mainWindow = null;
|
||||
|
||||
var unityHomeDir = path.join(__dirname, "../../WebPlayer");
|
||||
// If running in non-packaged / development mode, this dir will be slightly different
|
||||
if (process.env.npm_node_execpath) {
|
||||
unityHomeDir = path.join(app.getAppPath(), "/build/WebPlayer");
|
||||
}
|
||||
|
||||
process.env["UNITY_HOME_DIR"] = unityHomeDir;
|
||||
process.env["UNITY_DISABLE_PLUGIN_UPDATES"] = "yes";
|
||||
|
||||
app.commandLine.appendSwitch("enable-npapi");
|
||||
app.commandLine.appendSwitch(
|
||||
"load-plugin",
|
||||
path.join(unityHomeDir, "/loader/npUnity3D32.dll")
|
||||
);
|
||||
app.commandLine.appendSwitch("no-proxy-server");
|
||||
|
||||
function verifyMD5Hash(file, hash) {
|
||||
if (fs.existsSync(file)) {
|
||||
var buffer = fs.readFileSync(file);
|
||||
var computedHash = require("crypto")
|
||||
.createHash("md5")
|
||||
.update(buffer)
|
||||
.digest("hex");
|
||||
if (hash == computedHash) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function verifyUnity() {
|
||||
var loaderPath =
|
||||
app.getPath("appData") +
|
||||
"\\..\\LocalLow\\Unity\\WebPlayer\\loader\\npUnity3D32.dll";
|
||||
var playerPath =
|
||||
app.getPath("appData") +
|
||||
"\\..\\LocalLow\\Unity\\WebPlayer\\player\\fusion-2.x.x\\webplayer_win.dll";
|
||||
|
||||
return (
|
||||
verifyMD5Hash(loaderPath, "dbbac62d8379d2d870479b04b8157b99") &&
|
||||
verifyMD5Hash(playerPath, "e5028405b4483de9e5e5fe9cd5f1e98f")
|
||||
);
|
||||
}
|
||||
|
||||
function installUnity(callback) {
|
||||
var utilsDir = __dirname + "\\..\\..\\utils";
|
||||
|
||||
// if running in non-packaged / development mode, this dir will be slightly different
|
||||
if (process.env.npm_node_execpath) {
|
||||
utilsDir = app.getAppPath() + "\\build\\utils";
|
||||
}
|
||||
|
||||
// run the installer silently
|
||||
var child = require("child_process").spawn(
|
||||
utilsDir + "\\UnityWebPlayer.exe",
|
||||
["/quiet", "/S"]
|
||||
);
|
||||
child.on("exit", function () {
|
||||
// overwrite 3.5.2 loader/player with FF's custom version
|
||||
var dest = app.getPath("appData") + "\\..\\LocalLow\\Unity\\WebPlayer";
|
||||
fs.copySync(utilsDir + "\\WebPlayer", dest, { clobber: true });
|
||||
// avoids error reporter popping up when closing Electron
|
||||
fs.removeSync(dest + "\\UnityBugReporter.exe");
|
||||
console.log("Unity Web Player installed successfully.");
|
||||
callback();
|
||||
});
|
||||
}
|
||||
var userData = app.getPath("userData");
|
||||
var configPath = path.join(userData, "config.json");
|
||||
var serversPath = path.join(userData, "servers.json");
|
||||
var versionsPath = path.join(userData, "versions.json");
|
||||
|
||||
function initialSetup(firstTime) {
|
||||
// Display a small window to inform the user that the app is working
|
||||
setupWindow = new BrowserWindow({
|
||||
width: 275,
|
||||
height: 450,
|
||||
resizable: false,
|
||||
center: true,
|
||||
frame: false,
|
||||
});
|
||||
setupWindow.loadUrl("file://" + __dirname + "/initial-setup.html");
|
||||
installUnity(function () {
|
||||
if (!firstTime) {
|
||||
// migration from pre-1.4
|
||||
// Back everything up, just in case
|
||||
fs.copySync(
|
||||
app.getPath("userData") + "\\config.json",
|
||||
app.getPath("userData") + "\\config.json.bak"
|
||||
);
|
||||
fs.copySync(
|
||||
app.getPath("userData") + "\\servers.json",
|
||||
app.getPath("userData") + "\\servers.json.bak"
|
||||
);
|
||||
fs.copySync(
|
||||
app.getPath("userData") + "\\versions.json",
|
||||
app.getPath("userData") + "\\versions.json.bak"
|
||||
);
|
||||
} else {
|
||||
// first-time setup
|
||||
// Copy default servers
|
||||
fs.copySync(
|
||||
__dirname + "\\defaults\\servers.json",
|
||||
app.getPath("userData") + "\\servers.json"
|
||||
);
|
||||
}
|
||||
|
||||
// Copy default versions and config
|
||||
if (!firstTime) {
|
||||
// Migration from pre-1.4
|
||||
// Back everything up, just in case
|
||||
fs.copySync(configPath, configPath + ".bak");
|
||||
fs.copySync(serversPath, serversPath + ".bak");
|
||||
fs.copySync(versionsPath, versionsPath + ".bak");
|
||||
} else {
|
||||
// First-time setup
|
||||
// Copy default servers
|
||||
fs.copySync(
|
||||
__dirname + "\\defaults\\versions.json",
|
||||
app.getPath("userData") + "\\versions.json"
|
||||
);
|
||||
fs.copySync(
|
||||
__dirname + "\\defaults\\config.json",
|
||||
app.getPath("userData") + "\\config.json"
|
||||
path.join(__dirname, "/defaults/servers.json"),
|
||||
serversPath
|
||||
);
|
||||
}
|
||||
|
||||
console.log("JSON files copied.");
|
||||
setupWindow.destroy();
|
||||
showMainWindow();
|
||||
});
|
||||
// Copy default versions and config
|
||||
fs.copySync(path.join(__dirname, "/defaults/versions.json"), versionsPath);
|
||||
fs.copySync(path.join(__dirname, "/defaults/config.json"), configPath);
|
||||
|
||||
console.log("JSON files copied.");
|
||||
showMainWindow();
|
||||
}
|
||||
|
||||
ipc.on("exit", function (id) {
|
||||
@@ -131,18 +72,18 @@ app.on("ready", function () {
|
||||
dialog.showErrorBox("Error!", errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1280,
|
||||
height: 720,
|
||||
show: false,
|
||||
"web-preferences": { plugins: true },
|
||||
"web-preferences": {
|
||||
plugins: true,
|
||||
},
|
||||
});
|
||||
mainWindow.setMinimumSize(640, 480);
|
||||
|
||||
// Check for first run
|
||||
var configPath = app.getPath("userData") + "\\config.json";
|
||||
try {
|
||||
if (!fs.existsSync(configPath)) {
|
||||
console.log("Config file not found. Running initial setup.");
|
||||
@@ -153,11 +94,7 @@ app.on("ready", function () {
|
||||
console.log("Pre-1.4 config detected. Running migration.");
|
||||
initialSetup(false);
|
||||
} else {
|
||||
if (verifyUnity()) {
|
||||
showMainWindow();
|
||||
} else {
|
||||
installUnity(showMainWindow);
|
||||
}
|
||||
showMainWindow();
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
@@ -204,7 +141,6 @@ function showMainWindow() {
|
||||
|
||||
mainWindow.webContents.on("will-navigate", function (event, url) {
|
||||
event.preventDefault();
|
||||
// TODO: showMessageBox rather than showErrorBox?
|
||||
switch (url) {
|
||||
case "https://audience.fusionfall.com/ff/regWizard.do?_flowId=fusionfall-registration-flow":
|
||||
var errorMessage =
|
||||
|
@@ -1,40 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>OpenFusion: Initial Setup</title>
|
||||
</head>
|
||||
<body
|
||||
style="
|
||||
overflow: hidden;
|
||||
background-color: #000;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
"
|
||||
>
|
||||
<center>
|
||||
<div>
|
||||
<img src="assets/img/of-3.png" width="256" />
|
||||
<div>
|
||||
<img src="assets/img/spinner.gif" width="50px" />
|
||||
</div>
|
||||
<div style="margin-top: 15px">
|
||||
<p
|
||||
style="
|
||||
text-shadow: 1px 1px 8px #4349c4;
|
||||
color: #4a76b7;
|
||||
font-size: 18px;
|
||||
font-family: -apple-system, BlinkMacSystemFont,
|
||||
'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
||||
'Noto Sans', sans-serif, 'Apple Color Emoji',
|
||||
'Segoe UI Emoji', 'Segoe UI Symbol',
|
||||
'Noto Color Emoji';
|
||||
"
|
||||
>
|
||||
OpenFusion is setting up...<br />Please wait - this
|
||||
should take <br />less than a minute.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "OpenFusionClient",
|
||||
"version": "1.4.1",
|
||||
"version": "1.5.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "OpenFusionClient",
|
||||
"version": "1.4.1",
|
||||
"version": "1.5.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
10
package.json
10
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "OpenFusionClient",
|
||||
"version": "1.4.1",
|
||||
"version": "1.5.0",
|
||||
"description": "OpenFusionClient",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -63,8 +63,12 @@
|
||||
"extraFiles": [
|
||||
"LICENSE.md",
|
||||
{
|
||||
"from": "build/utils",
|
||||
"to": "utils"
|
||||
"from": "build/OpenFusionClient.exe.manifest",
|
||||
"to": "OpenFusionClient.exe.manifest"
|
||||
},
|
||||
{
|
||||
"from": "build/WebPlayer",
|
||||
"to": "WebPlayer"
|
||||
}
|
||||
],
|
||||
"afterPack": "./build/after-pack.js"
|
||||
|
Reference in New Issue
Block a user