diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000..92c2fe8
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,33 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+locales/
+*.pak
+*.bin
+*.php
+rankurl.txt
+icudtl.dat
+version
+resources/app/files/rankurl.txt
+node_modules/
+dist/
+assets/
+UnityBugReporter.exe
\ No newline at end of file
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..08c32fb
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,11 @@
+{
+ "trailingComma": "es5",
+ "tabWidth": 2,
+ "useTabs": true,
+ "singleQuote": false,
+ "semi": true,
+ "bracketSameLine": false,
+ "bracketSpacing": true,
+ "jsxSingleQuote": false,
+ "quoteProps": "as-needed"
+}
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..0a0a734
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,9 @@
+{
+ // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+ // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+
+ // List of extensions which should be recommended for users of this workspace.
+ "recommendations": ["esbenp.prettier-vscode"],
+ // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
+ "unwantedRecommendations": []
+}
diff --git a/README.md b/README.md
index a34d6ac..44df782 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,3 @@
# OpenFusionClient
+
Electron app for joining OpenFusion servers
diff --git a/defaults/config.json b/defaults/config.json
index 53e485a..838812d 100644
--- a/defaults/config.json
+++ b/defaults/config.json
@@ -1,5 +1,5 @@
{
- "autoupdate-check": true,
- "cache-swapping": true,
- "last-version-initialized": "1.4"
-}
\ No newline at end of file
+ "autoupdate-check": true,
+ "cache-swapping": true,
+ "last-version-initialized": "1.4"
+}
diff --git a/defaults/servers.json b/defaults/servers.json
index 4e0401f..f912797 100644
--- a/defaults/servers.json
+++ b/defaults/servers.json
@@ -1,19 +1,19 @@
{
- "servers": [
- {
- "uuid": "d9773558-6ddf-4d00-8803-d830a22a842b",
- "description": "OpenFusion Public Server - Original",
- "ip": "play.dexlabs.systems:23000",
- "version": "beta-20100104",
- "endpoint": "https://api.dexlabs.systems/"
- },
- {
- "uuid": "b84f6859-f500-41f2-bdfa-8e3746639ee9",
- "description": "OpenFusion Public Server - Academy",
- "ip": "play.dexlabs.systems:24000",
- "version": "beta-20111013",
- "endpoint": "https://api.dexlabs.systems/academy/"
- }
- ],
- "favorites": []
+ "servers": [
+ {
+ "uuid": "d9773558-6ddf-4d00-8803-d830a22a842b",
+ "description": "OpenFusion Public Server - Original",
+ "ip": "play.dexlabs.systems:23000",
+ "version": "beta-20100104",
+ "endpoint": "https://api.dexlabs.systems/"
+ },
+ {
+ "uuid": "b84f6859-f500-41f2-bdfa-8e3746639ee9",
+ "description": "OpenFusion Public Server - Academy",
+ "ip": "play.dexlabs.systems:24000",
+ "version": "beta-20111013",
+ "endpoint": "https://api.dexlabs.systems/academy/"
+ }
+ ],
+ "favorites": []
}
diff --git a/defaults/versions.json b/defaults/versions.json
index cf33aa5..813ce80 100644
--- a/defaults/versions.json
+++ b/defaults/versions.json
@@ -1,108 +1,108 @@
{
- "versions": [
- {
- "name": "beta-20100104",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100104/"
- },
- {
- "name": "beta-20100119",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100119/"
- },
- {
- "name": "beta-20100207",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100207/"
- },
- {
- "name": "beta-20100307",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100307/"
- },
- {
- "name": "beta-20100322",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100322/"
- },
- {
- "name": "beta-20100413",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100413/"
- },
- {
- "name": "beta-20100502",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100502/"
- },
- {
- "name": "beta-20100524",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100524/"
- },
- {
- "name": "beta-20100604",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100604/"
- },
- {
- "name": "beta-20100616",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100616/"
- },
- {
- "name": "beta-20100711",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100711/"
- },
- {
- "name": "beta-20100728",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100728/"
- },
- {
- "name": "beta-20100909",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20100909/"
- },
- {
- "name": "beta-20101003",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20101003/"
- },
- {
- "name": "beta-20101011",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20101011/"
- },
- {
- "name": "beta-20101028",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20101028/"
- },
- {
- "name": "beta-20101123",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20101123/"
- },
- {
- "name": "beta-20110213",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20110213/"
- },
- {
- "name": "beta-20110314",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20110314/"
- },
- {
- "name": "beta-20110330",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20110330/"
- },
- {
- "name": "beta-20110424",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20110424/"
- },
- {
- "name": "beta-20110523",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20110523/"
- },
- {
- "name": "beta-20110725",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20110725/"
- },
- {
- "name": "beta-20110818",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20110818/"
- },
- {
- "name": "beta-20110912",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20110912/"
- },
- {
- "name": "beta-20111013",
- "url": "http://cdn.dexlabs.systems/ff/big/beta-20111013/"
- }
- ]
+ "versions": [
+ {
+ "name": "beta-20100104",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100104/"
+ },
+ {
+ "name": "beta-20100119",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100119/"
+ },
+ {
+ "name": "beta-20100207",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100207/"
+ },
+ {
+ "name": "beta-20100307",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100307/"
+ },
+ {
+ "name": "beta-20100322",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100322/"
+ },
+ {
+ "name": "beta-20100413",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100413/"
+ },
+ {
+ "name": "beta-20100502",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100502/"
+ },
+ {
+ "name": "beta-20100524",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100524/"
+ },
+ {
+ "name": "beta-20100604",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100604/"
+ },
+ {
+ "name": "beta-20100616",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100616/"
+ },
+ {
+ "name": "beta-20100711",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100711/"
+ },
+ {
+ "name": "beta-20100728",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100728/"
+ },
+ {
+ "name": "beta-20100909",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20100909/"
+ },
+ {
+ "name": "beta-20101003",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20101003/"
+ },
+ {
+ "name": "beta-20101011",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20101011/"
+ },
+ {
+ "name": "beta-20101028",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20101028/"
+ },
+ {
+ "name": "beta-20101123",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20101123/"
+ },
+ {
+ "name": "beta-20110213",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20110213/"
+ },
+ {
+ "name": "beta-20110314",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20110314/"
+ },
+ {
+ "name": "beta-20110330",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20110330/"
+ },
+ {
+ "name": "beta-20110424",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20110424/"
+ },
+ {
+ "name": "beta-20110523",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20110523/"
+ },
+ {
+ "name": "beta-20110725",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20110725/"
+ },
+ {
+ "name": "beta-20110818",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20110818/"
+ },
+ {
+ "name": "beta-20110912",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20110912/"
+ },
+ {
+ "name": "beta-20111013",
+ "url": "http://cdn.dexlabs.systems/ff/big/beta-20111013/"
+ }
+ ]
}
diff --git a/index.html b/index.html
index 7c39202..ca53834 100644
--- a/index.html
+++ b/index.html
@@ -1,139 +1,466 @@
+
+
+
+ OpenFusion: Server Selector
+
+
+
+
+
-
-
-
- OpenFusion: Server Selector
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Description |
- Game Version |
-
-
-
-
- No servers added yet... perhaps you should find one? |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Version 1.4
-
©2020-2022 OpenFusion Contributors
OpenFusion is licensed under MIT.
-
Reset to Default Servers
-
-
-
-
-
-
-
-
-
-
-
-
-
Do you really want to delete
"SERVER_NAME"?
You could always re-add it later.
-
-
-
-
-
-
-
-
-
-
-
Do you really want to restore the default servers?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ Description |
+ Game Version |
+
+
+
+
+
+ No servers added yet... perhaps you should find one?
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Version 1.4
+
+ ©2020-2022 OpenFusion Contributors
OpenFusion is licensed
+ under MIT.
+
+
Reset to Default Servers
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Do you really want to delete
"SERVER_NAME"?
You could always re-add it later.
+
+
+
+
+
+
+
+
+
+
+
+
+ Do you really want to restore the default servers?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/index.js b/index.js
index bd60ed7..65994fd 100644
--- a/index.js
+++ b/index.js
@@ -1,134 +1,166 @@
-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 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 mainWindow = null;
-app.commandLine.appendSwitch('--enable-npapi');
+app.commandLine.appendSwitch("--enable-npapi");
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');
- // Exec installUnity.bat and wait for it to finish.
- var child = require('child_process').spawn('cmd.exe', ['/c', 'utils\\installUnity.bat']);
- child.on('exit', function() {
- console.log("Unity installed.");
- 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");
- }
+ // 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");
+ // Exec installUnity.bat and wait for it to finish.
+ var child = require("child_process").spawn("cmd.exe", [
+ "/c",
+ "utils\\installUnity.bat",
+ ]);
+ child.on("exit", function () {
+ console.log("Unity installed.");
+ 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();
- })
+ // 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();
+ });
}
-ipc.on("exit", function(id) {
- mainWindow.destroy();
+ipc.on("exit", function (id) {
+ mainWindow.destroy();
});
// Quit when all windows are closed.
-app.on('window-all-closed', function() {
- if (process.platform != 'darwin')
- app.quit();
+app.on("window-all-closed", function () {
+ if (process.platform != "darwin") app.quit();
});
-app.on('ready', function() {
+app.on("ready", function () {
+ // Check just in case the user forgot to extract the zip.
+ zip_check = app.getPath("exe").includes(os.tmpdir());
+ if (zip_check) {
+ errormsg =
+ "It has been detected that OpenFusionClient is running from the TEMP folder.\n\n" +
+ "Please extract the entire Client folder to a location of your choice before starting OpenFusionClient.";
+ dialog.showErrorBox("Error!", errormsg);
+ return;
+ }
- // Check just in case the user forgot to extract the zip.
- zip_check = app.getPath('exe').includes(os.tmpdir());
- if (zip_check) {
- errormsg =
- ( "It has been detected that OpenFusionClient is running from the TEMP folder.\n\n"+
- "Please extract the entire Client folder to a location of your choice before starting OpenFusionClient.");
- dialog.showErrorBox("Error!", errormsg);
- return;
- }
+ // Create the browser window.
+ mainWindow = new BrowserWindow({
+ width: 1280,
+ height: 720,
+ show: false,
+ "web-preferences": { plugins: true },
+ });
+ mainWindow.setMinimumSize(640, 480);
- // Create the browser window.
- mainWindow = new BrowserWindow({width: 1280, height: 720, show: false, "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.");
+ 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 {
+ showMainWindow();
+ }
+ }
+ } catch (e) {
+ console.log("An error occurred while checking for the config.");
+ }
- // 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.");
- 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 {
- showMainWindow();
- }
- }
- } catch(e) {
- console.log("An error occurred while checking for the config.");
- }
+ // Makes it so external links are opened in the system browser, not Electron
+ mainWindow.webContents.on("new-window", function (e, url) {
+ e.preventDefault();
+ require("shell").openExternal(url);
+ });
- // Makes it so external links are opened in the system browser, not Electron
- mainWindow.webContents.on('new-window', function(e, url) {
- e.preventDefault();
- require('shell').openExternal(url);
- });
-
- mainWindow.on('closed', function() {
- mainWindow = null;
- });
+ mainWindow.on("closed", function () {
+ mainWindow = null;
+ });
});
function showMainWindow() {
- // Load the index.html of the app.
- mainWindow.loadUrl('file://' + __dirname + '/index.html');
+ // Load the index.html of the app.
+ mainWindow.loadUrl("file://" + __dirname + "/index.html");
- // Reduces white flash when opening the program
- mainWindow.webContents.on('did-finish-load', function() {
- mainWindow.show();
- // everything's loaded, tell the renderer process to do its thing
- mainWindow.webContents.executeJavaScript("loadConfig();");
- mainWindow.webContents.executeJavaScript("loadGameVersions();");
- mainWindow.webContents.executeJavaScript("loadServerList();");
- });
+ // Reduces white flash when opening the program
+ mainWindow.webContents.on("did-finish-load", function () {
+ mainWindow.show();
+ // everything's loaded, tell the renderer process to do its thing
+ mainWindow.webContents.executeJavaScript("loadConfig();");
+ mainWindow.webContents.executeJavaScript("loadGameVersions();");
+ mainWindow.webContents.executeJavaScript("loadServerList();");
+ });
- mainWindow.webContents.on('plugin-crashed', function() {
- console.log("Unity Web Player crashed.");
- });
+ mainWindow.webContents.on("plugin-crashed", function () {
+ console.log("Unity Web Player crashed.");
+ });
- mainWindow.webContents.on('will-navigate', function(evt, url) {
- evt.preventDefault();
- // TODO: showMessageBox rather than showErrorBox?
- switch (url) {
- case "https://audience.fusionfall.com/ff/regWizard.do?_flowId=fusionfall-registration-flow":
- errormsg =
- ( "The register page is currently unimplemented.\n\n"+
- "You can still create an account: type your desired username and password into the provided boxes and click \"Log In\". "+
- "Your account will then be automatically created on the server. \nBe sure to remember these details!");
- dialog.showErrorBox("Sorry!", errormsg);
- break;
- case "https://audience.fusionfall.com/ff/login.do":
- dialog.showErrorBox("Sorry!", "Account management is not available.");
- break;
- case "http://forums.fusionfall.com/":
- require('shell').openExternal("https://discord.gg/DYavckB");
- break;
- default:
- mainWindow.webContents.loadURL(url);
- }
- });
+ mainWindow.webContents.on("will-navigate", function (evt, url) {
+ evt.preventDefault();
+ // TODO: showMessageBox rather than showErrorBox?
+ switch (url) {
+ case "https://audience.fusionfall.com/ff/regWizard.do?_flowId=fusionfall-registration-flow":
+ errormsg =
+ "The register page is currently unimplemented.\n\n" +
+ 'You can still create an account: type your desired username and password into the provided boxes and click "Log In". ' +
+ "Your account will then be automatically created on the server. \nBe sure to remember these details!";
+ dialog.showErrorBox("Sorry!", errormsg);
+ break;
+ case "https://audience.fusionfall.com/ff/login.do":
+ dialog.showErrorBox("Sorry!", "Account management is not available.");
+ break;
+ case "http://forums.fusionfall.com/":
+ require("shell").openExternal("https://discord.gg/DYavckB");
+ break;
+ default:
+ mainWindow.webContents.loadURL(url);
+ }
+ });
}
diff --git a/initialsetup.html b/initialsetup.html
index 53f4cb1..33ace3d 100644
--- a/initialsetup.html
+++ b/initialsetup.html
@@ -1,18 +1,39 @@
-
- OpenFusion: Initial Setup
-
-
-
-
-
-
-
-
-
OpenFusion is setting up...
Please wait - this should take
less than a minute.
-
-
-
-
-
\ No newline at end of file
+
+ OpenFusion: Initial Setup
+
+
+
+
+
+
+
+
+
+
+ OpenFusion is setting up...
Please wait - this should take
+
less than a minute.
+
+
+
+
+
+