Compare commits
60 Commits
1.4.1
...
7f9c5d90a1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f9c5d90a1 | ||
|
|
17f194810c | ||
|
|
87072b0789 | ||
|
|
e933bc52fe | ||
|
|
1078778e16 | ||
|
|
5dca39a17e | ||
|
|
0eca42cdf8 | ||
|
|
fa0bdd7b1a | ||
|
|
feafd8d17f | ||
|
|
6a7b029539 | ||
|
|
171177b606 | ||
|
|
1c2cf41e97 | ||
|
|
0201f11333 | ||
|
|
a859590ef9 | ||
|
|
356e811bac | ||
|
|
cdabb36639 | ||
|
|
547ca778b0 | ||
|
|
6bae0d1ff6 | ||
|
|
11f0c61a67 | ||
|
|
1d78bc2d9b | ||
|
|
c78a3e5ada | ||
|
|
c05e9c0dcd | ||
|
|
e1ef76744a | ||
|
|
04aea6059e | ||
|
|
600b33a230 | ||
|
|
48efd00a4a | ||
|
|
f28c9c0bb8 | ||
|
|
e3f16d8fc9 | ||
|
|
6f7f1655b9 | ||
|
|
597e80b112 | ||
|
|
79bdba74a5 | ||
|
|
16a99f86c7 | ||
|
|
05af8a3f9e | ||
|
|
27f0992b52 | ||
|
|
132b725922 | ||
|
|
b5ab9aad2d | ||
|
|
01ee292d10 | ||
|
|
2183106c73 | ||
|
|
db7370ca41 | ||
|
|
ec0fc87dcd | ||
|
|
cef8c1de93 | ||
|
|
b73329c6de | ||
|
|
2e7dc51aa1 | ||
|
|
3fc6cabe33 | ||
|
|
71e4694ff6 | ||
|
|
76f4a05287 | ||
|
|
97144aad59 | ||
|
|
4a465ca689 | ||
|
|
43f0c8c684 | ||
|
|
d4dc403e90 | ||
|
|
ab5de9488d | ||
|
|
dabb8bf484 | ||
|
|
043bf219e7 | ||
|
|
7131026b2f | ||
| 7dd018e336 | |||
|
|
e19098a13e | ||
|
|
48e2052748 | ||
|
|
7b3de1fe52 | ||
|
|
675a5fce50 | ||
|
|
2bf916ea58 |
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
|
||||||
3
.gitattributes
vendored
@@ -3,3 +3,6 @@
|
|||||||
*.js text eol=lf
|
*.js text eol=lf
|
||||||
*.json text eol=lf
|
*.json text eol=lf
|
||||||
*.md text eol=lf
|
*.md text eol=lf
|
||||||
|
|
||||||
|
defaults/* linguist-vendored
|
||||||
|
lib/* linguist-vendored
|
||||||
|
|||||||
47
.github/workflows/build.yml
vendored
Normal 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 }}
|
||||||
6
.gitignore
vendored
@@ -8,4 +8,8 @@ version
|
|||||||
resources/app/files/rankurl.txt
|
resources/app/files/rankurl.txt
|
||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
UnityBugReporter.exe
|
UnityBugReporter.exe
|
||||||
|
cache_handler/*/
|
||||||
|
extra/
|
||||||
|
*.sh
|
||||||
|
yarn.lock
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
51
README.md
@@ -1,3 +1,52 @@
|
|||||||
# OpenFusionClient
|
# OpenFusionClient
|
||||||
|
|
||||||
Electron app for joining OpenFusion servers
|
[](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.
|
||||||
|
|
||||||
|
It automatically installs FF's custom build of Unity Web Player, manages text files such as `assetInfo.php`/`loginInfo.php`, and embeds the game, all in a few clicks!
|
||||||
|
|
||||||
|
For an overview of how the game client worked originally, please see [this section in the OpenFusion README](https://github.com/OpenFusionProject/OpenFusion#architecture).
|
||||||
|
|
||||||
|
## Disclaimer
|
||||||
|
|
||||||
|
This repository does not contain any code from the actual FusionFall game client. **Think of it more as a launcher:** it abstracts away having to use a NPAPI plugin capable web browser, along with having to host a HTTP server for it to connect to.
|
||||||
|
|
||||||
|
In addition, if you are interested in contributing: do note that **this project likely cannot utilize more modern Javascript techniques**. In order to use NPAPI plugins, a very old version of Electron was needed (0.31.0). This limits the project to only a portion of ES5 in non-strict mode, and a reduced subset of Node/Electron APIs.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Provided that you have npm installed, clone the repository, then run install like so:
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/OpenFusionProject/OpenFusionClient.git
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
After that has completed you can then test OpenFusionClient:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run start
|
||||||
|
```
|
||||||
|
|
||||||
|
If you would like to package it as a standalone win32 application:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run pack
|
||||||
|
```
|
||||||
|
|
||||||
|
You can then compress the application directory into a zip file and installer for distribution:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run dist
|
||||||
|
```
|
||||||
|
|
||||||
|
Before opening a PR or running pack/dist, please do a code formatting pass:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run prettier
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT unless specified otherwise
|
||||||
|
|||||||
12
assets/bootstrap/css/bootstrap.min.css
vendored
30
assets/css/bootstrap.min.css
vendored
Normal file
@@ -47,6 +47,11 @@ img {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
clear: both;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
||||||
@@ -75,6 +80,11 @@ body {
|
|||||||
background-repeat: repeat;
|
background-repeat: repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-warning {
|
||||||
|
background-image: url("../../assets/img/btn-warning-bg.png");
|
||||||
|
background-repeat: repeat;
|
||||||
|
}
|
||||||
|
|
||||||
#of-aboutmodal > .modal-dialog > .modal-content {
|
#of-aboutmodal > .modal-dialog > .modal-content {
|
||||||
background-color: #093363;
|
background-color: #093363;
|
||||||
border-color: #6699ff;
|
border-color: #6699ff;
|
||||||
@@ -100,6 +110,36 @@ body {
|
|||||||
border-color: #6699ff;
|
border-color: #6699ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#of-editcacheconfigmodal > .modal-dialog > .modal-content {
|
||||||
|
background-color: #093363;
|
||||||
|
border-color: #6699ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#of-editconfigmodal > .modal-dialog > .modal-content {
|
||||||
|
background-color: #093363;
|
||||||
|
border-color: #6699ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#of-addversionmodal > .modal-dialog > .modal-content {
|
||||||
|
background-color: #093363;
|
||||||
|
border-color: #6699ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#of-editversionmodal > .modal-dialog > .modal-content {
|
||||||
|
background-color: #093363;
|
||||||
|
border-color: #6699ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#of-deleteversionmodal > .modal-dialog > .modal-content {
|
||||||
|
background-color: #093363;
|
||||||
|
border-color: #6699ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#of-restoreversionsmodal > .modal-dialog > .modal-content {
|
||||||
|
background-color: #093363;
|
||||||
|
border-color: #6699ff;
|
||||||
|
}
|
||||||
|
|
||||||
.form-control,
|
.form-control,
|
||||||
.form-control:focus {
|
.form-control:focus {
|
||||||
border-color: #0099ff;
|
border-color: #0099ff;
|
||||||
@@ -113,6 +153,14 @@ select {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invalidinput {
|
||||||
|
border-color: #ff0000;
|
||||||
|
}
|
||||||
|
|
||||||
button:disabled {
|
button:disabled {
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
pointer-events: all !important;
|
pointer-events: all !important;
|
||||||
@@ -129,3 +177,12 @@ button > i {
|
|||||||
#server-table .server-listing-entry {
|
#server-table .server-listing-entry {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#client {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: #000;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|||||||
BIN
assets/fonts/KFOlCnqEu92Fr1MmWUlvAw.ttf
Normal file
BIN
assets/fonts/KFOmCnqEu92Fr1Me5Q.ttf
Normal file
BIN
assets/img/btn-warning-bg.png
Normal file
|
After Width: | Height: | Size: 514 B |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 176 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
@@ -1,10 +1,8 @@
|
|||||||
// You're kind of ruining the surprise by reading this, but whatever
|
// You're kind of ruining the surprise by reading this, but whatever
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
|
|
||||||
// Check Christmas season: Date constructor in Javascript uses an index
|
var christmasBegin = new Date(today.getFullYear(), 11, 21);
|
||||||
// so 11 is Dec. of this year, and 12 is Jan. of the next
|
var christmasEnd = new Date(today.getFullYear(), 11, 31);
|
||||||
var christmasBegin = new Date(today.getFullYear(), 11, 23);
|
|
||||||
var christmasEnd = new Date(today.getFullYear(), 12, 8);
|
|
||||||
var sf;
|
var sf;
|
||||||
|
|
||||||
if (today >= christmasBegin && today <= christmasEnd) {
|
if (today >= christmasBegin && today <= christmasEnd) {
|
||||||
@@ -5,7 +5,7 @@ var gameRunning = false;
|
|||||||
|
|
||||||
// Uncomment and enter credentials to skip login screen
|
// Uncomment and enter credentials to skip login screen
|
||||||
function authDoCallback(param) {
|
function authDoCallback(param) {
|
||||||
/*var unity = document.getElementById('Unity_embed');
|
/*var unity = document.getElementById('unityEmbed');
|
||||||
unity.SendMessage("GlobalManager", "SetTEGid", "player");
|
unity.SendMessage("GlobalManager", "SetTEGid", "player");
|
||||||
unity.SendMessage("GlobalManager", "SetAuthid", "0");
|
unity.SendMessage("GlobalManager", "SetAuthid", "0");
|
||||||
unity.SendMessage("GlobalManager", "DoAuth", 0);*/
|
unity.SendMessage("GlobalManager", "DoAuth", 0);*/
|
||||||
@@ -33,7 +33,7 @@ function PayPage(param) {
|
|||||||
|
|
||||||
function onResize() {
|
function onResize() {
|
||||||
if (gameRunning == true) {
|
if (gameRunning == true) {
|
||||||
var unity = document.getElementById("Unity_embed");
|
var unity = document.getElementById("unityEmbed");
|
||||||
unity.style.width = window.innerWidth + "px";
|
unity.style.width = window.innerWidth + "px";
|
||||||
unity.style.height = window.innerHeight + "px";
|
unity.style.height = window.innerHeight + "px";
|
||||||
}
|
}
|
||||||
@@ -56,38 +56,29 @@ function launchGame() {
|
|||||||
"codebase",
|
"codebase",
|
||||||
"undefined/UnityWebPlayer.cab#version=2,0,0,0"
|
"undefined/UnityWebPlayer.cab#version=2,0,0,0"
|
||||||
);
|
);
|
||||||
object.setAttribute("id", "Unity_object");
|
object.setAttribute("id", "unityObject");
|
||||||
object.setAttribute("width", "1264");
|
object.setAttribute("width", "1264");
|
||||||
object.setAttribute("height", "661");
|
object.setAttribute("height", "661");
|
||||||
|
|
||||||
var embed = document.createElement("embed");
|
var embed = document.createElement("embed");
|
||||||
embed.setAttribute("type", "application/vnd.unity");
|
embed.setAttribute("type", "application/vnd.ffuwp");
|
||||||
embed.setAttribute(
|
embed.setAttribute(
|
||||||
"pluginspage",
|
"pluginspage",
|
||||||
"http://www.unity3d.com/unity-web-player-2.x"
|
"http://www.unity3d.com/unity-web-player-2.x"
|
||||||
);
|
);
|
||||||
embed.setAttribute("id", "Unity_embed");
|
embed.setAttribute("id", "unityEmbed");
|
||||||
embed.setAttribute("width", "1280");
|
embed.setAttribute("width", "1280");
|
||||||
embed.setAttribute("height", "680");
|
embed.setAttribute("height", "680");
|
||||||
embed.setAttribute("src", window.asseturl + "main.unity3d");
|
embed.setAttribute("src", window.assetUrl + "main.unity3d");
|
||||||
embed.setAttribute("disablecontdparaextmenu", "true");
|
|
||||||
embed.setAttribute("bordercolor", "000000");
|
embed.setAttribute("bordercolor", "000000");
|
||||||
embed.setAttribute("backgroundcolor", "000000");
|
embed.setAttribute("backgroundcolor", "000000");
|
||||||
embed.setAttribute("disableContextMenu", true);
|
embed.setAttribute("disableContextMenu", true);
|
||||||
embed.setAttribute("textcolor", "ccffff");
|
embed.setAttribute("textcolor", "ccffff");
|
||||||
embed.setAttribute("logoimage", "assets/img/unity_dexlabs.png");
|
embed.setAttribute("logoimage", "assets/img/unity-dexlabs.png");
|
||||||
embed.setAttribute("progressbarimage", "assets/img/unity_loadingbar.png");
|
embed.setAttribute("progressbarimage", "assets/img/unity-loadingbar.png");
|
||||||
embed.setAttribute(
|
embed.setAttribute(
|
||||||
"progressframeimage",
|
"progressframeimage",
|
||||||
"assets/img/unity_loadingframe.png"
|
"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");
|
var div = document.getElementById("client");
|
||||||
993
assets/js/server-selector.js
Normal file
@@ -0,0 +1,993 @@
|
|||||||
|
var remote = require("remote");
|
||||||
|
var remotefs = remote.require("fs-extra");
|
||||||
|
var dns = remote.require("dns");
|
||||||
|
var path = remote.require("path");
|
||||||
|
var dialog = remote.require("dialog");
|
||||||
|
var net = remote.require("net");
|
||||||
|
var spawn = require("child_process").spawn;
|
||||||
|
|
||||||
|
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 cacheRoot = path.join(
|
||||||
|
userData,
|
||||||
|
"/../../LocalLow/Unity/Web Player/Cache"
|
||||||
|
);
|
||||||
|
var offlineRootDefault = path.join(cacheRoot, "Offline");
|
||||||
|
var offlineRoot = offlineRootDefault;
|
||||||
|
|
||||||
|
var cdnString = "http://cdn.dexlabs.systems/ff/big";
|
||||||
|
|
||||||
|
var versionArray;
|
||||||
|
var serverArray;
|
||||||
|
var cacheSizes;
|
||||||
|
var defaultHashes;
|
||||||
|
var config;
|
||||||
|
|
||||||
|
function enableServerListButtons() {
|
||||||
|
$("#of-connect-button").removeClass("disabled");
|
||||||
|
$("#of-connect-button").prop("disabled", false);
|
||||||
|
$("#of-editserver-button").removeClass("disabled");
|
||||||
|
$("#of-editserver-button").prop("disabled", false);
|
||||||
|
$("#of-deleteserver-button").removeClass("disabled");
|
||||||
|
$("#of-deleteserver-button").prop("disabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableServerListButtons() {
|
||||||
|
$("#of-connect-button").addClass("disabled");
|
||||||
|
$("#of-connect-button").prop("disabled", true);
|
||||||
|
$("#of-editserver-button").addClass("disabled");
|
||||||
|
$("#of-editserver-button").prop("disabled", true);
|
||||||
|
$("#of-deleteserver-button").addClass("disabled");
|
||||||
|
$("#of-deleteserver-button").prop("disabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableVersionAddButton() {
|
||||||
|
$("#of-addversion-button").removeClass("disabled");
|
||||||
|
$("#of-addversion-button").prop("disabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableVersionListButtons() {
|
||||||
|
$("#of-editversion-button").removeClass("disabled");
|
||||||
|
$("#of-editversion-button").prop("disabled", false);
|
||||||
|
$("#of-deleteversion-button").removeClass("disabled");
|
||||||
|
$("#of-deleteversion-button").prop("disabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableVersionAddButton() {
|
||||||
|
$("#of-addversion-button").addClass("disabled");
|
||||||
|
$("#of-addversion-button").prop("disabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableVersionListButtons() {
|
||||||
|
$("#of-editversion-button").addClass("disabled");
|
||||||
|
$("#of-editversion-button").prop("disabled", true);
|
||||||
|
$("#of-deleteversion-button").addClass("disabled");
|
||||||
|
$("#of-deleteversion-button").prop("disabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAppVersion() {
|
||||||
|
appVersion = remote.require("app").getVersion();
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
} else {
|
||||||
|
return appVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAppVersionText() {
|
||||||
|
$("#of-aboutversionnumber").text("Version " + getAppVersion());
|
||||||
|
$("#of-versionnumber").text("v" + getAppVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateServerSave(modalName) {
|
||||||
|
// works everytime a key is entered into the server save form
|
||||||
|
var descInput = document.getElementById(modalName + "server-descinput");
|
||||||
|
var ipInput = document.getElementById(modalName + "server-ipinput");
|
||||||
|
var button = document.getElementById(modalName + "server-savebutton");
|
||||||
|
var valid = true;
|
||||||
|
|
||||||
|
descInput.classList.remove("invalidinput");
|
||||||
|
ipInput.classList.remove("invalidinput");
|
||||||
|
|
||||||
|
if (
|
||||||
|
descInput.value.length < parseInt(descInput.getAttribute("minlength")) ||
|
||||||
|
descInput.value.length > parseInt(descInput.getAttribute("maxlength"))
|
||||||
|
) {
|
||||||
|
descInput.classList.add("invalidinput");
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(new RegExp(ipInput.getAttribute("pattern"))).test(ipInput.value)) {
|
||||||
|
ipInput.classList.add("invalidinput");
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (valid) {
|
||||||
|
button.removeAttribute("disabled");
|
||||||
|
} else {
|
||||||
|
button.setAttribute("disabled", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addServer() {
|
||||||
|
var jsonToModify = JSON.parse(remotefs.readFileSync(serversPath));
|
||||||
|
|
||||||
|
var server = {};
|
||||||
|
server["uuid"] = uuidv4();
|
||||||
|
server["description"] =
|
||||||
|
$("#addserver-descinput").val().length == 0
|
||||||
|
? "My OpenFusion Server"
|
||||||
|
: $("#addserver-descinput").val();
|
||||||
|
server["ip"] =
|
||||||
|
$("#addserver-ipinput").val().length == 0
|
||||||
|
? "127.0.0.1:23000"
|
||||||
|
: $("#addserver-ipinput").val();
|
||||||
|
server["version"] = $("#addserver-versionselect option:selected").text();
|
||||||
|
//server['endpoint'] =
|
||||||
|
|
||||||
|
jsonToModify["servers"].push(server);
|
||||||
|
|
||||||
|
remotefs.writeFileSync(serversPath, JSON.stringify(jsonToModify, null, 4));
|
||||||
|
loadServerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function editServer() {
|
||||||
|
var jsonToModify = JSON.parse(remotefs.readFileSync(serversPath));
|
||||||
|
$.each(jsonToModify["servers"], function (key, value) {
|
||||||
|
if (value["uuid"] == getSelectedServer()) {
|
||||||
|
value["description"] =
|
||||||
|
$("#editserver-descinput").val().length == 0
|
||||||
|
? value["description"]
|
||||||
|
: $("#editserver-descinput").val();
|
||||||
|
value["ip"] =
|
||||||
|
$("#editserver-ipinput").val().length == 0
|
||||||
|
? value["ip"]
|
||||||
|
: $("#editserver-ipinput").val();
|
||||||
|
value["version"] = $(
|
||||||
|
"#editserver-versionselect option:selected"
|
||||||
|
).text();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
remotefs.writeFileSync(serversPath, JSON.stringify(jsonToModify, null, 4));
|
||||||
|
loadServerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteServer() {
|
||||||
|
var jsonToModify = JSON.parse(remotefs.readFileSync(serversPath));
|
||||||
|
var result = jsonToModify["servers"].filter(function (obj) {
|
||||||
|
return obj.uuid === getSelectedServer();
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
var resultindex = jsonToModify["servers"].indexOf(result);
|
||||||
|
|
||||||
|
jsonToModify["servers"].splice(resultindex, 1);
|
||||||
|
|
||||||
|
remotefs.writeFileSync(serversPath, JSON.stringify(jsonToModify, null, 4));
|
||||||
|
loadServerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function restoreDefaultServers() {
|
||||||
|
remotefs.copySync(
|
||||||
|
path.join(__dirname, "/defaults/servers.json"),
|
||||||
|
serversPath
|
||||||
|
);
|
||||||
|
loadServerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateVersionSave(modalName) {
|
||||||
|
// works everytime a key is entered into the version save form
|
||||||
|
var nameInput = document.getElementById(modalName + "version-nameinput");
|
||||||
|
var urlInput = document.getElementById(modalName + "version-urlinput");
|
||||||
|
var button = document.getElementById(modalName + "version-savebutton");
|
||||||
|
var valid = true;
|
||||||
|
|
||||||
|
nameInput.classList.remove("invalidinput");
|
||||||
|
urlInput.classList.remove("invalidinput");
|
||||||
|
|
||||||
|
var matchingVersions = versionArray.filter(function (obj) {
|
||||||
|
return obj.name === nameInput.value;
|
||||||
|
});
|
||||||
|
var allowedMatches = (modalName === "edit") ? 1 : 0;
|
||||||
|
|
||||||
|
if (
|
||||||
|
matchingVersions.length > allowedMatches ||
|
||||||
|
!(new RegExp(nameInput.getAttribute("pattern"))).test(nameInput.value)
|
||||||
|
) {
|
||||||
|
nameInput.classList.add("invalidinput");
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(new RegExp(urlInput.getAttribute("pattern"))).test(urlInput.value)) {
|
||||||
|
urlInput.classList.add("invalidinput");
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (valid) {
|
||||||
|
button.removeAttribute("disabled");
|
||||||
|
} else {
|
||||||
|
button.setAttribute("disabled", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addVersion() {
|
||||||
|
var jsonToModify = JSON.parse(remotefs.readFileSync(versionsPath));
|
||||||
|
|
||||||
|
var version = {};
|
||||||
|
version["name"] =
|
||||||
|
$("#addversion-nameinput").val().length == 0
|
||||||
|
? "custom-build-" + uuidv4().substring(0, 8)
|
||||||
|
: $("#addversion-nameinput").val();
|
||||||
|
version["url"] =
|
||||||
|
$("#addversion-urlinput").val().length == 0
|
||||||
|
? cdnString + "/" + version["name"] + "/"
|
||||||
|
: $("#addversion-urlinput").val();
|
||||||
|
|
||||||
|
var matchingVersions = jsonToModify["versions"].filter(function (obj) {
|
||||||
|
return obj.name === version["name"];
|
||||||
|
});
|
||||||
|
|
||||||
|
if (matchingVersions.length > 0) return;
|
||||||
|
|
||||||
|
jsonToModify["versions"].unshift(version);
|
||||||
|
|
||||||
|
remotefs.writeFileSync(versionsPath, JSON.stringify(jsonToModify, null, 4));
|
||||||
|
loadCacheList();
|
||||||
|
handleCache("hash-check", version["name"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function editVersion() {
|
||||||
|
var jsonToModify = JSON.parse(remotefs.readFileSync(versionsPath));
|
||||||
|
var editedVersionString = null;
|
||||||
|
|
||||||
|
$.each(jsonToModify["versions"], function (key, value) {
|
||||||
|
if (value["name"] == getSelectedVersion() && !defaultHashes.hasOwnProperty(value["name"])) {
|
||||||
|
value["name"] =
|
||||||
|
$("#editversion-nameinput").val().length == 0
|
||||||
|
? value["name"]
|
||||||
|
: $("#editversion-nameinput").val();
|
||||||
|
value["url"] =
|
||||||
|
$("#editversion-urlinput").val().length == 0
|
||||||
|
? value["url"]
|
||||||
|
: $("#editversion-urlinput").val();
|
||||||
|
editedVersionString = value["name"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!editedVersionString) return;
|
||||||
|
|
||||||
|
remotefs.writeFileSync(versionsPath, JSON.stringify(jsonToModify, null, 4));
|
||||||
|
loadCacheList();
|
||||||
|
handleCache("hash-check", editedVersionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteVersion() {
|
||||||
|
var jsonToModify = JSON.parse(remotefs.readFileSync(versionsPath));
|
||||||
|
|
||||||
|
var result = jsonToModify["versions"].filter(function (obj) {
|
||||||
|
return obj.name === getSelectedVersion();
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
if (defaultHashes.hasOwnProperty(result.name)) return;
|
||||||
|
|
||||||
|
var resultindex = jsonToModify["versions"].indexOf(result);
|
||||||
|
|
||||||
|
jsonToModify["versions"].splice(resultindex, 1);
|
||||||
|
|
||||||
|
remotefs.writeFileSync(versionsPath, JSON.stringify(jsonToModify, null, 4));
|
||||||
|
loadCacheList();
|
||||||
|
delete cacheSizes[result.name];
|
||||||
|
}
|
||||||
|
|
||||||
|
function restoreDefaultVersions() {
|
||||||
|
remotefs.copySync(
|
||||||
|
path.join(__dirname, "/defaults/versions.json"),
|
||||||
|
versionsPath
|
||||||
|
);
|
||||||
|
loadCacheList();
|
||||||
|
handleCache("hash-check");
|
||||||
|
}
|
||||||
|
|
||||||
|
function editConfig() {
|
||||||
|
var jsonToModify = JSON.parse(remotefs.readFileSync(configPath));
|
||||||
|
|
||||||
|
jsonToModify["autoupdate-check"] = $("#editconfig-autoupdate").prop("checked");
|
||||||
|
jsonToModify["cache-swapping"] = $("#editconfig-cacheswapping").prop("checked");
|
||||||
|
jsonToModify["enable-offline-cache"] = $("#editconfig-enableofflinecache").prop("checked");
|
||||||
|
jsonToModify["verify-offline-cache"] = $("#editconfig-verifyofflinecache").prop("checked");
|
||||||
|
|
||||||
|
var dirInput = $("#editconfig-offlinecachelocation:text").val();
|
||||||
|
var shouldChangeRoot = (
|
||||||
|
remotefs.existsSync(dirInput) &&
|
||||||
|
remotefs.statSync(dirInput).isDirectory()
|
||||||
|
);
|
||||||
|
|
||||||
|
jsonToModify["offline-cache-location"] = shouldChangeRoot ? dirInput : offlineRoot;
|
||||||
|
|
||||||
|
remotefs.writeFileSync(configPath, JSON.stringify(jsonToModify, null, 4));
|
||||||
|
|
||||||
|
loadConfig();
|
||||||
|
// check all offline caches if the offline root changes
|
||||||
|
if (shouldChangeRoot) handleCache("hash-check", null, "offline");
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateCacheLocation() {
|
||||||
|
var input = document.getElementById("editconfig-offlinecachelocation");
|
||||||
|
var button = document.getElementById("editconfig-savebutton");
|
||||||
|
|
||||||
|
input.classList.remove("invalidinput");
|
||||||
|
button.removeAttribute("disabled");
|
||||||
|
|
||||||
|
if (!remotefs.existsSync(input.value) || !remotefs.statSync(input.value).isDirectory()) {
|
||||||
|
input.classList.add("invalidinput");
|
||||||
|
button.setAttribute("disabled", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadGameVersions() {
|
||||||
|
var versionJson = remotefs.readJsonSync(versionsPath);
|
||||||
|
versionArray = versionJson["versions"];
|
||||||
|
|
||||||
|
$("#addserver-versionselect").empty();
|
||||||
|
$("#editserver-versionselect").empty();
|
||||||
|
|
||||||
|
$.each(versionArray, function (key, value) {
|
||||||
|
$(new Option(value.name, "val")).appendTo("#addserver-versionselect");
|
||||||
|
$(new Option(value.name, "val")).appendTo("#editserver-versionselect");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadConfig() {
|
||||||
|
// Load config object globally
|
||||||
|
config = remotefs.readJsonSync(configPath);
|
||||||
|
|
||||||
|
$("#editconfig-autoupdate").prop("checked", config["autoupdate-check"]);
|
||||||
|
$("#editconfig-cacheswapping").prop("checked", config["cache-swapping"]);
|
||||||
|
$("#editconfig-enableofflinecache").prop("checked", config["enable-offline-cache"]);
|
||||||
|
$("#editconfig-verifyofflinecache").prop("checked", config["verify-offline-cache"]);
|
||||||
|
|
||||||
|
// alter offline root globally
|
||||||
|
offlineRoot = config["offline-cache-location"] || offlineRootDefault;
|
||||||
|
$("#editconfig-offlinecachelocation:text").val(offlineRoot);
|
||||||
|
|
||||||
|
validateCacheLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadServerList() {
|
||||||
|
var serverJson = remotefs.readJsonSync(serversPath);
|
||||||
|
serverArray = serverJson["servers"];
|
||||||
|
|
||||||
|
deselectServer(); // Remove selection and disable buttons until another server is selected
|
||||||
|
$(".server-listing-entry").remove(); // Clear out old stuff, if any
|
||||||
|
|
||||||
|
if (serverArray.length > 0) {
|
||||||
|
// Servers were found in the JSON
|
||||||
|
$("#server-listing-placeholder").attr("hidden", true);
|
||||||
|
$.each(serverArray, function (key, value) {
|
||||||
|
// Create the row, and populate the cells
|
||||||
|
var row = document.createElement("tr");
|
||||||
|
row.className = "server-listing-entry";
|
||||||
|
row.setAttribute("id", value.uuid);
|
||||||
|
var cellName = document.createElement("td");
|
||||||
|
cellName.textContent = value.description;
|
||||||
|
var cellVersion = document.createElement("td");
|
||||||
|
cellVersion.textContent = value.version;
|
||||||
|
cellVersion.className = "text-monospace";
|
||||||
|
|
||||||
|
row.appendChild(cellName);
|
||||||
|
row.appendChild(cellVersion);
|
||||||
|
$("#server-tablebody").append(row);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// No servers are added, make sure placeholder is visible
|
||||||
|
$("#server-listing-placeholder").attr("hidden", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadCacheList() {
|
||||||
|
// we might want to use a new version right away, so reload them
|
||||||
|
loadGameVersions();
|
||||||
|
|
||||||
|
// load default hashes.json for reference while running the cache handler
|
||||||
|
if (!defaultHashes) {
|
||||||
|
defaultHashes = remotefs.readJsonSync(path.join(
|
||||||
|
__dirname,
|
||||||
|
"/defaults/hashes.json"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
deselectVersion(); // Remove selection and disable buttons until another server is selected
|
||||||
|
$(".cache-listing-entry").remove(); // Clear out old stuff, if any
|
||||||
|
|
||||||
|
$.each(versionArray, function (key, value) {
|
||||||
|
var row = document.createElement("tr");
|
||||||
|
row.className = "cache-listing-entry"
|
||||||
|
row.setAttribute("id", value.name);
|
||||||
|
|
||||||
|
var cellVersion = document.createElement("td");
|
||||||
|
cellVersion.textContent = value.name;
|
||||||
|
cellVersion.className = "text-monospace";
|
||||||
|
|
||||||
|
var cellPlayableCache = getCacheInfoCell(value.name, "playable");
|
||||||
|
var cellOfflineCache = getCacheInfoCell(value.name, "offline");
|
||||||
|
|
||||||
|
row.appendChild(cellVersion);
|
||||||
|
row.appendChild(cellPlayableCache);
|
||||||
|
row.appendChild(cellOfflineCache);
|
||||||
|
|
||||||
|
$("#cache-tablebody").append(row);
|
||||||
|
});
|
||||||
|
|
||||||
|
// simulate a cache handler run so that the buttons update properly
|
||||||
|
storageLoadingStart();
|
||||||
|
storageLoadingUpdate(cacheSizes);
|
||||||
|
storageLoadingComplete(cacheSizes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheElemID(versionString, cacheMode, elementName) {
|
||||||
|
return [versionString, cacheMode, "cache", elementName].filter(function (value) {
|
||||||
|
return typeof value !== "undefined";
|
||||||
|
}).join("-");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheButtonID(versionString, cacheMode, buttonMode) {
|
||||||
|
return [getCacheElemID(versionString, cacheMode), buttonMode, "button"].join("-");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheLabelText(sizes) {
|
||||||
|
if (!sizes || sizes.total === 0)
|
||||||
|
return "?.?? GB / ?.?? GB";
|
||||||
|
|
||||||
|
var gb = 1 << 30;
|
||||||
|
var labelText = (sizes.intact / gb).toFixed(2) + " / " + (sizes.total / gb).toFixed(2) + " GB";
|
||||||
|
|
||||||
|
if (sizes.altered > 0) {
|
||||||
|
labelText += "<br/>(" + (sizes.altered / gb).toFixed(2) + " GB Altered)";
|
||||||
|
}
|
||||||
|
|
||||||
|
return labelText;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheInfoCell(versionString, cacheMode) {
|
||||||
|
var divID = getCacheElemID(versionString, cacheMode, "div");
|
||||||
|
var labelID = getCacheElemID(versionString, cacheMode, "label");
|
||||||
|
|
||||||
|
var settings = {
|
||||||
|
download: {
|
||||||
|
icon: "fas fa-download",
|
||||||
|
class: "btn btn-success mr-1",
|
||||||
|
tooltip: "Download Cache"
|
||||||
|
},
|
||||||
|
fix: {
|
||||||
|
icon: "fas fa-hammer",
|
||||||
|
class: "btn btn-warning mr-1",
|
||||||
|
tooltip: "Fix Altered Files in Cache"
|
||||||
|
},
|
||||||
|
delete: {
|
||||||
|
icon: "fas fa-trash-alt",
|
||||||
|
class: "btn btn-danger mr-1",
|
||||||
|
tooltip: "Delete Cache"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var cellCache = document.createElement("td");
|
||||||
|
var divCacheAll = document.createElement("div");
|
||||||
|
|
||||||
|
var labelCache = document.createElement("label");
|
||||||
|
labelCache.setAttribute("id", labelID);
|
||||||
|
labelCache.setAttribute("for", divID);
|
||||||
|
// pull existing info from cacheSizes when available
|
||||||
|
labelCache.innerHTML = getCacheLabelText(
|
||||||
|
(cacheSizes && cacheSizes[versionString]) ?
|
||||||
|
cacheSizes[versionString][cacheMode] :
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
var divCacheButtons = document.createElement("div");
|
||||||
|
divCacheButtons.setAttribute("id", labelID);
|
||||||
|
|
||||||
|
$.each(settings, function (buttonMode, config) {
|
||||||
|
// only delete allowed for playable game caches
|
||||||
|
if (cacheMode === "playable" && buttonMode !== "delete") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var buttonID = getCacheButtonID(versionString, cacheMode, buttonMode);
|
||||||
|
|
||||||
|
var iconItalic = document.createElement("i");
|
||||||
|
iconItalic.setAttribute("class", config.icon);
|
||||||
|
|
||||||
|
var buttonCache = document.createElement("button");
|
||||||
|
buttonCache.setAttribute("id", buttonID);
|
||||||
|
buttonCache.setAttribute("class", config.class);
|
||||||
|
buttonCache.setAttribute("title", config.tooltip);
|
||||||
|
buttonCache.setAttribute("type", "button");
|
||||||
|
// handler setup
|
||||||
|
buttonCache.setAttribute("onclick", "handleCache(\"" + buttonMode + "\", \"" + versionString + "\", \"" + cacheMode + "\");");
|
||||||
|
buttonCache.appendChild(iconItalic);
|
||||||
|
|
||||||
|
divCacheButtons.appendChild(buttonCache);
|
||||||
|
});
|
||||||
|
|
||||||
|
divCacheAll.appendChild(labelCache);
|
||||||
|
divCacheAll.appendChild(divCacheButtons);
|
||||||
|
cellCache.appendChild(divCacheAll);
|
||||||
|
|
||||||
|
return cellCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
function storageLoadingStart(vString, cMode) {
|
||||||
|
// determine which cache versions and modes to visually update
|
||||||
|
var versionStrings = [];
|
||||||
|
$.each(versionArray, function (key, value) {
|
||||||
|
if (vString) {
|
||||||
|
if (vString === value.name)
|
||||||
|
versionStrings.push(value.name);
|
||||||
|
} else {
|
||||||
|
versionStrings.push(value.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var cacheModes = (cMode) ? [cMode] : ["offline", "playable"];
|
||||||
|
|
||||||
|
// deselect and disable the add version button until they are re-enabled
|
||||||
|
deselectVersion();
|
||||||
|
disableVersionAddButton();
|
||||||
|
|
||||||
|
// turn buttons into spinners
|
||||||
|
$.each(versionStrings, function (vKey, versionString) {
|
||||||
|
$.each(cacheModes, function (cKey, cacheMode) {
|
||||||
|
var buttonDelete = document.getElementById(getCacheButtonID(versionString, cacheMode, "delete"));
|
||||||
|
var buttonDownload = document.getElementById(getCacheButtonID(versionString, cacheMode, "download"));
|
||||||
|
var buttonFix = document.getElementById(getCacheButtonID(versionString, cacheMode, "fix"));
|
||||||
|
|
||||||
|
if (!buttonDelete) return;
|
||||||
|
|
||||||
|
buttonDelete.setAttribute("disabled", "");
|
||||||
|
buttonDelete.children[0].setAttribute("class", "fas fa-spinner fa-spin fa-fw");
|
||||||
|
|
||||||
|
if (cacheMode === "offline") {
|
||||||
|
buttonDownload.setAttribute("disabled", "");
|
||||||
|
buttonDownload.children[0].setAttribute("class", "fas fa-spinner fa-spin fa-fw");
|
||||||
|
|
||||||
|
buttonFix.setAttribute("disabled", "");
|
||||||
|
buttonFix.children[0].setAttribute("class", "fas fa-spinner fa-spin fa-fw");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function storageLoadingUpdate(allSizes) {
|
||||||
|
// update cacheSizes and display results
|
||||||
|
$.each(allSizes, function (versionString, vSizes) {
|
||||||
|
$.each(vSizes, function (cacheMode, sizes) {
|
||||||
|
var label = document.getElementById(getCacheElemID(versionString, cacheMode, "label"));
|
||||||
|
|
||||||
|
cacheSizes = cacheSizes || {};
|
||||||
|
cacheSizes[versionString] = cacheSizes[versionString] || {};
|
||||||
|
cacheSizes[versionString][cacheMode] = sizes || {};
|
||||||
|
|
||||||
|
if (!label) return;
|
||||||
|
|
||||||
|
label.innerHTML = getCacheLabelText(sizes);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function storageLoadingComplete(allSizes) {
|
||||||
|
// re-enable buttons according to the sizes that were read
|
||||||
|
$.each(allSizes, function (versionString, vSizes) {
|
||||||
|
$.each(vSizes, function (cacheMode, sizes) {
|
||||||
|
var buttonDelete = document.getElementById(getCacheButtonID(versionString, cacheMode, "delete"));
|
||||||
|
var buttonDownload = document.getElementById(getCacheButtonID(versionString, cacheMode, "download"));
|
||||||
|
var buttonFix = document.getElementById(getCacheButtonID(versionString, cacheMode, "fix"));
|
||||||
|
|
||||||
|
if (!buttonDelete) return;
|
||||||
|
|
||||||
|
buttonDelete.children[0].setAttribute("class", "fas fa-trash-alt");
|
||||||
|
|
||||||
|
if (cacheMode === "offline") {
|
||||||
|
buttonDownload.children[0].setAttribute("class", "fas fa-download");
|
||||||
|
buttonFix.children[0].setAttribute("class", "fas fa-hammer");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizes.intact > 0 || sizes.altered > 0) {
|
||||||
|
buttonDelete.removeAttribute("disabled");
|
||||||
|
|
||||||
|
if (cacheMode === "offline") {
|
||||||
|
buttonDownload.setAttribute("disabled", "");
|
||||||
|
|
||||||
|
if (sizes.altered > 0 || sizes.intact < sizes.total) {
|
||||||
|
buttonFix.removeAttribute("disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buttonDelete.setAttribute("disabled", "");
|
||||||
|
|
||||||
|
if (cacheMode === "offline") {
|
||||||
|
buttonDownload.removeAttribute("disabled");
|
||||||
|
buttonFix.setAttribute("disabled", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// finally, re-enable the version add button
|
||||||
|
enableVersionAddButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCache(operation, versionString, cacheMode, callback) {
|
||||||
|
// see if any versions match (could be undefined or null)
|
||||||
|
var versions = versionArray.filter(function (obj) {
|
||||||
|
return obj.name === versionString;
|
||||||
|
});
|
||||||
|
// pull version url from the found object, if none found, use the default cdn link
|
||||||
|
var cdnRoot = (versions.length === 0) ? cdnString : versions[0].url;
|
||||||
|
|
||||||
|
var lastSizes = { intact: 0, altered: 0, total: 0 };
|
||||||
|
var buf = "";
|
||||||
|
|
||||||
|
// start loading on the given version and mode (could be undefined or null, which means 'all')
|
||||||
|
storageLoadingStart(versionString, cacheMode);
|
||||||
|
|
||||||
|
// create the server and socket listener
|
||||||
|
var server = net.createServer(function (sock) {
|
||||||
|
sock.setEncoding("utf8");
|
||||||
|
|
||||||
|
sock.on("data", function (data) {
|
||||||
|
// read data until the next \n, and keep reading
|
||||||
|
// sometimes the updates are buffered, so there might be multiple objects
|
||||||
|
// per update, and partial objects as well
|
||||||
|
// buffer parsing allows us to handle these cases
|
||||||
|
buf += data;
|
||||||
|
|
||||||
|
var end = buf.indexOf("\n");
|
||||||
|
|
||||||
|
while (end > 0) {
|
||||||
|
var sub = buf.substring(0, end);
|
||||||
|
buf = buf.substring(end + 1);
|
||||||
|
|
||||||
|
// run a storage update here
|
||||||
|
lastSizes = JSON.parse(sub);
|
||||||
|
storageLoadingUpdate(lastSizes);
|
||||||
|
|
||||||
|
end = buf.indexOf("\n");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// start listening on a randomly acquired port, and spawn cache handler when ready
|
||||||
|
server.listen(0, "localhost", function () {
|
||||||
|
spawn(
|
||||||
|
path.join(__dirname, "lib", "cache_handler.exe"),
|
||||||
|
[
|
||||||
|
"--operation", operation,
|
||||||
|
// roots below contain version-agnostic main directories for caches
|
||||||
|
"--playable-root", cacheRoot,
|
||||||
|
"--offline-root", offlineRoot,
|
||||||
|
"--user-dir", userData,
|
||||||
|
// CDN root contains version-specific directory, unless cacheMode is "all"
|
||||||
|
"--cdn-root", cdnRoot,
|
||||||
|
"--cache-mode", cacheMode || "all",
|
||||||
|
"--cache-version", versionString || "all",
|
||||||
|
// learn port from the server object and tell the script where to connect
|
||||||
|
"--port", server.address().port,
|
||||||
|
// tell the script which versions and caches are official
|
||||||
|
"--official-caches"
|
||||||
|
].concat(Object.keys(defaultHashes)),
|
||||||
|
{
|
||||||
|
stdio: "inherit"
|
||||||
|
}
|
||||||
|
).on("exit", function (code, signal) {
|
||||||
|
if (code !== 0 || signal) {
|
||||||
|
dialog.showErrorBox(
|
||||||
|
"Sorry!",
|
||||||
|
"Process \"" + operation + "\" failed with code " + code + " and signal " + signal + "."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// when the script exits, close the server
|
||||||
|
server.close();
|
||||||
|
// set button state accordingly
|
||||||
|
storageLoadingComplete(lastSizes);
|
||||||
|
// then run the given callback (if any)
|
||||||
|
if (callback) callback(lastSizes);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function performCacheSwap(newVersion) {
|
||||||
|
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
|
||||||
|
// (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
|
||||||
|
if (remotefs.existsSync(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,
|
||||||
|
path.join(cacheRoot, lastVersion)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
console.log("Cached version unchanged, skipping rename");
|
||||||
|
skip = true;
|
||||||
|
}
|
||||||
|
console.log("Current cache is " + lastVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function prepGameInfo(serverUUID) {
|
||||||
|
var serverInfo = serverArray.filter(function (obj) {
|
||||||
|
return obj.uuid === serverUUID;
|
||||||
|
})[0];
|
||||||
|
var versionInfo = versionArray.filter(function (obj) {
|
||||||
|
return obj.name === serverInfo.version;
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
// If cache swapping property exists AND is `true`, run cache swapping logic
|
||||||
|
if (config["cache-swapping"]) {
|
||||||
|
try {
|
||||||
|
performCacheSwap(versionInfo.name);
|
||||||
|
} catch (ex) {
|
||||||
|
console.log(
|
||||||
|
"Error when swapping cache, it may get overwritten:\n" + ex
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config["enable-offline-cache"]) {
|
||||||
|
// if we always ignore the offline cache, just use the URL
|
||||||
|
setGameInfo(serverInfo, versionInfo.url);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var offlinePath = path.join(offlineRoot, versionInfo.name);
|
||||||
|
var offlineURL = "file:///" + offlinePath.replace(/\\/g, "/") + "/";
|
||||||
|
|
||||||
|
if (config["verify-offline-cache"]) {
|
||||||
|
// if required, do a full hash check, and use the offline cache only if it is fully intact
|
||||||
|
handleCache("hash-check", versionInfo.name, "offline", function (sizes) {
|
||||||
|
var versionURL = (sizes.intact < sizes.total) ? versionInfo.url : offlineURL;
|
||||||
|
setGameInfo(serverInfo, versionURL);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise, if main.unity3d is present, use the offline cache
|
||||||
|
var mainPath = path.join(offlinePath, "main.unity3d");
|
||||||
|
var versionURL = !remotefs.existsSync(mainPath) ? versionInfo.url : offlineURL;
|
||||||
|
setGameInfo(serverInfo, versionURL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// For writing loginInfo.php, assetInfo.php, etc.
|
||||||
|
function setGameInfo(serverInfo, versionURL) {
|
||||||
|
// slash fix if people mess it up via text editors
|
||||||
|
var versionURLRoot = versionURL.endsWith("/") ? versionURL : versionURL + "/";
|
||||||
|
window.assetUrl = versionURLRoot; // game-client.js needs to access this
|
||||||
|
console.log("Cache will expand from " + versionURLRoot);
|
||||||
|
|
||||||
|
remotefs.writeFileSync(path.join(__dirname, "assetInfo.php"), assetUrl);
|
||||||
|
if (serverInfo.hasOwnProperty("endpoint")) {
|
||||||
|
var httpEndpoint = serverInfo.endpoint.replace("https://", "http://");
|
||||||
|
remotefs.writeFileSync(
|
||||||
|
path.join(__dirname, "rankurl.txt"),
|
||||||
|
httpEndpoint + "getranks"
|
||||||
|
);
|
||||||
|
// Write these out too
|
||||||
|
remotefs.writeFileSync(
|
||||||
|
path.join(__dirname, "sponsor.php"),
|
||||||
|
httpEndpoint + "upsell/sponsor.png"
|
||||||
|
);
|
||||||
|
remotefs.writeFileSync(
|
||||||
|
path.join(__dirname, "images.php"),
|
||||||
|
httpEndpoint + "upsell/"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Remove/default the endpoint related stuff, this server won't be using it
|
||||||
|
if (remotefs.existsSync(path.join(__dirname, "rankurl.txt"))) {
|
||||||
|
remotefs.unlinkSync(path.join(__dirname, "rankurl.txt"));
|
||||||
|
remotefs.writeFileSync(
|
||||||
|
path.join(__dirname, "sponsor.php"),
|
||||||
|
"assets/img/welcome.png"
|
||||||
|
);
|
||||||
|
remotefs.writeFileSync(
|
||||||
|
path.join(__dirname, "images.php"),
|
||||||
|
"assets/img/"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Server address parsing
|
||||||
|
var address;
|
||||||
|
var port;
|
||||||
|
var sepPos = serverInfo.ip.indexOf(":");
|
||||||
|
if (sepPos > -1) {
|
||||||
|
address = serverInfo.ip.substr(0, sepPos);
|
||||||
|
port = serverInfo.ip.substr(sepPos + 1);
|
||||||
|
} else {
|
||||||
|
address = serverInfo.ip;
|
||||||
|
port = 23000; // default
|
||||||
|
}
|
||||||
|
|
||||||
|
// DNS resolution. there is no synchronous version for some stupid reason
|
||||||
|
if (!address.match(/^[0-9.]+$/)) {
|
||||||
|
dns.lookup(address, (family = 4), function (err, resolvedAddress) {
|
||||||
|
if (!err) {
|
||||||
|
console.log("Resolved " + address + " to " + resolvedAddress);
|
||||||
|
address = resolvedAddress;
|
||||||
|
} else {
|
||||||
|
console.log("Err: " + err.code);
|
||||||
|
}
|
||||||
|
prepConnection(address, port);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log(address + " is an IP; skipping DNS lookup");
|
||||||
|
prepConnection(address, port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function prepConnection(address, port) {
|
||||||
|
var full = address + ":" + port;
|
||||||
|
console.log("Will connect to " + full);
|
||||||
|
remotefs.writeFileSync(path.join(__dirname, "loginInfo.php"), full);
|
||||||
|
launchGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the UUID of the server with the selected background color.
|
||||||
|
// Yes, there are probably better ways to go about this, but it works well enough.
|
||||||
|
function getSelectedServer() {
|
||||||
|
return $("#server-tablebody > tr.bg-primary").prop("id");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the name of the version with the selected background color.
|
||||||
|
function getSelectedVersion() {
|
||||||
|
return $("#cache-tablebody > tr.bg-primary").prop("id");
|
||||||
|
}
|
||||||
|
|
||||||
|
function connectToServer() {
|
||||||
|
// Get ID of the selected server, which corresponds to its UUID in the json
|
||||||
|
console.log("Connecting to server with UUID of " + getSelectedServer());
|
||||||
|
|
||||||
|
// Prevent the user from clicking anywhere else during the transition
|
||||||
|
$("body,html").css("pointer-events", "none");
|
||||||
|
stopEasterEggs();
|
||||||
|
$("#of-serverselector").fadeOut("slow", function () {
|
||||||
|
setTimeout(function () {
|
||||||
|
$("body,html").css("pointer-events", "");
|
||||||
|
prepGameInfo(getSelectedServer());
|
||||||
|
}, 200);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// If applicable, deselect currently selected server.
|
||||||
|
function deselectServer() {
|
||||||
|
disableServerListButtons();
|
||||||
|
$(".server-listing-entry").removeClass("bg-primary");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If applicable, deselect currently selected version.
|
||||||
|
function deselectVersion() {
|
||||||
|
disableVersionListButtons();
|
||||||
|
$(".cache-listing-entry").removeClass("bg-primary");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select a server
|
||||||
|
$("#server-table").on("click", ".server-listing-entry", function (event) {
|
||||||
|
enableServerListButtons();
|
||||||
|
$(this).addClass("bg-primary").siblings().removeClass("bg-primary");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Select a version (if allowed)
|
||||||
|
$("#cache-table").on("click", ".cache-listing-entry", function (event) {
|
||||||
|
// wait for the add button to be re-enabled first
|
||||||
|
if ($("#of-addversion-button").prop("disabled")) return;
|
||||||
|
// do not select default builds
|
||||||
|
if (defaultHashes.hasOwnProperty($(this).attr("id"))) return;
|
||||||
|
|
||||||
|
enableVersionListButtons();
|
||||||
|
$(this).addClass("bg-primary").siblings().removeClass("bg-primary");
|
||||||
|
});
|
||||||
|
|
||||||
|
// QoL feature: if you double click on a server it will connect
|
||||||
|
$("#server-table").on("dblclick", ".server-listing-entry", function (event) {
|
||||||
|
$(this).addClass("bg-primary").siblings().removeClass("bg-primary");
|
||||||
|
connectToServer();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#of-addservermodal").on("show.bs.modal", function (e) {
|
||||||
|
validateServerSave("add");
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#of-addversionmodal").on("show.bs.modal", function (e) {
|
||||||
|
validateVersionSave("add");
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#of-editservermodal").on("show.bs.modal", function (e) {
|
||||||
|
// populate the edit modal with existing values
|
||||||
|
var jsonToModify = remotefs.readJsonSync(serversPath);
|
||||||
|
|
||||||
|
$.each(jsonToModify["servers"], function (key, value) {
|
||||||
|
if (value["uuid"] == getSelectedServer()) {
|
||||||
|
$("#editserver-descinput")[0].value = value["description"];
|
||||||
|
$("#editserver-ipinput")[0].value = value["ip"];
|
||||||
|
|
||||||
|
var versionIndex = -1;
|
||||||
|
$.each($("#editserver-versionselect")[0], function (key, val) {
|
||||||
|
if (val.text === value["version"]) {
|
||||||
|
versionIndex = key;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("#editserver-versionselect")[0].selectedIndex = versionIndex;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
validateServerSave("edit");
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#of-editversionmodal").on("show.bs.modal", function (e) {
|
||||||
|
// populate the edit modal with existing values
|
||||||
|
var jsonToModify = remotefs.readJsonSync(versionsPath);
|
||||||
|
|
||||||
|
$.each(jsonToModify["versions"], function (key, value) {
|
||||||
|
if (value["name"] == getSelectedVersion()) {
|
||||||
|
$("#editversion-nameinput")[0].value = value["name"];
|
||||||
|
$("#editversion-urlinput")[0].value = value["url"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
validateVersionSave("edit");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Replace server name to delete
|
||||||
|
$("#of-deleteservermodal").on("show.bs.modal", function (e) {
|
||||||
|
var result = serverArray.filter(function (obj) {
|
||||||
|
return obj.uuid === getSelectedServer();
|
||||||
|
})[0];
|
||||||
|
$("#deleteserver-servername").html(result.description);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Replace version name to delete
|
||||||
|
$("#of-deleteversionmodal").on("show.bs.modal", function (e) {
|
||||||
|
var result = versionArray.filter(function (obj) {
|
||||||
|
return obj.name === getSelectedVersion();
|
||||||
|
})[0];
|
||||||
|
$("#deleteversion-versionname").html(result.name);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Run the global hash check once and only if the cache modal is ever shown
|
||||||
|
$("#of-editcacheconfigmodal").on("show.bs.modal", function (e) {
|
||||||
|
if (!cacheSizes) handleCache("hash-check");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Keep all config values synced on modal show
|
||||||
|
// Avoids cases where people forget that they changed the offline root but did not save
|
||||||
|
$("#of-editconfigmodal").on("show.bs.modal", function (e) {
|
||||||
|
loadConfig();
|
||||||
|
});
|
||||||
@@ -1,368 +0,0 @@
|
|||||||
var remote = require("remote");
|
|
||||||
var remotefs = remote.require("fs-extra");
|
|
||||||
var dns = remote.require("dns");
|
|
||||||
|
|
||||||
var userdir = remote.require("app").getPath("userData");
|
|
||||||
var versionarray;
|
|
||||||
var serverarray;
|
|
||||||
var config;
|
|
||||||
|
|
||||||
function enableServerListButtons() {
|
|
||||||
$("#of-connect-button").removeClass("disabled");
|
|
||||||
$("#of-connect-button").prop("disabled", false);
|
|
||||||
$("#of-editserver-button").removeClass("disabled");
|
|
||||||
$("#of-editserver-button").prop("disabled", false);
|
|
||||||
$("#of-deleteserver-button").removeClass("disabled");
|
|
||||||
$("#of-deleteserver-button").prop("disabled", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
function disableServerListButtons() {
|
|
||||||
$("#of-connect-button").addClass("disabled");
|
|
||||||
$("#of-connect-button").prop("disabled", true);
|
|
||||||
$("#of-editserver-button").addClass("disabled");
|
|
||||||
$("#of-editserver-button").prop("disabled", true);
|
|
||||||
$("#of-deleteserver-button").addClass("disabled");
|
|
||||||
$("#of-deleteserver-button").prop("disabled", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getAppVersion() {
|
|
||||||
appversion = remote.require("app").getVersion();
|
|
||||||
|
|
||||||
// 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)
|
|
||||||
} else {
|
|
||||||
return appversion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setAppVersionText() {
|
|
||||||
$("#of-aboutversionnumber").text("Version " + getAppVersion());
|
|
||||||
$("#of-versionnumber").text("v" + getAppVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
function addServer() {
|
|
||||||
var jsontomodify = JSON.parse(
|
|
||||||
remotefs.readFileSync(userdir + "\\servers.json")
|
|
||||||
);
|
|
||||||
|
|
||||||
var server = {};
|
|
||||||
server["uuid"] = uuidv4();
|
|
||||||
server["description"] =
|
|
||||||
$("#addserver-descinput").val().length == 0
|
|
||||||
? "My OpenFusion Server"
|
|
||||||
: $("#addserver-descinput").val();
|
|
||||||
server["ip"] =
|
|
||||||
$("#addserver-ipinput").val().length == 0
|
|
||||||
? "127.0.0.1:23000"
|
|
||||||
: $("#addserver-ipinput").val();
|
|
||||||
server["version"] = $("#addserver-versionselect option:selected").text();
|
|
||||||
//server['endpoint'] =
|
|
||||||
|
|
||||||
jsontomodify["servers"].push(server);
|
|
||||||
|
|
||||||
remotefs.writeFileSync(
|
|
||||||
userdir + "\\servers.json",
|
|
||||||
JSON.stringify(jsontomodify, null, 4)
|
|
||||||
);
|
|
||||||
loadServerList();
|
|
||||||
}
|
|
||||||
|
|
||||||
function editServer() {
|
|
||||||
var jsontomodify = JSON.parse(
|
|
||||||
remotefs.readFileSync(userdir + "\\servers.json")
|
|
||||||
);
|
|
||||||
$.each(jsontomodify["servers"], function (key, value) {
|
|
||||||
if (value["uuid"] == getSelectedServer()) {
|
|
||||||
value["description"] =
|
|
||||||
$("#editserver-descinput").val().length == 0
|
|
||||||
? value["description"]
|
|
||||||
: $("#editserver-descinput").val();
|
|
||||||
value["ip"] =
|
|
||||||
$("#editserver-ipinput").val().length == 0
|
|
||||||
? value["ip"]
|
|
||||||
: $("#editserver-ipinput").val();
|
|
||||||
value["version"] = $(
|
|
||||||
"#editserver-versionselect option:selected"
|
|
||||||
).text();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
remotefs.writeFileSync(
|
|
||||||
userdir + "\\servers.json",
|
|
||||||
JSON.stringify(jsontomodify, null, 4)
|
|
||||||
);
|
|
||||||
loadServerList();
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteServer() {
|
|
||||||
var jsontomodify = JSON.parse(
|
|
||||||
remotefs.readFileSync(userdir + "\\servers.json")
|
|
||||||
);
|
|
||||||
var result = jsontomodify["servers"].filter(function (obj) {
|
|
||||||
return obj.uuid === getSelectedServer();
|
|
||||||
})[0];
|
|
||||||
|
|
||||||
var resultindex = jsontomodify["servers"].indexOf(result);
|
|
||||||
|
|
||||||
jsontomodify["servers"].splice(resultindex, 1);
|
|
||||||
|
|
||||||
remotefs.writeFileSync(
|
|
||||||
userdir + "\\servers.json",
|
|
||||||
JSON.stringify(jsontomodify, null, 4)
|
|
||||||
);
|
|
||||||
loadServerList();
|
|
||||||
}
|
|
||||||
|
|
||||||
function restoreDefaultServers() {
|
|
||||||
remotefs.copySync(
|
|
||||||
__dirname + "\\defaults\\servers.json",
|
|
||||||
userdir + "\\servers.json"
|
|
||||||
);
|
|
||||||
loadServerList();
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadGameVersions() {
|
|
||||||
var versionjson = JSON.parse(
|
|
||||||
remotefs.readFileSync(userdir + "\\versions.json")
|
|
||||||
);
|
|
||||||
versionarray = versionjson["versions"];
|
|
||||||
$.each(versionarray, function (key, value) {
|
|
||||||
$(new Option(value.name, "val")).appendTo("#addserver-versionselect");
|
|
||||||
$(new Option(value.name, "val")).appendTo("#editserver-versionselect");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadConfig() {
|
|
||||||
// load config object globally
|
|
||||||
config = JSON.parse(remotefs.readFileSync(userdir + "\\config.json"));
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadServerList() {
|
|
||||||
var serverjson = JSON.parse(
|
|
||||||
remotefs.readFileSync(userdir + "\\servers.json")
|
|
||||||
);
|
|
||||||
serverarray = serverjson["servers"];
|
|
||||||
|
|
||||||
$(".server-listing-entry").remove(); // Clear out old stuff, if any
|
|
||||||
disableServerListButtons(); // Disable buttons until another server is selected
|
|
||||||
|
|
||||||
if (serverarray.length > 0) {
|
|
||||||
// Servers were found in the JSON
|
|
||||||
$("#server-listing-placeholder").attr("hidden", true);
|
|
||||||
$.each(serverarray, function (key, value) {
|
|
||||||
// Create the row, and populate the cells
|
|
||||||
var row = document.createElement("tr");
|
|
||||||
row.className = "server-listing-entry";
|
|
||||||
row.setAttribute("id", value.uuid);
|
|
||||||
var cellName = document.createElement("td");
|
|
||||||
cellName.textContent = value.description;
|
|
||||||
var cellVersion = document.createElement("td");
|
|
||||||
cellVersion.textContent = value.version;
|
|
||||||
cellVersion.className = "text-monospace";
|
|
||||||
|
|
||||||
row.appendChild(cellName);
|
|
||||||
row.appendChild(cellVersion);
|
|
||||||
$("#server-tablebody").append(row);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// No servers are added, make sure placeholder is visible
|
|
||||||
$("#server-listing-placeholder").attr("hidden", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function performCacheSwap(newversion) {
|
|
||||||
var cacheroot = userdir + "\\..\\..\\LocalLow\\Unity\\Web Player\\Cache";
|
|
||||||
var currentcache = cacheroot + "\\Fusionfall";
|
|
||||||
var newcache = cacheroot + "\\" + newversion;
|
|
||||||
var record = userdir + "\\.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
|
|
||||||
// (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
|
|
||||||
if (remotefs.existsSync(record)) {
|
|
||||||
lastversion = remotefs.readFileSync(record);
|
|
||||||
if (lastversion != newversion) {
|
|
||||||
remotefs.renameSync(
|
|
||||||
currentcache,
|
|
||||||
cacheroot + "\\" + lastversion
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
console.log(
|
|
||||||
"Cached version unchanged, renaming will be skipped"
|
|
||||||
);
|
|
||||||
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
|
|
||||||
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.
|
|
||||||
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];
|
|
||||||
|
|
||||||
// if cache swapping property exists AND is `true`, run cache swapping logic
|
|
||||||
if (config["cache-swapping"]) {
|
|
||||||
try {
|
|
||||||
performCacheSwap(gameversion.name);
|
|
||||||
} catch (ex) {
|
|
||||||
console.log(
|
|
||||||
"Error when swapping cache, it may get overwritten:\n" + ex
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.asseturl = gameversion.url; // gameclient.js needs to access this
|
|
||||||
|
|
||||||
remotefs.writeFileSync(__dirname + "\\assetInfo.php", asseturl);
|
|
||||||
if (result.hasOwnProperty("endpoint")) {
|
|
||||||
var httpendpoint = result.endpoint.replace("https://", "http://");
|
|
||||||
remotefs.writeFileSync(
|
|
||||||
__dirname + "\\rankurl.txt",
|
|
||||||
httpendpoint + "getranks"
|
|
||||||
);
|
|
||||||
// Write these out too
|
|
||||||
remotefs.writeFileSync(
|
|
||||||
__dirname + "\\sponsor.php",
|
|
||||||
httpendpoint + "upsell/sponsor.png"
|
|
||||||
);
|
|
||||||
remotefs.writeFileSync(
|
|
||||||
__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");
|
|
||||||
remotefs.writeFileSync(
|
|
||||||
__dirname + "\\sponsor.php",
|
|
||||||
"assets/img/welcome.png"
|
|
||||||
);
|
|
||||||
remotefs.writeFileSync(__dirname + "\\images.php", "assets/img/");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Server address parsing
|
|
||||||
var address;
|
|
||||||
var port;
|
|
||||||
var sepPos = result.ip.indexOf(":");
|
|
||||||
if (sepPos > -1) {
|
|
||||||
address = result.ip.substr(0, sepPos);
|
|
||||||
port = result.ip.substr(sepPos + 1);
|
|
||||||
} else {
|
|
||||||
address = result.ip;
|
|
||||||
port = 23000; // default
|
|
||||||
}
|
|
||||||
|
|
||||||
// DNS resolution. there is no synchronous version for some stupid reason
|
|
||||||
if (!address.match(/^[0-9.]+$/))
|
|
||||||
dns.resolve4(address, function (err, res) {
|
|
||||||
if (!err) {
|
|
||||||
console.log("Resolved " + address + " to " + res[0]);
|
|
||||||
address = res[0];
|
|
||||||
} else {
|
|
||||||
console.log("Err: " + err.code);
|
|
||||||
}
|
|
||||||
prepConnection(address, port);
|
|
||||||
});
|
|
||||||
else {
|
|
||||||
console.log(address + " is an IP; skipping DNS lookup");
|
|
||||||
prepConnection(address, port);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepConnection(address, port) {
|
|
||||||
var full = address + ":" + port;
|
|
||||||
console.log("Will connect to " + full);
|
|
||||||
remotefs.writeFileSync(__dirname + "\\loginInfo.php", full);
|
|
||||||
launchGame();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the UUID of the server with the selected background color.
|
|
||||||
// Yes, there are probably better ways to go about this, but it works well enough.
|
|
||||||
function getSelectedServer() {
|
|
||||||
return $("#server-tablebody > tr.bg-primary").prop("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
function connectToServer() {
|
|
||||||
// Get ID of the selected server, which corresponds to its UUID in the json
|
|
||||||
console.log("Connecting to server with UUID of " + getSelectedServer());
|
|
||||||
|
|
||||||
// Prevent the user from clicking anywhere else during the transition
|
|
||||||
$("body,html").css("pointer-events", "none");
|
|
||||||
stopEasterEggs();
|
|
||||||
$("#of-serverselector").fadeOut("slow", function () {
|
|
||||||
setTimeout(function () {
|
|
||||||
$("body,html").css("pointer-events", "");
|
|
||||||
setGameInfo(getSelectedServer());
|
|
||||||
}, 200);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// If applicable, deselect currently selected server.
|
|
||||||
function deselectServer() {
|
|
||||||
disableServerListButtons();
|
|
||||||
$(".server-listing-entry").removeClass("bg-primary");
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#server-table").on("click", ".server-listing-entry", function (event) {
|
|
||||||
enableServerListButtons();
|
|
||||||
$(this).addClass("bg-primary").siblings().removeClass("bg-primary");
|
|
||||||
});
|
|
||||||
|
|
||||||
// QoL feature: if you double click on a server it will connect
|
|
||||||
$("#server-table").on("dblclick", ".server-listing-entry", function (event) {
|
|
||||||
$(this).addClass("bg-primary").siblings().removeClass("bg-primary");
|
|
||||||
connectToServer();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#of-editservermodal").on("show.bs.modal", function (e) {
|
|
||||||
var jsontomodify = JSON.parse(
|
|
||||||
remotefs.readFileSync(userdir + "\\servers.json")
|
|
||||||
);
|
|
||||||
$.each(jsontomodify["servers"], function (key, value) {
|
|
||||||
if (value["uuid"] == getSelectedServer()) {
|
|
||||||
$("#editserver-descinput")[0].value = value["description"];
|
|
||||||
$("#editserver-ipinput")[0].value = value["ip"];
|
|
||||||
|
|
||||||
var versionIndex = -1;
|
|
||||||
$.each($("#editserver-versionselect")[0], function (key, val) {
|
|
||||||
if (val.text === value["version"]) {
|
|
||||||
versionIndex = key;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("#editserver-versionselect")[0].selectedIndex = versionIndex;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#of-deleteservermodal").on("show.bs.modal", function (e) {
|
|
||||||
var result = serverarray.filter(function (obj) {
|
|
||||||
return obj.uuid === getSelectedServer();
|
|
||||||
})[0];
|
|
||||||
$("#deleteserver-servername").html(result.description);
|
|
||||||
});
|
|
||||||
32
build/OpenFusionClient.exe.manifest
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?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>
|
||||||
|
<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>
|
||||||
|
<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>
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<plist>
|
<plist>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>2.5.5b4</string>
|
<string>2.5.5b4</string>
|
||||||
<key>UnityBuildNumber</key>
|
<key>UnityBuildNumber</key>
|
||||||
<string>50</string>
|
<string>50</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<plist>
|
<plist>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>3.5.2f2</string>
|
<string>2.5.5b4</string>
|
||||||
<key>UnityBuildNumber</key>
|
<key>UnityBuildNumber</key>
|
||||||
<string>4c6ee796dacc</string>
|
<string>50</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<plist>
|
<plist>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>2.5.5b4</string>
|
<string>2.5.5b4</string>
|
||||||
<key>UnityBuildNumber</key>
|
<key>UnityBuildNumber</key>
|
||||||
<string>50</string>
|
<string>50</string>
|
||||||
<key>monoVersion</key>
|
<key>monoVersion</key>
|
||||||
<string>fusion-2.x.x</string>
|
<string>fusion-2.x.x</string>
|
||||||
<key>monoMinimumRevision</key>
|
<key>monoMinimumRevision</key>
|
||||||
<string>2.0.0f6</string>
|
<string>2.0.0f6</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const defaultdir = './dist/win-ia32-unpacked/resources/default_app'
|
const defaultDir = './dist/win-ia32-unpacked/resources/default_app'
|
||||||
const exefile = './dist/win-ia32-unpacked/OpenFusionClient.exe'
|
const exeFile = './dist/win-ia32-unpacked/OpenFusionClient.exe'
|
||||||
|
|
||||||
exports.default = function() {
|
exports.default = function() {
|
||||||
// remove leftover files from default electron app
|
// remove leftover files from default electron app
|
||||||
fs.rm(dir, { recursive: true }, (err) => {
|
fs.rm(defaultDir, { recursive: true }, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// patch executable for large address awareness
|
// patch executable for large address awareness
|
||||||
fs.open(exefile, "r+", (err, fd) => {
|
fs.open(exeFile, "r+", (err, fd) => {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
fs.write(
|
fs.write(
|
||||||
fd, new Uint8Array([0x22]), 0, 1, 0x166,
|
fd, new Uint8Array([0x22]), 0, 1, 0x166,
|
||||||
1109
cache_handler/cache_handler.py
Normal file
33
cache_handler/cache_handler.spec
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
block_cipher = None
|
||||||
|
|
||||||
|
|
||||||
|
a = Analysis(['cache_handler.py'],
|
||||||
|
pathex=['Z:\\src'],
|
||||||
|
binaries=[],
|
||||||
|
datas=[],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=[],
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
win_no_prefer_redirects=False,
|
||||||
|
win_private_assemblies=False,
|
||||||
|
cipher=block_cipher,
|
||||||
|
noarchive=False)
|
||||||
|
pyz = PYZ(a.pure, a.zipped_data,
|
||||||
|
cipher=block_cipher)
|
||||||
|
exe = EXE(pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.zipfiles,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='cache_handler',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=True )
|
||||||
4
cache_handler/requirements.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
aiofiles
|
||||||
|
httpx
|
||||||
|
beautifulsoup4
|
||||||
|
pyinstaller==3.5
|
||||||
4
defaults/config.json
vendored
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"autoupdate-check": true,
|
"autoupdate-check": true,
|
||||||
"cache-swapping": true,
|
"cache-swapping": true,
|
||||||
"last-version-initialized": "1.4"
|
"enable-offline-cache": false,
|
||||||
|
"verify-offline-cache": false,
|
||||||
|
"last-version-initialized": "1.6"
|
||||||
}
|
}
|
||||||
|
|||||||
35695
defaults/hashes.json
vendored
Normal file
495
index.html
@@ -3,27 +3,18 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta
|
<meta
|
||||||
name="viewport"
|
http-equiv="Content-Type"
|
||||||
content="width=device-width, initial-scale=1.0, shrink-to-fit=no"
|
contentType="text/html; charset=UTF-8"
|
||||||
/>
|
/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>OpenFusion: Server Selector</title>
|
<title>OpenFusion: Server Selector</title>
|
||||||
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
|
||||||
<link rel="stylesheet" href="assets/fonts/fontawesome-all.min.css" />
|
<link rel="stylesheet" href="assets/fonts/fontawesome-all.min.css" />
|
||||||
<link rel="stylesheet" href="assets/css/openfusion.css" />
|
<link rel="stylesheet" href="assets/css/openfusion.css" />
|
||||||
<link rel="stylesheet" href="assets/css/styles.css" />
|
<link rel="stylesheet" href="assets/css/styles.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body
|
<body onresize="onResize()">
|
||||||
style="
|
|
||||||
background: rgb(0, 0, 0);
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
clear: both;
|
|
||||||
"
|
|
||||||
onresize="onResize()"
|
|
||||||
>
|
|
||||||
<section id="of-serverselector">
|
<section id="of-serverselector">
|
||||||
<div class="container" id="serverselector-container">
|
<div class="container" id="serverselector-container">
|
||||||
<div class="row text-center mt-3" id="of-logoheader">
|
<div class="row text-center mt-3" id="of-logoheader">
|
||||||
@@ -117,6 +108,30 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4 d-inline-flex justify-content-end">
|
<div class="col-4 d-inline-flex justify-content-end">
|
||||||
|
<button
|
||||||
|
class="btn btn-primary mr-1"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-bs-tooltip=""
|
||||||
|
data-placement="bottom"
|
||||||
|
id="of-editconfig-button"
|
||||||
|
type="button"
|
||||||
|
title="Edit Configuration"
|
||||||
|
data-target="#of-editconfigmodal"
|
||||||
|
>
|
||||||
|
<i class="fas fa-cog"></i>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-primary mr-1"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-bs-tooltip=""
|
||||||
|
data-placement="bottom"
|
||||||
|
id="of-editcache-button"
|
||||||
|
type="button"
|
||||||
|
title="Edit Game Builds"
|
||||||
|
data-target="#of-editcacheconfigmodal"
|
||||||
|
>
|
||||||
|
<i class="fas fa-database"></i>
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
class="btn btn-primary disabled"
|
class="btn btn-primary disabled"
|
||||||
id="of-connect-button"
|
id="of-connect-button"
|
||||||
@@ -151,9 +166,14 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p id="of-aboutversionnumber" class="text-monospace">APP_VERSION_NUMBER</p>
|
<p
|
||||||
|
id="of-aboutversionnumber"
|
||||||
|
class="text-monospace"
|
||||||
|
>
|
||||||
|
APP_VERSION_NUMBER
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
©2020-2023 OpenFusion Contributors<br />OpenFusion
|
©2020-2024 OpenFusion Contributors<br />OpenFusion
|
||||||
is licensed under MIT.<br />
|
is licensed under MIT.<br />
|
||||||
</p>
|
</p>
|
||||||
<a
|
<a
|
||||||
@@ -163,6 +183,13 @@
|
|||||||
data-target="#of-restoreserversmodal"
|
data-target="#of-restoreserversmodal"
|
||||||
>Reset to Default Servers</a
|
>Reset to Default Servers</a
|
||||||
>
|
>
|
||||||
|
<a
|
||||||
|
href="#of-restoreversionsmodal"
|
||||||
|
onclick="$('#of-aboutmodal').modal('toggle')"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#of-restoreversionsmodal"
|
||||||
|
>Reset to Default Game Builds</a
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<div class="row flex-fill">
|
<div class="row flex-fill">
|
||||||
@@ -173,7 +200,7 @@
|
|||||||
data-bs-tooltip=""
|
data-bs-tooltip=""
|
||||||
type="button"
|
type="button"
|
||||||
title="Github Page"
|
title="Github Page"
|
||||||
onclick="window.open('https://github.com/OpenFusionProject/OpenFusion','_blank');"
|
onclick="window.open('https://github.com/OpenFusionProject/OpenFusion','_blank');"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="fab fa-github"
|
class="fab fa-github"
|
||||||
@@ -185,7 +212,7 @@
|
|||||||
data-bs-tooltip=""
|
data-bs-tooltip=""
|
||||||
type="button"
|
type="button"
|
||||||
title="Discord Chat"
|
title="Discord Chat"
|
||||||
onclick="window.open('https://discord.gg/DYavckB','_blank');"
|
onclick="window.open('https://discord.gg/DYavckB','_blank');"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="fab fa-discord"
|
class="fab fa-discord"
|
||||||
@@ -242,6 +269,7 @@
|
|||||||
required=""
|
required=""
|
||||||
minlength="1"
|
minlength="1"
|
||||||
maxlength="70"
|
maxlength="70"
|
||||||
|
oninput="validateServerSave('add')"
|
||||||
/><label for="addserver-ipinput"
|
/><label for="addserver-ipinput"
|
||||||
>Server IP</label
|
>Server IP</label
|
||||||
><input
|
><input
|
||||||
@@ -249,8 +277,10 @@
|
|||||||
type="text"
|
type="text"
|
||||||
id="addserver-ipinput"
|
id="addserver-ipinput"
|
||||||
placeholder="127.0.0.1:23000"
|
placeholder="127.0.0.1:23000"
|
||||||
|
value="127.0.0.1:23000"
|
||||||
required=""
|
required=""
|
||||||
pattern="^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):[0-9]+$"
|
pattern="^([-a-zA-Z0-9]+\.)+[-a-zA-Z0-9]+:[0-9]+$"
|
||||||
|
oninput="validateServerSave('add')"
|
||||||
/><label for="addserver-versionselect"
|
/><label for="addserver-versionselect"
|
||||||
>Game Version: </label
|
>Game Version: </label
|
||||||
><select
|
><select
|
||||||
@@ -258,6 +288,7 @@
|
|||||||
id="addserver-versionselect"
|
id="addserver-versionselect"
|
||||||
required=""
|
required=""
|
||||||
style="margin-left: -5px"
|
style="margin-left: -5px"
|
||||||
|
oninput="validateServerSave('add')"
|
||||||
></select>
|
></select>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -314,7 +345,8 @@
|
|||||||
required=""
|
required=""
|
||||||
minlength="1"
|
minlength="1"
|
||||||
maxlength="70"
|
maxlength="70"
|
||||||
/><label for="addserver-ipinput"
|
oninput="validateServerSave('edit')"
|
||||||
|
/><label for="editserver-ipinput"
|
||||||
>Server IP</label
|
>Server IP</label
|
||||||
><input
|
><input
|
||||||
class="form-control form-row w-75"
|
class="form-control form-row w-75"
|
||||||
@@ -322,7 +354,8 @@
|
|||||||
id="editserver-ipinput"
|
id="editserver-ipinput"
|
||||||
placeholder="127.0.0.1:23000"
|
placeholder="127.0.0.1:23000"
|
||||||
required=""
|
required=""
|
||||||
pattern="^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):[0-9]+$"
|
pattern="^([-a-zA-Z0-9]+\.)+[-a-zA-Z0-9]+:[0-9]+$"
|
||||||
|
oninput="validateServerSave('edit')"
|
||||||
/><label for="editserver-versionselect"
|
/><label for="editserver-versionselect"
|
||||||
>Game Version: </label
|
>Game Version: </label
|
||||||
><select
|
><select
|
||||||
@@ -330,6 +363,7 @@
|
|||||||
id="editserver-versionselect"
|
id="editserver-versionselect"
|
||||||
required=""
|
required=""
|
||||||
style="margin-left: -5px"
|
style="margin-left: -5px"
|
||||||
|
oninput="validateServerSave('edit')"
|
||||||
></select>
|
></select>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -343,7 +377,7 @@
|
|||||||
Cancel</button
|
Cancel</button
|
||||||
><button
|
><button
|
||||||
class="btn btn-primary border rounded border-primary btn-success border-success"
|
class="btn btn-primary border rounded border-primary btn-success border-success"
|
||||||
id="addserver-savebutton"
|
id="editserver-savebutton"
|
||||||
type="submit"
|
type="submit"
|
||||||
data-dismiss="modal"
|
data-dismiss="modal"
|
||||||
form="editserver-form"
|
form="editserver-form"
|
||||||
@@ -436,7 +470,7 @@
|
|||||||
Cancel</button
|
Cancel</button
|
||||||
><button
|
><button
|
||||||
class="btn btn-primary border rounded border-primary btn-danger border-danger"
|
class="btn btn-primary border rounded border-primary btn-danger border-danger"
|
||||||
id="deleteserver-button"
|
id="restoreservers-button"
|
||||||
type="button"
|
type="button"
|
||||||
data-dismiss="modal"
|
data-dismiss="modal"
|
||||||
onclick="restoreDefaultServers();"
|
onclick="restoreDefaultServers();"
|
||||||
@@ -447,6 +481,401 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="modal fade"
|
||||||
|
role="dialog"
|
||||||
|
tabindex="-1"
|
||||||
|
id="of-editconfigmodal"
|
||||||
|
>
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">Edit Configuration</h4>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="close"
|
||||||
|
data-dismiss="modal"
|
||||||
|
aria-label="Close"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="editconfig-form" class="needs-validation">
|
||||||
|
<label for="editconfig-autoupdate"
|
||||||
|
>Automatically update the client:</label
|
||||||
|
><input
|
||||||
|
class="form-control form-row w-75"
|
||||||
|
type="checkbox"
|
||||||
|
id="editconfig-autoupdate"
|
||||||
|
/>
|
||||||
|
<label for="editconfig-cacheswapping"
|
||||||
|
>Swap game caches to avoid unnecessary downloads:</label
|
||||||
|
><input
|
||||||
|
class="form-control form-row w-75"
|
||||||
|
type="checkbox"
|
||||||
|
id="editconfig-cacheswapping"
|
||||||
|
/>
|
||||||
|
<label for="editconfig-enableofflinecache"
|
||||||
|
>Use offline caches when they are available:</label
|
||||||
|
><input
|
||||||
|
class="form-control form-row w-75"
|
||||||
|
type="checkbox"
|
||||||
|
id="editconfig-enableofflinecache"
|
||||||
|
/>
|
||||||
|
<label for="editconfig-verifyofflinecache"
|
||||||
|
>Verify offline caches every time they are loaded:</label
|
||||||
|
><input
|
||||||
|
class="form-control form-row w-75"
|
||||||
|
type="checkbox"
|
||||||
|
id="editconfig-verifyofflinecache"
|
||||||
|
/>
|
||||||
|
<label for="editconfig-offlinecachelocation"
|
||||||
|
>Select Offline Cache Location:</label
|
||||||
|
><input
|
||||||
|
class="form-control form-row w-75"
|
||||||
|
id="editconfig-offlinecachelocation"
|
||||||
|
type="text"
|
||||||
|
oninput="validateCacheLocation()"
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button
|
||||||
|
class="btn btn-primary border rounded border-primary btn-danger border-danger"
|
||||||
|
id="editconfig-cancel"
|
||||||
|
type="button"
|
||||||
|
data-dismiss="modal"
|
||||||
|
>
|
||||||
|
Cancel</button
|
||||||
|
><button
|
||||||
|
class="btn btn-primary border rounded border-primary btn-success border-success"
|
||||||
|
id="editconfig-savebutton"
|
||||||
|
type="submit"
|
||||||
|
data-dismiss="modal"
|
||||||
|
form="editconfig-form"
|
||||||
|
onclick="editConfig();"
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="modal fade"
|
||||||
|
role="dialog"
|
||||||
|
tabindex="-1"
|
||||||
|
id="of-editcacheconfigmodal"
|
||||||
|
>
|
||||||
|
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">Edit Game Builds</h4>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="close"
|
||||||
|
data-dismiss="modal"
|
||||||
|
aria-label="Close"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div
|
||||||
|
class="row row-cols-2 d-xl-flex justify-content-center justify-content-xl-start"
|
||||||
|
id="of-versionbuttons"
|
||||||
|
style="padding-bottom: 16px"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="col-4 text-left d-inline-flex justify-content-xl-start"
|
||||||
|
id="cache-buttons"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
class="btn btn-success mr-1"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-bs-tooltip=""
|
||||||
|
data-placement="bottom"
|
||||||
|
id="of-addversion-button"
|
||||||
|
type="button"
|
||||||
|
title="Add Version"
|
||||||
|
data-target="#of-addversionmodal"
|
||||||
|
onclick="deselectVersion()"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-primary mr-1 disabled"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-bs-tooltip=""
|
||||||
|
data-placement="bottom"
|
||||||
|
id="of-editversion-button"
|
||||||
|
type="button"
|
||||||
|
title="Edit Version"
|
||||||
|
data-target="#of-editversionmodal"
|
||||||
|
disabled=""
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-danger mr-1 disabled"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-bs-tooltip=""
|
||||||
|
data-placement="bottom"
|
||||||
|
id="of-deleteversion-button"
|
||||||
|
type="button"
|
||||||
|
title="Delete Version"
|
||||||
|
data-target="#of-deleteversionmodal"
|
||||||
|
disabled=""
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash-alt"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="table-responsive text-center border rounded border-primary"
|
||||||
|
id="cache-table"
|
||||||
|
>
|
||||||
|
<table class="table table-striped table-hover mb-0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Game Version</th>
|
||||||
|
<th>Game Cache</th>
|
||||||
|
<th>Offline Cache</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="cache-tablebody">
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="modal fade"
|
||||||
|
role="dialog"
|
||||||
|
tabindex="-1"
|
||||||
|
id="of-addversionmodal"
|
||||||
|
>
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">Add Server</h4>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="close"
|
||||||
|
data-dismiss="modal"
|
||||||
|
aria-label="Close"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="addversion-form" class="needs-validation">
|
||||||
|
<label for="addversion-nameinput"
|
||||||
|
>Version Name</label
|
||||||
|
><input
|
||||||
|
class="form-control form-row w-75"
|
||||||
|
type="text"
|
||||||
|
id="addversion-nameinput"
|
||||||
|
placeholder="custom-build-000"
|
||||||
|
required=""
|
||||||
|
pattern="^[-a-zA-Z0-9_]{1,70}$"
|
||||||
|
oninput="validateVersionSave('add')"
|
||||||
|
/><label for="addversion-urlinput"
|
||||||
|
>Version URL</label
|
||||||
|
><input
|
||||||
|
class="form-control form-row w-75"
|
||||||
|
type="text"
|
||||||
|
id="addversion-urlinput"
|
||||||
|
placeholder="http://cdn.dexlabs.systems/custom-build-000/"
|
||||||
|
required=""
|
||||||
|
pattern="^(https?|file):\/\/\/?([-a-zA-Z0-9@:%._\+~#= ]{1,256}\/){1,64}$"
|
||||||
|
oninput="validateVersionSave('add')"
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button
|
||||||
|
class="btn btn-primary border rounded border-primary btn-danger border-danger"
|
||||||
|
id="addversion-cancel"
|
||||||
|
type="button"
|
||||||
|
data-dismiss="modal"
|
||||||
|
>
|
||||||
|
Cancel</button
|
||||||
|
><button
|
||||||
|
class="btn btn-primary border rounded border-primary btn-success border-success"
|
||||||
|
id="addversion-savebutton"
|
||||||
|
type="submit"
|
||||||
|
data-dismiss="modal"
|
||||||
|
form="addversion-form"
|
||||||
|
onclick="addVersion();"
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="modal fade"
|
||||||
|
role="dialog"
|
||||||
|
tabindex="-1"
|
||||||
|
id="of-editversionmodal"
|
||||||
|
>
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">Edit Version</h4>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="close"
|
||||||
|
data-dismiss="modal"
|
||||||
|
aria-label="Close"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="editversion-form" class="needs-validation">
|
||||||
|
<label for="editversion-nameinput"
|
||||||
|
>Version Name</label
|
||||||
|
><input
|
||||||
|
class="form-control form-row w-75"
|
||||||
|
type="text"
|
||||||
|
id="editversion-nameinput"
|
||||||
|
placeholder="custom-build-000"
|
||||||
|
required=""
|
||||||
|
pattern="^[-a-zA-Z0-9_]{1,70}$"
|
||||||
|
oninput="validateVersionSave('edit')"
|
||||||
|
/><label for="editversion-urlinput"
|
||||||
|
>Version URL</label
|
||||||
|
><input
|
||||||
|
class="form-control form-row w-75"
|
||||||
|
type="text"
|
||||||
|
id="editversion-urlinput"
|
||||||
|
placeholder="http://cdn.dexlabs.systems/custom-build-000/"
|
||||||
|
required=""
|
||||||
|
pattern="^(https?|file):\/\/\/?([-a-zA-Z0-9@:%._\+~#= ]{1,256}\/){1,64}$"
|
||||||
|
oninput="validateVersionSave('edit')"
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button
|
||||||
|
class="btn btn-primary border rounded border-primary btn-danger border-danger"
|
||||||
|
id="editversion-cancel"
|
||||||
|
type="button"
|
||||||
|
data-dismiss="modal"
|
||||||
|
>
|
||||||
|
Cancel</button
|
||||||
|
><button
|
||||||
|
class="btn btn-primary border rounded border-primary btn-success border-success"
|
||||||
|
id="editversion-savebutton"
|
||||||
|
type="submit"
|
||||||
|
data-dismiss="modal"
|
||||||
|
form="editversion-form"
|
||||||
|
onclick="editVersion();"
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="modal fade"
|
||||||
|
role="dialog"
|
||||||
|
tabindex="-1"
|
||||||
|
id="of-deleteversionmodal"
|
||||||
|
>
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">Are you sure?</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="lead">
|
||||||
|
Do you really want to delete<br />"<a
|
||||||
|
id="deleteversion-versionname"
|
||||||
|
>VERSION_NAME</a
|
||||||
|
>"?<br /><br />You could always re-add it later.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button
|
||||||
|
class="btn btn-primary border rounded border-primary"
|
||||||
|
type="button"
|
||||||
|
data-dismiss="modal"
|
||||||
|
>
|
||||||
|
Cancel</button
|
||||||
|
><button
|
||||||
|
class="btn btn-primary border rounded border-primary btn-danger border-danger"
|
||||||
|
id="deleteversion-button"
|
||||||
|
type="button"
|
||||||
|
data-dismiss="modal"
|
||||||
|
onclick="deleteVersion();"
|
||||||
|
>
|
||||||
|
Yes, Delete
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="modal fade"
|
||||||
|
role="dialog"
|
||||||
|
tabindex="-1"
|
||||||
|
id="of-restoreversionsmodal"
|
||||||
|
>
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">Are you sure?</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="lead">
|
||||||
|
Do you really want to restore the default
|
||||||
|
versions?
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button
|
||||||
|
class="btn btn-primary border rounded border-primary"
|
||||||
|
type="button"
|
||||||
|
data-dismiss="modal"
|
||||||
|
>
|
||||||
|
Cancel</button
|
||||||
|
><button
|
||||||
|
class="btn btn-primary border rounded border-primary btn-danger border-danger"
|
||||||
|
id="restoreversions-button"
|
||||||
|
type="button"
|
||||||
|
data-dismiss="modal"
|
||||||
|
onclick="restoreDefaultVersions();"
|
||||||
|
>
|
||||||
|
Yes, Restore
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="of-versionnumberdiv">
|
<div id="of-versionnumberdiv">
|
||||||
<a
|
<a
|
||||||
id="of-versionnumber"
|
id="of-versionnumber"
|
||||||
@@ -459,28 +888,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<div
|
<div id="client"></div>
|
||||||
id="client"
|
|
||||||
style="
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background: #000;
|
|
||||||
clear: both;
|
|
||||||
"
|
|
||||||
></div>
|
|
||||||
</section>
|
</section>
|
||||||
<script
|
<script
|
||||||
src="assets/js/jquery.min.js"
|
src="assets/js/jquery.min.js"
|
||||||
onload="window.$ = window.jQuery = module.exports;"
|
onload="window.$ = window.jQuery = module.exports;"
|
||||||
></script>
|
></script>
|
||||||
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
<script src="assets/js/bootstrap.min.js"></script>
|
||||||
<script src="assets/js/bs-init.js"></script>
|
<script src="assets/js/bs-init.js"></script>
|
||||||
<script src="assets/js/uuidv4.min.js"></script>
|
<script src="assets/js/uuidv4.min.js"></script>
|
||||||
<script src="assets/js/serverselector.js"></script>
|
<script src="assets/js/server-selector.js"></script>
|
||||||
<script src="assets/js/gameclient.js"></script>
|
<script src="assets/js/game-client.js"></script>
|
||||||
<script src="assets/js/snowflakes.min.js"></script>
|
<script src="assets/js/snowflakes.min.js"></script>
|
||||||
<script src="assets/js/eastereggs.js"></script>
|
<script src="assets/js/easter-eggs.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
186
index.js
@@ -1,108 +1,59 @@
|
|||||||
var app = require("app"); // Module to control application life.
|
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 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 mainWindow = null;
|
||||||
|
|
||||||
app.commandLine.appendSwitch("--enable-npapi");
|
var unityHomeDir = path.join(__dirname, "../../WebPlayer");
|
||||||
|
// If running in non-packaged / development mode, this dir will be slightly different
|
||||||
function verifyUnity() {
|
if (process.env.npm_node_execpath) {
|
||||||
var dllpath =
|
unityHomeDir = path.join(app.getAppPath(), "/build/WebPlayer");
|
||||||
app.getPath("appData") +
|
|
||||||
"\\..\\LocalLow\\Unity\\WebPlayer\\player\\fusion-2.x.x\\webplayer_win.dll";
|
|
||||||
|
|
||||||
if (fs.existsSync(dllpath)) {
|
|
||||||
var buff = fs.readFileSync(dllpath);
|
|
||||||
var hash = require("crypto")
|
|
||||||
.createHash("md5")
|
|
||||||
.update(buff)
|
|
||||||
.digest("hex");
|
|
||||||
if (hash == "e5028405b4483de9e5e5fe9cd5f1e98f") {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function installUnity(callback) {
|
process.env["UNITY_HOME_DIR"] = unityHomeDir;
|
||||||
var utilsdir = __dirname + "\\..\\..\\utils";
|
process.env["UNITY_DISABLE_PLUGIN_UPDATES"] = "yes";
|
||||||
|
|
||||||
// if running in non-packaged / development mode, this dir will be slightly different
|
app.commandLine.appendSwitch("enable-npapi");
|
||||||
if (process.env.npm_node_execpath) {
|
app.commandLine.appendSwitch(
|
||||||
utilsdir = app.getAppPath() + "\\build\\utils";
|
"load-plugin",
|
||||||
}
|
path.join(unityHomeDir, "/loader/npUnity3D32.dll")
|
||||||
|
);
|
||||||
|
app.commandLine.appendSwitch("no-proxy-server");
|
||||||
|
|
||||||
// run the installer silently
|
var userData = app.getPath("userData");
|
||||||
var child = require("child_process").spawn(
|
var configPath = path.join(userData, "config.json");
|
||||||
utilsdir + "\\UnityWebPlayer.exe",
|
var serversPath = path.join(userData, "servers.json");
|
||||||
["/quiet", "/S"]
|
var versionsPath = path.join(userData, "versions.json");
|
||||||
);
|
var hashPath = path.join(userData, "hashes.json");
|
||||||
child.on("exit", function () {
|
|
||||||
// overwrite 3.5.2 loader/player with FF's custom version
|
|
||||||
var dstfolder =
|
|
||||||
app.getPath("appData") + "..\\LocalLow\\Unity\\WebPlayer";
|
|
||||||
fs.copySync(utilsdir + "\\WebPlayer", dstfolder, {
|
|
||||||
clobber: true,
|
|
||||||
});
|
|
||||||
// avoids error reporter popping up when closing Electron
|
|
||||||
fs.removeSync(dstfolder + "\\UnityBugReporter.exe");
|
|
||||||
console.log("Unity Web Player installed successfully.");
|
|
||||||
callback();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function initialSetup(firstTime) {
|
function initialSetup(firstTime) {
|
||||||
// Display a small window to inform the user that the app is working
|
if (!firstTime) {
|
||||||
setupWindow = new BrowserWindow({
|
// Migration from pre-1.6
|
||||||
width: 275,
|
// Back everything up, just in case
|
||||||
height: 450,
|
fs.copySync(configPath, configPath + ".bak");
|
||||||
resizable: false,
|
fs.copySync(serversPath, serversPath + ".bak");
|
||||||
center: true,
|
fs.copySync(versionsPath, versionsPath + ".bak");
|
||||||
frame: false,
|
fs.copySync(hashPath, hashPath + ".bak");
|
||||||
});
|
} else {
|
||||||
setupWindow.loadUrl("file://" + __dirname + "/initialsetup.html");
|
// First-time setup
|
||||||
installUnity(function () {
|
// Copy default servers
|
||||||
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(
|
fs.copySync(
|
||||||
__dirname + "\\defaults\\versions.json",
|
path.join(__dirname, "/defaults/servers.json"),
|
||||||
app.getPath("userData") + "\\versions.json"
|
serversPath
|
||||||
);
|
|
||||||
fs.copySync(
|
|
||||||
__dirname + "\\defaults\\config.json",
|
|
||||||
app.getPath("userData") + "\\config.json"
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
console.log("JSON files copied.");
|
// Copy default versions and config
|
||||||
setupWindow.destroy();
|
fs.copySync(path.join(__dirname, "/defaults/versions.json"), versionsPath);
|
||||||
showMainWindow();
|
fs.copySync(path.join(__dirname, "/defaults/config.json"), configPath);
|
||||||
});
|
fs.copySync(path.join(__dirname, "/defaults/hashes.json"), hashPath);
|
||||||
|
|
||||||
|
console.log("JSON files copied.");
|
||||||
|
showMainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc.on("exit", function (id) {
|
ipc.on("exit", function (id) {
|
||||||
@@ -116,50 +67,50 @@ app.on("window-all-closed", function () {
|
|||||||
|
|
||||||
app.on("ready", function () {
|
app.on("ready", function () {
|
||||||
// Check just in case the user forgot to extract the zip.
|
// Check just in case the user forgot to extract the zip.
|
||||||
zip_check = app.getPath("exe").includes(os.tmpdir());
|
zipCheck = app.getPath("exe").includes(os.tmpdir());
|
||||||
if (zip_check) {
|
if (zipCheck) {
|
||||||
errormsg =
|
var errorMessage =
|
||||||
"It has been detected that OpenFusionClient is running from the TEMP folder.\n\n" +
|
"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.";
|
"Please extract the entire Client folder to a location of your choice before starting OpenFusionClient.";
|
||||||
dialog.showErrorBox("Error!", errormsg);
|
dialog.showErrorBox("Error!", errorMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 1280,
|
width: 1280,
|
||||||
height: 720,
|
height: 720,
|
||||||
show: false,
|
show: false,
|
||||||
"web-preferences": { plugins: true },
|
"web-preferences": {
|
||||||
|
plugins: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
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(configPath)) {
|
if (!fs.existsSync(configPath)) {
|
||||||
console.log("Config file not found. Running initial setup.");
|
console.log("Config file not found. Running initial setup.");
|
||||||
initialSetup(true);
|
initialSetup(true);
|
||||||
} else {
|
} else {
|
||||||
var config = fs.readJsonSync(configPath);
|
var config = fs.readJsonSync(configPath);
|
||||||
if (!config["last-version-initialized"]) {
|
if (config["last-version-initialized"] !== "1.6") {
|
||||||
console.log("Pre-1.4 config detected. Running migration.");
|
console.log("Pre-1.6 config detected. Running migration.");
|
||||||
initialSetup(false);
|
initialSetup(false);
|
||||||
} else {
|
} else {
|
||||||
if (verifyUnity()) {
|
showMainWindow();
|
||||||
showMainWindow();
|
|
||||||
} else {
|
|
||||||
installUnity(showMainWindow);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.log("An error occurred while checking for the config");
|
dialog.showErrorBox(
|
||||||
|
"Error!",
|
||||||
|
"An error occurred while checking for the config. Make sure you have sufficent permissions."
|
||||||
|
);
|
||||||
|
app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Makes it so external links are opened in the system browser, not Electron
|
// Makes it so external links are opened in the system browser, not Electron
|
||||||
mainWindow.webContents.on("new-window", function (e, url) {
|
mainWindow.webContents.on("new-window", function (event, url) {
|
||||||
e.preventDefault();
|
event.preventDefault();
|
||||||
require("shell").openExternal(url);
|
require("shell").openExternal(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -180,22 +131,27 @@ function showMainWindow() {
|
|||||||
mainWindow.webContents.executeJavaScript("loadConfig();");
|
mainWindow.webContents.executeJavaScript("loadConfig();");
|
||||||
mainWindow.webContents.executeJavaScript("loadGameVersions();");
|
mainWindow.webContents.executeJavaScript("loadGameVersions();");
|
||||||
mainWindow.webContents.executeJavaScript("loadServerList();");
|
mainWindow.webContents.executeJavaScript("loadServerList();");
|
||||||
|
mainWindow.webContents.executeJavaScript("loadCacheList();");
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.webContents.on("plugin-crashed", function () {
|
mainWindow.webContents.on("plugin-crashed", function () {
|
||||||
console.log("Unity Web Player crashed.");
|
var errorMessage =
|
||||||
|
"Unity Web Player has crashed - please re-open the application.\n" +
|
||||||
|
"If this error persists, please read the FAQ or ask for support in our Discord server.";
|
||||||
|
dialog.showErrorBox("Error!", errorMessage);
|
||||||
|
mainWindow.destroy();
|
||||||
|
app.quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.webContents.on("will-navigate", function (evt, url) {
|
mainWindow.webContents.on("will-navigate", function (event, url) {
|
||||||
evt.preventDefault();
|
event.preventDefault();
|
||||||
// TODO: showMessageBox rather than showErrorBox?
|
|
||||||
switch (url) {
|
switch (url) {
|
||||||
case "https://audience.fusionfall.com/ff/regWizard.do?_flowId=fusionfall-registration-flow":
|
case "https://audience.fusionfall.com/ff/regWizard.do?_flowId=fusionfall-registration-flow":
|
||||||
errormsg =
|
var errorMessage =
|
||||||
"The register page is currently unimplemented.\n\n" +
|
"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". ' +
|
'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!";
|
"Your account will then be automatically created on the server. \nBe sure to remember these details!";
|
||||||
dialog.showErrorBox("Sorry!", errormsg);
|
dialog.showErrorBox("Sorry!", errorMessage);
|
||||||
break;
|
break;
|
||||||
case "https://audience.fusionfall.com/ff/login.do":
|
case "https://audience.fusionfall.com/ff/login.do":
|
||||||
dialog.showErrorBox(
|
dialog.showErrorBox(
|
||||||
@@ -207,7 +163,7 @@ function showMainWindow() {
|
|||||||
require("shell").openExternal("https://discord.gg/DYavckB");
|
require("shell").openExternal("https://discord.gg/DYavckB");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mainWindow.webContents.loadURL(url);
|
mainWindow.loadUrl(url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
|
||||||
BIN
lib/cache_handler.exe
vendored
Executable file
84
package-lock.json
generated
@@ -1,16 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "OpenFusionClient",
|
"name": "OpenFusionClient",
|
||||||
"version": "1.4.0",
|
"version": "1.5.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "OpenFusionClient",
|
"name": "OpenFusionClient",
|
||||||
"version": "1.4.0",
|
"version": "1.5.2",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs-extra": "^0.30.0"
|
"fs-extra": "2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron-builder": "^22.14.13",
|
"electron-builder": "^22.14.13",
|
||||||
@@ -746,7 +746,8 @@
|
|||||||
"node_modules/balanced-match": {
|
"node_modules/balanced-match": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/base64-js": {
|
"node_modules/base64-js": {
|
||||||
"version": "1.5.1",
|
"version": "1.5.1",
|
||||||
@@ -830,6 +831,7 @@
|
|||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
@@ -1333,7 +1335,8 @@
|
|||||||
"node_modules/concat-map": {
|
"node_modules/concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/concat-stream": {
|
"node_modules/concat-stream": {
|
||||||
"version": "1.6.2",
|
"version": "1.6.2",
|
||||||
@@ -2021,15 +2024,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fs-extra": {
|
"node_modules/fs-extra": {
|
||||||
"version": "0.30.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.0.0.tgz",
|
||||||
"integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=",
|
"integrity": "sha512-DERmRq6uGnu7I4uFJiWQBe5pYy67v2oKowEi8jYA/52u/ZO9xXBP2HAGacD9Nus0UT/WhJFZTq8cWbxZqOHVUg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
"jsonfile": "^2.1.0",
|
"jsonfile": "^2.1.0"
|
||||||
"klaw": "^1.0.0",
|
|
||||||
"path-is-absolute": "^1.0.0",
|
|
||||||
"rimraf": "^2.2.8"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fs-extra/node_modules/jsonfile": {
|
"node_modules/fs-extra/node_modules/jsonfile": {
|
||||||
@@ -2095,6 +2095,7 @@
|
|||||||
"version": "6.0.4",
|
"version": "6.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz",
|
||||||
"integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=",
|
"integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"inflight": "^1.0.4",
|
"inflight": "^1.0.4",
|
||||||
"inherits": "2",
|
"inherits": "2",
|
||||||
@@ -2406,6 +2407,7 @@
|
|||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"once": "^1.3.0",
|
"once": "^1.3.0",
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
@@ -2414,7 +2416,8 @@
|
|||||||
"node_modules/inherits": {
|
"node_modules/inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/ini": {
|
"node_modules/ini": {
|
||||||
"version": "1.3.8",
|
"version": "1.3.8",
|
||||||
@@ -2711,14 +2714,6 @@
|
|||||||
"json-buffer": "3.0.0"
|
"json-buffer": "3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/klaw": {
|
|
||||||
"version": "1.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz",
|
|
||||||
"integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=",
|
|
||||||
"optionalDependencies": {
|
|
||||||
"graceful-fs": "^4.1.9"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/klaw-sync": {
|
"node_modules/klaw-sync": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz",
|
||||||
@@ -2915,6 +2910,7 @@
|
|||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
},
|
},
|
||||||
@@ -3052,6 +3048,7 @@
|
|||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
@@ -3215,6 +3212,7 @@
|
|||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@@ -3603,6 +3601,7 @@
|
|||||||
"version": "2.4.5",
|
"version": "2.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz",
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz",
|
||||||
"integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=",
|
"integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"glob": "^6.0.1"
|
"glob": "^6.0.1"
|
||||||
},
|
},
|
||||||
@@ -4379,7 +4378,8 @@
|
|||||||
"node_modules/wrappy": {
|
"node_modules/wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/write-file-atomic": {
|
"node_modules/write-file-atomic": {
|
||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
@@ -5049,7 +5049,8 @@
|
|||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"base64-js": {
|
"base64-js": {
|
||||||
"version": "1.5.1",
|
"version": "1.5.1",
|
||||||
@@ -5109,6 +5110,7 @@
|
|||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
@@ -5485,7 +5487,8 @@
|
|||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"concat-stream": {
|
"concat-stream": {
|
||||||
"version": "1.6.2",
|
"version": "1.6.2",
|
||||||
@@ -6054,15 +6057,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fs-extra": {
|
"fs-extra": {
|
||||||
"version": "0.30.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.0.0.tgz",
|
||||||
"integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=",
|
"integrity": "sha512-DERmRq6uGnu7I4uFJiWQBe5pYy67v2oKowEi8jYA/52u/ZO9xXBP2HAGacD9Nus0UT/WhJFZTq8cWbxZqOHVUg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
"jsonfile": "^2.1.0",
|
"jsonfile": "^2.1.0"
|
||||||
"klaw": "^1.0.0",
|
|
||||||
"path-is-absolute": "^1.0.0",
|
|
||||||
"rimraf": "^2.2.8"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jsonfile": {
|
"jsonfile": {
|
||||||
@@ -6121,6 +6121,7 @@
|
|||||||
"version": "6.0.4",
|
"version": "6.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz",
|
||||||
"integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=",
|
"integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"inflight": "^1.0.4",
|
"inflight": "^1.0.4",
|
||||||
"inherits": "2",
|
"inherits": "2",
|
||||||
@@ -6349,6 +6350,7 @@
|
|||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"once": "^1.3.0",
|
"once": "^1.3.0",
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
@@ -6357,7 +6359,8 @@
|
|||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.8",
|
"version": "1.3.8",
|
||||||
@@ -6580,14 +6583,6 @@
|
|||||||
"json-buffer": "3.0.0"
|
"json-buffer": "3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"klaw": {
|
|
||||||
"version": "1.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz",
|
|
||||||
"integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=",
|
|
||||||
"requires": {
|
|
||||||
"graceful-fs": "^4.1.9"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"klaw-sync": {
|
"klaw-sync": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz",
|
||||||
@@ -6738,6 +6733,7 @@
|
|||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
@@ -6848,6 +6844,7 @@
|
|||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
@@ -6971,7 +6968,8 @@
|
|||||||
"path-is-absolute": {
|
"path-is-absolute": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"path-key": {
|
"path-key": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
@@ -7272,6 +7270,7 @@
|
|||||||
"version": "2.4.5",
|
"version": "2.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz",
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz",
|
||||||
"integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=",
|
"integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"glob": "^6.0.1"
|
"glob": "^6.0.1"
|
||||||
}
|
}
|
||||||
@@ -7882,7 +7881,8 @@
|
|||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"write-file-atomic": {
|
"write-file-atomic": {
|
||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
|
|||||||
18
package.json
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "OpenFusionClient",
|
"name": "OpenFusionClient",
|
||||||
"version": "1.4.1",
|
"version": "1.5.2",
|
||||||
"description": "OpenFusionClient",
|
"description": "OpenFusionClient",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "npx patch-package && npm explore electron-prebuilt -- npm run postinstall",
|
"postinstall": "npx patch-package && npm explore electron-prebuilt -- npm run postinstall",
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"pack": "electron-builder --win --ia32 --dir",
|
"pack": "electron-builder --win --ia32 --dir",
|
||||||
"dist": "electron-builder --win --ia32",
|
"dist": "electron-builder --win --ia32 --publish=never",
|
||||||
"prettier": "npx prettier --write ."
|
"prettier": "npx prettier --write ."
|
||||||
},
|
},
|
||||||
"author": "OpenFusion Contributors",
|
"author": "OpenFusion Contributors",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/OpenFusionProject/Client.git"
|
"url": "https://github.com/OpenFusionProject/OpenFusionClient.git"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"appId": "xyz.openfusion.client",
|
"appId": "xyz.openfusion.client",
|
||||||
@@ -63,13 +63,17 @@
|
|||||||
"extraFiles": [
|
"extraFiles": [
|
||||||
"LICENSE.md",
|
"LICENSE.md",
|
||||||
{
|
{
|
||||||
"from": "build/utils",
|
"from": "build/OpenFusionClient.exe.manifest",
|
||||||
"to": "utils"
|
"to": "OpenFusionClient.exe.manifest"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": "build/WebPlayer",
|
||||||
|
"to": "WebPlayer"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"afterPack": "./build/afterpack.js"
|
"afterPack": "./build/after-pack.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs-extra": "^0.30.0"
|
"fs-extra": "2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||