8 Commits

Author SHA1 Message Date
CakeLancelot
d4a1ecebc7 Fix version comparison 2024-10-07 01:28:29 -05:00
CakeLancelot
323b5a3385 Make autoupdater flash graphic unselectable via tab 2024-10-06 15:36:37 -05:00
CakeLancelot
c898cacd7c Automatic update checking and CSS adjustments 2024-10-06 14:06:46 -05:00
CakeLancelot
e5b20f57ce Enable offline caches by default 2024-10-05 21:07:49 -05:00
CakeLancelot
1eee35b230 Add browse button to cache path input and refine validation logic 2024-10-05 20:59:13 -05:00
CakeLancelot
d8363b61a6 Fix copy/paste error on modal title 2024-10-05 17:29:07 -05:00
CakeLancelot
6239f383bc Bump version number 2024-10-05 16:16:02 -05:00
CakeLancelot
19e036ddf9 Change version text to button, move config button to opposing corner 2024-09-23 18:12:42 -05:00
7 changed files with 205 additions and 69 deletions

View File

@@ -59,12 +59,24 @@ body {
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}
#of-versionnumberdiv {
#of-about-button-div {
position: fixed;
bottom: 4px;
right: 8px;
}
#of-about-flash-div {
position: fixed;
bottom: 4px;
right: 8px;
}
#of-config-button-div {
position: fixed;
bottom: 4px;
left: 8px;
}
.btn-primary {
background-image: url("../../assets/img/btn-primary-bg.png");
background-repeat: repeat;
@@ -85,6 +97,18 @@ body {
background-repeat: repeat;
}
.form-check-input {
width: 25px;
height: 25px;
}
.form-check-label {
height: 25px;
margin-top: 5px;
margin-left: 10px;
font-size: 1rem;
}
#of-aboutmodal > .modal-dialog > .modal-content {
background-color: #093363;
border-color: #6699ff;
@@ -186,3 +210,19 @@ button > i {
background: #000;
clear: both;
}
@keyframes pulse {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.pulsing {
animation: pulse 2s infinite;
}

View File

@@ -11,7 +11,7 @@ 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 offlineRootDefault = path.join(cacheRoot, "../OfflineCache");
var offlineRoot = offlineRootDefault;
var cdnString = "http://cdn.dexlabs.systems/ff/big";
@@ -78,7 +78,36 @@ function getAppVersion() {
function setAppVersionText() {
$("#of-aboutversionnumber").text("Version " + getAppVersion());
$("#of-versionnumber").text("v" + getAppVersion());
}
function checkForNewAppVersion() {
$("#of-about-button").removeClass("pulsing");
setAppVersionText();
if (config["autoupdate-check"] === true) {
$.getJSON(
"https://api.github.com/repos/OpenFusionProject/OpenFusionClient/releases/latest",
{},
function (data) {
$.each(data, function (index, element) {
if (index === "tag_name" && element != remote.require("app").getVersion()) {
console.log("New version available: " + element);
var downloadPage =
"https://github.com/OpenFusionProject/OpenFusionClient/releases/latest";
$("#of-aboutversionnumber").html(
"Version " +
getAppVersion() +
`<br>A new version is available! ` +
`Click <a href="#" onclick='remote.require("shell").openExternal("` +
downloadPage +
`");'>here</a> to download.`
);
$("#of-about-button").addClass("pulsing");
return false; // break out of loop early
}
});
}
);
}
}
function validateServerSave(modalName) {
@@ -329,13 +358,22 @@ function editConfig() {
function validateCacheLocation() {
var input = document.getElementById("editconfig-offlinecachelocation");
var button = document.getElementById("editconfig-savebutton");
var parent = path.join(input.value, "/..");
input.classList.remove("invalidinput");
button.removeAttribute("disabled");
// Parent MUST exist and be a directory
// If the target exists, check that is also a directory
// Also, prevent putting the offline cache inside of
// the normal cache folder to prevent shenanigans
if (
!remotefs.existsSync(input.value) ||
!remotefs.statSync(input.value).isDirectory()
!remotefs.existsSync(parent) ||
!remotefs.statSync(parent).isDirectory() ||
(remotefs.existsSync(input.value) &&
!remotefs.statSync(input.value).isDirectory()) ||
path.join(input.value, ".") === path.join(cacheRoot, "/..") ||
path.join(input.value, ".").startsWith(path.join(cacheRoot))
) {
input.classList.add("invalidinput");
button.setAttribute("disabled", "");
@@ -374,6 +412,7 @@ function loadConfig() {
offlineRoot = config["offline-cache-location"] || offlineRootDefault;
$("#editconfig-offlinecachelocation:text").val(offlineRoot);
checkForNewAppVersion();
validateCacheLocation();
}
@@ -949,6 +988,17 @@ function prepConnection(address, port) {
launchGame();
}
function browseOfflineCache() {
var browsePath = dialog.showOpenDialog({ properties: ["openDirectory"] });
var offlineCacheInput = document.getElementById(
"editconfig-offlinecachelocation"
);
if (browsePath && offlineCacheInput) {
offlineCacheInput.value = browsePath;
validateCacheLocation();
}
}
// 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() {

View File

@@ -1,6 +1,6 @@
<?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" />
<assemblyIdentity type="win32" name="OpenFusion.Client" version="1.6.0.0" processorArchitecture="x86" />
<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*">

View File

@@ -1,7 +1,7 @@
{
"autoupdate-check": true,
"cache-swapping": true,
"enable-offline-cache": false,
"enable-offline-cache": true,
"verify-offline-cache": false,
"last-version-initialized": "1.6"
}

View File

@@ -108,18 +108,6 @@
</button>
</div>
<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"
@@ -183,6 +171,7 @@
data-target="#of-restoreserversmodal"
>Reset to Default Servers</a
>
<br />
<a
href="#of-restoreversionsmodal"
onclick="$('#of-aboutmodal').modal('toggle')"
@@ -501,46 +490,80 @@
</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"
/>
<form
id="editconfig-form"
class="needs-validation form-group"
>
<div class="form-check form-row">
<input
class="form-check-input"
type="checkbox"
id="editconfig-autoupdate"
/>
<label
class="form-check-label"
for="editconfig-autoupdate"
>Automatically check for updates</label
>
</div>
<div class="form-check form-row">
<input
class="form-check-input"
type="checkbox"
id="editconfig-cacheswapping"
/>
<label
class="form-check-label"
for="editconfig-cacheswapping"
>Swap game caches to avoid unnecessary
downloads</label
>
</div>
<div class="form-check form-row">
<input
class="form-check-input"
type="checkbox"
id="editconfig-enableofflinecache"
/>
<label
class="form-check-label"
for="editconfig-enableofflinecache"
>Use offline caches when they are
available</label
>
</div>
<div class="form-check form-row mb-3">
<input
class="form-check-input"
type="checkbox"
id="editconfig-verifyofflinecache"
/>
<label
class="form-check-label"
for="editconfig-verifyofflinecache"
>Verify offline caches every time they
are loaded</label
>
</div>
<label for="editconfig-offlinecachelocation"
>Select Offline Cache Location:</label
><input
class="form-control form-row w-75"
id="editconfig-offlinecachelocation"
type="text"
oninput="validateCacheLocation()"
/>
><h5>Offline Cache Location:</h5></label
>
<div class="form-row">
<input
class="form-control w-75"
id="editconfig-offlinecachelocation"
type="text"
oninput="validateCacheLocation()"
/>
<button
type="button"
class="btn btn-primary ml-1"
onclick="browseOfflineCache()"
title="Browse"
>
<i class="fas fa-folder"></i>
</button>
</div>
</form>
</div>
<div class="modal-footer">
@@ -668,7 +691,7 @@
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Add Server</h4>
<h4 class="modal-title">Add Version</h4>
<button
type="button"
class="close"
@@ -886,15 +909,38 @@
</div>
</div>
</div>
<div id="of-versionnumberdiv">
<a
id="of-versionnumber"
class="text-monospace text-secondary"
href="#of-aboutmodal"
<div id="of-config-button-div">
<button
class="btn btn-primary mr-1"
data-toggle="modal"
data-target="#of-aboutmodal"
>v0</a
data-bs-tooltip=""
data-placement="right"
id="of-editconfig-button"
type="button"
title="Edit Configuration"
data-target="#of-editconfigmodal"
>
<i class="fas fa-cog"></i>
</button>
</div>
<div id="of-about-button-div">
<button
class="btn btn-primary mr-1"
data-toggle="modal"
data-bs-tooltip=""
data-placement="left"
id="of-about-button"
type="button"
title="About OpenFusionClient"
data-target="#of-aboutmodal"
>
<i class="fas fa-info-circle"></i>
</button>
</div>
<div id="of-about-flash-div" style="z-index: -1">
<button class="btn btn-warning mr-1" tabindex="-1" type="button">
<i class="fas fa-info-circle"></i>
</button>
</div>
</section>
<section>

4
package-lock.json generated
View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "OpenFusionClient",
"version": "1.5.2",
"version": "1.6.0",
"description": "OpenFusionClient",
"main": "index.js",
"scripts": {