Merge pull request #11 from gsemaj/onedotfour
This commit is contained in:
commit
a0f2ec90d0
|
@ -1,12 +1,11 @@
|
|||
locales/
|
||||
*.dll
|
||||
*.pak
|
||||
*.bin
|
||||
*.php
|
||||
rankurl.txt
|
||||
OpenFusionClient.exe
|
||||
icudtl.dat
|
||||
version
|
||||
resources/app/files/rankurl.txt
|
||||
node_modules/
|
||||
dist/
|
||||
dist/
|
||||
UnityBugReporter.exe
|
|
@ -4,6 +4,7 @@ var remotefs = remote.require('fs-extra');
|
|||
var userdir = remote.require('app').getPath('userData');
|
||||
var versionarray
|
||||
var serverarray
|
||||
var config
|
||||
|
||||
function enableServerListButtons() {
|
||||
$('#of-connect-button').removeClass('disabled');
|
||||
|
@ -80,9 +81,9 @@ function loadGameVersions() {
|
|||
}
|
||||
|
||||
function loadConfig() {
|
||||
// TODO: actually use these values
|
||||
var configjson = JSON.parse(remotefs.readFileSync(userdir+"\\config.json"));
|
||||
}
|
||||
// load config object globally
|
||||
config = JSON.parse(remotefs.readFileSync(userdir+"\\config.json"));
|
||||
}
|
||||
|
||||
function loadServerList() {
|
||||
var serverjson = JSON.parse(remotefs.readFileSync(userdir+"\\servers.json"));
|
||||
|
@ -120,34 +121,36 @@ function setGameInfo(serverUUID) {
|
|||
var result = serverarray.filter(function(obj) {return (obj.uuid === serverUUID);})[0];
|
||||
var gameversion = versionarray.filter(function(obj) {return (obj.name === result.version);})[0];
|
||||
|
||||
// Cache folder renaming
|
||||
var cachedir = userdir + '\\..\\..\\LocalLow\\Unity\\Web Player\\Cache';
|
||||
var curversion = cachedir + '\\Fusionfall';
|
||||
var newversion = cachedir + '\\' + gameversion.name;
|
||||
var record = userdir + '\\.lastver';
|
||||
if(config['cache-swapping']) { // if cache swapping property exists AND is `true`, run cache swapping logic
|
||||
// Cache folder renaming
|
||||
var cachedir = userdir + '\\..\\..\\LocalLow\\Unity\\Web Player\\Cache';
|
||||
var curversion = cachedir + '\\Fusionfall';
|
||||
var newversion = cachedir + '\\' + gameversion.name;
|
||||
var record = userdir + '\\.lastver';
|
||||
|
||||
if (remotefs.existsSync(curversion)) {
|
||||
// cache already exists
|
||||
// find out what version it belongs to
|
||||
if (remotefs.existsSync(record)) {
|
||||
var lastversion = remotefs.readFileSync(record);
|
||||
remotefs.renameSync(curversion, cachedir + '\\' + lastversion);
|
||||
console.log('Cached version ' + lastversion);
|
||||
} else {
|
||||
console.log(
|
||||
"Couldn't find last version record; cache may get overwritten"
|
||||
);
|
||||
if (remotefs.existsSync(curversion)) {
|
||||
// cache already exists
|
||||
// find out what version it belongs to
|
||||
if (remotefs.existsSync(record)) {
|
||||
var lastversion = remotefs.readFileSync(record);
|
||||
remotefs.renameSync(curversion, cachedir + '\\' + lastversion);
|
||||
console.log('Cached version ' + lastversion);
|
||||
} else {
|
||||
console.log(
|
||||
"Couldn't find last version record; cache may get overwritten"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (remotefs.existsSync(newversion)) {
|
||||
// rename saved cache to FusionFall
|
||||
remotefs.renameSync(newversion, curversion);
|
||||
console.log('Loaded cached ' + gameversion.name);
|
||||
}
|
||||
if (remotefs.existsSync(newversion)) {
|
||||
// rename saved cache to FusionFall
|
||||
remotefs.renameSync(newversion, curversion);
|
||||
console.log('Loaded cached ' + gameversion.name);
|
||||
}
|
||||
|
||||
// make note of what version we are launching for next launch
|
||||
remotefs.writeFileSync(record, gameversion.name);
|
||||
// make note of what version we are launching for next launch
|
||||
remotefs.writeFileSync(record, gameversion.name);
|
||||
}
|
||||
|
||||
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.
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.
Binary file not shown.
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"autoupdate-check": true,
|
||||
"cache-swapping": false,
|
||||
"initial-setup-completed": true
|
||||
"cache-swapping": true,
|
||||
"last-version-initialized": "1.4"
|
||||
}
|
|
@ -2,107 +2,107 @@
|
|||
"versions": [
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20100119/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100119/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20100307/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100307/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20100413/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100413/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20100524/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100524/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20100616/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100616/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20100728/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100728/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20101003/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20101003/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20101028/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20101028/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20110213/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110213/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20110330/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110330/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20110523/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110523/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20110818/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110818/"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"url": "http://ht.cdn.turner.com/ff/big/beta-20111013/"
|
||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20111013/"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
33
index.js
33
index.js
|
@ -9,7 +9,7 @@ var mainWindow = null;
|
|||
|
||||
app.commandLine.appendSwitch('--enable-npapi');
|
||||
|
||||
function initialSetup() {
|
||||
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 + '/initialsetup.html');
|
||||
|
@ -17,10 +17,20 @@ function initialSetup() {
|
|||
var child = require('child_process').spawn('cmd.exe', ['/c', 'utils\\installUnity.bat']);
|
||||
child.on('exit', function() {
|
||||
console.log("Unity installed.");
|
||||
// Copy over files with default values
|
||||
copySync(__dirname+"\\defaults\\config.json", app.getPath('userData')+"\\config.json");
|
||||
copySync(__dirname+"\\defaults\\servers.json", app.getPath('userData')+"\\servers.json");
|
||||
copySync(__dirname+"\\defaults\\versions.json", app.getPath('userData')+"\\versions.json");
|
||||
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
|
||||
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.");
|
||||
setupWindow.destroy();
|
||||
showMainWindow();
|
||||
|
@ -54,12 +64,19 @@ app.on('ready', function() {
|
|||
mainWindow.setMinimumSize(640, 480);
|
||||
|
||||
// Check for first run
|
||||
var configPath = app.getPath('userData') + "\\config.json";
|
||||
try {
|
||||
if (!fs.existsSync(app.getPath('userData')+"\\config.json")) {
|
||||
if (!fs.existsSync(configPath)) {
|
||||
console.log("Config file not found. Running initial setup.");
|
||||
initialSetup();
|
||||
initialSetup(true);
|
||||
} else {
|
||||
showMainWindow();
|
||||
var config = fs.readJsonSync(configPath);
|
||||
if(!config['last-version-initialized']) {
|
||||
console.log("Pre-1.4 config detected. Running migration.");
|
||||
initialSetup(false);
|
||||
} else {
|
||||
showMainWindow();
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
console.log("An error occurred while checking for the config.");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "openfusionclient",
|
||||
"version": "1.3.1",
|
||||
"version": "1.4.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "openfusionclient",
|
||||
"version": "1.3.1",
|
||||
"version": "1.4.0",
|
||||
"description": "OpenFusionClient",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in New Issue