Merge pull request #11 from gsemaj/onedotfour

This commit is contained in:
Gent Semaj 2021-09-19 10:56:41 -04:00 committed by GitHub
commit a0f2ec90d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 88 additions and 69 deletions

3
.gitignore vendored
View File

@ -1,12 +1,11 @@
locales/ locales/
*.dll
*.pak *.pak
*.bin *.bin
*.php *.php
rankurl.txt rankurl.txt
OpenFusionClient.exe
icudtl.dat icudtl.dat
version version
resources/app/files/rankurl.txt resources/app/files/rankurl.txt
node_modules/ node_modules/
dist/ dist/
UnityBugReporter.exe

View File

@ -4,6 +4,7 @@ var remotefs = remote.require('fs-extra');
var userdir = remote.require('app').getPath('userData'); var userdir = remote.require('app').getPath('userData');
var versionarray var versionarray
var serverarray var serverarray
var config
function enableServerListButtons() { function enableServerListButtons() {
$('#of-connect-button').removeClass('disabled'); $('#of-connect-button').removeClass('disabled');
@ -80,9 +81,9 @@ function loadGameVersions() {
} }
function loadConfig() { function loadConfig() {
// TODO: actually use these values // load config object globally
var configjson = JSON.parse(remotefs.readFileSync(userdir+"\\config.json")); config = JSON.parse(remotefs.readFileSync(userdir+"\\config.json"));
} }
function loadServerList() { function loadServerList() {
var serverjson = JSON.parse(remotefs.readFileSync(userdir+"\\servers.json")); var serverjson = JSON.parse(remotefs.readFileSync(userdir+"\\servers.json"));
@ -120,6 +121,7 @@ function setGameInfo(serverUUID) {
var result = serverarray.filter(function(obj) {return (obj.uuid === serverUUID);})[0]; var result = serverarray.filter(function(obj) {return (obj.uuid === serverUUID);})[0];
var gameversion = versionarray.filter(function(obj) {return (obj.name === result.version);})[0]; var gameversion = versionarray.filter(function(obj) {return (obj.name === result.version);})[0];
if(config['cache-swapping']) { // if cache swapping property exists AND is `true`, run cache swapping logic
// Cache folder renaming // Cache folder renaming
var cachedir = userdir + '\\..\\..\\LocalLow\\Unity\\Web Player\\Cache'; var cachedir = userdir + '\\..\\..\\LocalLow\\Unity\\Web Player\\Cache';
var curversion = cachedir + '\\Fusionfall'; var curversion = cachedir + '\\Fusionfall';
@ -148,6 +150,7 @@ function setGameInfo(serverUUID) {
// make note of what version we are launching for next launch // make note of what version we are launching for next launch
remotefs.writeFileSync(record, gameversion.name); remotefs.writeFileSync(record, gameversion.name);
}
window.asseturl = gameversion.url; // gameclient.js needs to access this window.asseturl = gameversion.url; // gameclient.js needs to access this

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
{ {
"autoupdate-check": true, "autoupdate-check": true,
"cache-swapping": false, "cache-swapping": true,
"initial-setup-completed": true "last-version-initialized": "1.4"
} }

View File

@ -2,107 +2,107 @@
"versions": [ "versions": [
{ {
"name": "beta-20100104", "name": "beta-20100104",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100104/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100104/"
}, },
{ {
"name": "beta-20100119", "name": "beta-20100119",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100119/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100119/"
}, },
{ {
"name": "beta-20100207", "name": "beta-20100207",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100207/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100207/"
}, },
{ {
"name": "beta-20100307", "name": "beta-20100307",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100307/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100307/"
}, },
{ {
"name": "beta-20100322", "name": "beta-20100322",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100322/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100322/"
}, },
{ {
"name": "beta-20100413", "name": "beta-20100413",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100413/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100413/"
}, },
{ {
"name": "beta-20100502", "name": "beta-20100502",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100502/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100502/"
}, },
{ {
"name": "beta-20100524", "name": "beta-20100524",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100524/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100524/"
}, },
{ {
"name": "beta-20100604", "name": "beta-20100604",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100604/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100604/"
}, },
{ {
"name": "beta-20100616", "name": "beta-20100616",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100616/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100616/"
}, },
{ {
"name": "beta-20100711", "name": "beta-20100711",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100711/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100711/"
}, },
{ {
"name": "beta-20100728", "name": "beta-20100728",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100728/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100728/"
}, },
{ {
"name": "beta-20100909", "name": "beta-20100909",
"url": "http://ht.cdn.turner.com/ff/big/beta-20100909/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20100909/"
}, },
{ {
"name": "beta-20101003", "name": "beta-20101003",
"url": "http://ht.cdn.turner.com/ff/big/beta-20101003/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20101003/"
}, },
{ {
"name": "beta-20101011", "name": "beta-20101011",
"url": "http://ht.cdn.turner.com/ff/big/beta-20101011/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20101011/"
}, },
{ {
"name": "beta-20101028", "name": "beta-20101028",
"url": "http://ht.cdn.turner.com/ff/big/beta-20101028/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20101028/"
}, },
{ {
"name": "beta-20101123", "name": "beta-20101123",
"url": "http://ht.cdn.turner.com/ff/big/beta-20101123/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20101123/"
}, },
{ {
"name": "beta-20110213", "name": "beta-20110213",
"url": "http://ht.cdn.turner.com/ff/big/beta-20110213/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20110213/"
}, },
{ {
"name": "beta-20110314", "name": "beta-20110314",
"url": "http://ht.cdn.turner.com/ff/big/beta-20110314/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20110314/"
}, },
{ {
"name": "beta-20110330", "name": "beta-20110330",
"url": "http://ht.cdn.turner.com/ff/big/beta-20110330/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20110330/"
}, },
{ {
"name": "beta-20110424", "name": "beta-20110424",
"url": "http://ht.cdn.turner.com/ff/big/beta-20110424/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20110424/"
}, },
{ {
"name": "beta-20110523", "name": "beta-20110523",
"url": "http://ht.cdn.turner.com/ff/big/beta-20110523/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20110523/"
}, },
{ {
"name": "beta-20110725", "name": "beta-20110725",
"url": "http://ht.cdn.turner.com/ff/big/beta-20110725/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20110725/"
}, },
{ {
"name": "beta-20110818", "name": "beta-20110818",
"url": "http://ht.cdn.turner.com/ff/big/beta-20110818/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20110818/"
}, },
{ {
"name": "beta-20110912", "name": "beta-20110912",
"url": "http://ht.cdn.turner.com/ff/big/beta-20110912/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20110912/"
}, },
{ {
"name": "beta-20111013", "name": "beta-20111013",
"url": "http://ht.cdn.turner.com/ff/big/beta-20111013/" "url": "http://cdn.dexlabs.systems/ff/big/beta-20111013/"
} }
] ]
} }

View File

@ -56,7 +56,7 @@
<h4 class="modal-title">About OpenFusionClient</h4><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">About OpenFusionClient</h4><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p class="text-monospace">Version 1.3</p> <p class="text-monospace">Version 1.4</p>
<p>©2020-2021 OpenFusion Contributors<br>OpenFusion is licensed under MIT.<br></p> <p>©2020-2021 OpenFusion Contributors<br>OpenFusion is licensed under MIT.<br></p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">

View File

@ -9,7 +9,7 @@ var mainWindow = null;
app.commandLine.appendSwitch('--enable-npapi'); app.commandLine.appendSwitch('--enable-npapi');
function initialSetup() { function initialSetup(firstTime) {
// Display a small window to inform the user that the app is working // 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 = new BrowserWindow({width: 275, height: 450, resizable: false, center:true, frame:false});
setupWindow.loadUrl('file://' + __dirname + '/initialsetup.html'); setupWindow.loadUrl('file://' + __dirname + '/initialsetup.html');
@ -17,10 +17,20 @@ function initialSetup() {
var child = require('child_process').spawn('cmd.exe', ['/c', 'utils\\installUnity.bat']); var child = require('child_process').spawn('cmd.exe', ['/c', 'utils\\installUnity.bat']);
child.on('exit', function() { child.on('exit', function() {
console.log("Unity installed."); console.log("Unity installed.");
// Copy over files with default values if(!firstTime) { // migration from pre-1.4
copySync(__dirname+"\\defaults\\config.json", app.getPath('userData')+"\\config.json"); // Back everything up, just in case
copySync(__dirname+"\\defaults\\servers.json", app.getPath('userData')+"\\servers.json"); fs.copySync(app.getPath('userData')+"\\config.json", app.getPath('userData')+"\\config.json.bak");
copySync(__dirname+"\\defaults\\versions.json", app.getPath('userData')+"\\versions.json"); 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
fs.copySync(__dirname+"\\defaults\\versions.json", app.getPath('userData')+"\\versions.json");
fs.copySync(__dirname+"\\defaults\\config.json", app.getPath('userData')+"\\config.json");
console.log("JSON files copied."); console.log("JSON files copied.");
setupWindow.destroy(); setupWindow.destroy();
showMainWindow(); showMainWindow();
@ -54,13 +64,20 @@ app.on('ready', function() {
mainWindow.setMinimumSize(640, 480); mainWindow.setMinimumSize(640, 480);
// Check for first run // Check for first run
var configPath = app.getPath('userData') + "\\config.json";
try { try {
if (!fs.existsSync(app.getPath('userData')+"\\config.json")) { if (!fs.existsSync(configPath)) {
console.log("Config file not found. Running initial setup."); console.log("Config file not found. Running initial setup.");
initialSetup(); initialSetup(true);
} else {
var config = fs.readJsonSync(configPath);
if(!config['last-version-initialized']) {
console.log("Pre-1.4 config detected. Running migration.");
initialSetup(false);
} else { } else {
showMainWindow(); showMainWindow();
} }
}
} catch(e) { } catch(e) {
console.log("An error occurred while checking for the config."); console.log("An error occurred while checking for the config.");
} }

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "openfusionclient", "name": "openfusionclient",
"version": "1.3.1", "version": "1.4.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "openfusionclient", "name": "openfusionclient",
"version": "1.3.1", "version": "1.4.0",
"description": "OpenFusionClient", "description": "OpenFusionClient",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {