Compare commits

...

14 Commits
1.4.2 ... main

Author SHA1 Message Date
CakeLancelot b5ab9aad2d Bump copyright date to 2024 and version to 1.5.2; update build.yml 2024-04-02 06:49:15 -05:00
CakeLancelot 01ee292d10 Introduce automatic artifact building and publishing 2024-04-02 05:06:06 -05:00
CakeLancelot 2183106c73 Fix manifest causing a crash / background process on certain systems
Fixes #21
2024-03-24 01:33:38 -05:00
Gent Semaj db7370ca41
Bump copyright date 2024-02-02 19:01:07 -08:00
CakeLancelot ec0fc87dcd Bump version number to 1.5.1 2023-11-09 13:31:44 -06:00
CakeLancelot cef8c1de93 Revert readJsonSync() change for modifying servers
readJsonSync() apparently produces an immutable JSON, which made it to where you couldn't add or remove servers
2023-10-18 12:47:41 -05:00
CakeLancelot b73329c6de Update version numbers to 1.5 2023-10-07 18:20:10 -05:00
CakeLancelot 2e7dc51aa1
Fix issue where cache swapping wouldn't work if record wasn't already present
Not sure why I re-ordered this before
2023-09-27 05:01:22 -05:00
CakeLancelot 3fc6cabe33 Disable telemetry in player dll
Co-authored-by: gsemaj <gsemaj@proton.me>
2023-09-19 08:59:13 -05:00
CakeLancelot 71e4694ff6 Misc comment cleanup, correct holiday date range, simplify JSON loading 2023-09-19 08:57:50 -05:00
CakeLancelot 76f4a05287 Move server-selector over to path.join(), fix issues with cache swapping
Before, swapping would continually fail if a cache tried to be stored at a directory that already existed. The skipping mechanism likely also didn't work as intended. Both have been fixed now.
Additionally:
* Added .editorconfig file 
* Ran prettier format
* Misc. refactoring
2023-09-19 08:57:29 -05:00
CakeLancelot 97144aad59 Remove initial setup window
Now that we only copy a few json files for the initial setup, the process is so fast the progress window isn't really needed anymore
2023-09-17 13:02:19 -05:00
CakeLancelot 4a465ca689
README: include preleases for release badge 2023-09-17 09:42:41 -05:00
CakeLancelot 43f0c8c684 Revise loader DLL to work under Wine, loading screen beta text, cleanup 2023-09-16 20:57:13 -05:00
16 changed files with 193 additions and 168 deletions

19
.editorconfig Normal file
View 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

47
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Publish Build
on:
push:
branches: [ "main" ]
tags: '*'
permissions:
contents: write
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Pack into zip and create installer
run: npm run dist
- name: Upload Artifacts
uses: actions/upload-artifact@master
with:
path: dist
publish-release:
if: contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@master
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "artifact/*-ia32-win.zip,artifact/*.exe"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 OpenFusion Contributors
Copyright (c) 2020-2024 OpenFusion Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
# OpenFusionClient
[![Current Release](https://img.shields.io/github/v/release/OpenFusionProject/OpenFusionClient)](https://github.com/OpenFusionProject/OpenFusionClient/releases/latest) [![Discord](https://img.shields.io/badge/chat-on%20discord-7289da.svg?logo=discord)](https://discord.gg/DYavckB)[![License](https://img.shields.io/github/license/OpenFusionProject/OpenFusionClient)](https://github.com/OpenFusionProject/OpenFusionClient/blob/master/LICENSE.md)
[![Current Release](https://img.shields.io/github/v/release/OpenFusionProject/OpenFusionClient?include_prereleases)](https://github.com/OpenFusionProject/OpenFusionClient/releases/latest) [![Discord](https://img.shields.io/badge/chat-on%20discord-7289da.svg?logo=discord)](https://discord.gg/DYavckB)[![License](https://img.shields.io/github/license/OpenFusionProject/OpenFusionClient)](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

View File

@ -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) {

View File

@ -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 = JSON.parse(remotefs.readFileSync(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 = JSON.parse(remotefs.readFileSync(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 = JSON.parse(remotefs.readFileSync(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,7 +272,7 @@ function setGameInfo(serverUUID) {
// DNS resolution. there is no synchronous version for some stupid reason
if (!address.match(/^[0-9.]+$/))
dns.lookup(address, family=4, function (err, resolvedAddress) {
dns.lookup(address, (family = 4), function (err, resolvedAddress) {
if (!err) {
console.log("Resolved " + address + " to " + resolvedAddress);
address = resolvedAddress;
@ -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()) {

View File

@ -1,8 +1,32 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity type="win32" name="OpenFusion.Client" version="1.5.2.0" processorArchitecture="x86" />
<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<asmv3:trustInfo>
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</asmv3:trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">
<activeCodePage>UTF-8</activeCodePage>
<dpiAware>true</dpiAware>
<asmv3:windowsSettings>
<activeCodePage xmlns="urn:schemas-microsoft-com:smi.2019.WindowsSettings">UTF-8</activeCodePage>
<dpiAware xmlns="urn:schemas-microsoft-com:smi.2005.WindowsSettings">True/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
</application>
</compatibility>
</asmv1:assembly>

View File

@ -1,5 +1,5 @@
{
"autoupdate-check": true,
"cache-swapping": true,
"last-version-initialized": "1.4"
"last-version-initialized": "1.5"
}

View File

@ -149,7 +149,7 @@
APP_VERSION_NUMBER
</p>
<p>
©2020-2023 OpenFusion Contributors<br />OpenFusion
©2020-2024 OpenFusion Contributors<br />OpenFusion
is licensed under MIT.<br />
</p>
<a

View File

@ -1,67 +1,55 @@
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 fs = require("fs-extra");
var ipc = require("ipc");
var os = require("os");
var path = require("path");
var BrowserWindow = require("browser-window");
var mainWindow = null;
app.commandLine.appendSwitch("enable-npapi");
app.commandLine.appendSwitch("no-proxy-server");
var userData = app.getPath("userData");
var unityHomeDir = __dirname + "\\..\\..\\WebPlayer";
// if running in non-packaged / development mode, this dir will be slightly different
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 = app.getAppPath() + "\\build\\WebPlayer";
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");
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,
});
if (!firstTime) {
// migration from pre-1.4
// Migration from pre-1.4
// Back everything up, just in case
setupWindow.loadUrl("file://" + __dirname + "/initial-setup.html");
fs.copySync(userData + "\\config.json", userData + "\\config.json.bak");
fs.copySync(
userData + "\\servers.json",
userData + "\\servers.json.bak"
);
fs.copySync(
userData + "\\versions.json",
userData + "\\versions.json.bak"
);
fs.copySync(configPath, configPath + ".bak");
fs.copySync(serversPath, serversPath + ".bak");
fs.copySync(versionsPath, versionsPath + ".bak");
} else {
// first-time setup
// First-time setup
// Copy default servers
fs.copySync(
__dirname + "\\defaults\\servers.json",
userData + "\\servers.json"
path.join(__dirname, "/defaults/servers.json"),
serversPath
);
}
// Copy default versions and config
fs.copySync(
__dirname + "\\defaults\\versions.json",
userData + "\\versions.json"
);
fs.copySync(
__dirname + "\\defaults\\config.json",
userData + "\\config.json"
);
fs.copySync(path.join(__dirname, "/defaults/versions.json"), versionsPath);
fs.copySync(path.join(__dirname, "/defaults/config.json"), configPath);
console.log("JSON files copied.");
setupWindow.destroy();
showMainWindow();
}
@ -91,13 +79,11 @@ app.on("ready", function () {
show: false,
"web-preferences": {
plugins: true,
"extra-plugin-dirs": [unityHomeDir + "\\loader"],
},
});
mainWindow.setMinimumSize(640, 480);
// Check for first run
var configPath = userData + "\\config.json";
try {
if (!fs.existsSync(configPath)) {
console.log("Config file not found. Running initial setup.");
@ -155,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 =

View File

@ -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
View File

@ -1,12 +1,12 @@
{
"name": "OpenFusionClient",
"version": "1.4.1",
"version": "1.5.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "OpenFusionClient",
"version": "1.4.1",
"version": "1.5.2",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View File

@ -1,13 +1,13 @@
{
"name": "OpenFusionClient",
"version": "1.4.2",
"version": "1.5.2",
"description": "OpenFusionClient",
"main": "index.js",
"scripts": {
"postinstall": "npx patch-package && npm explore electron-prebuilt -- npm run postinstall",
"start": "electron .",
"pack": "electron-builder --win --ia32 --dir",
"dist": "electron-builder --win --ia32",
"dist": "electron-builder --win --ia32 --publish=never",
"prettier": "npx prettier --write ."
},
"author": "OpenFusion Contributors",