mirror of
https://github.com/OpenFusionProject/Client.git
synced 2024-11-14 10:40:06 +00:00
WIP button functionality (download, delete)
This commit is contained in:
parent
b5ab9aad2d
commit
132b725922
@ -80,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;
|
||||||
@ -105,6 +110,11 @@ body {
|
|||||||
border-color: #6699ff;
|
border-color: #6699ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#of-editcacheconfigmodal > .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;
|
||||||
|
BIN
assets/img/btn-warning-bg.png
Normal file
BIN
assets/img/btn-warning-bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 514 B |
@ -2,13 +2,21 @@ var remote = require("remote");
|
|||||||
var remotefs = remote.require("fs-extra");
|
var remotefs = remote.require("fs-extra");
|
||||||
var dns = remote.require("dns");
|
var dns = remote.require("dns");
|
||||||
var path = remote.require("path");
|
var path = remote.require("path");
|
||||||
|
var url = remote.require("url");
|
||||||
|
var http = remote.require("http");
|
||||||
|
var createHash = remote.require("crypto").createHash;
|
||||||
|
|
||||||
var userData = remote.require("app").getPath("userData");
|
var userData = remote.require("app").getPath("userData");
|
||||||
var configPath = path.join(userData, "config.json");
|
var configPath = path.join(userData, "config.json");
|
||||||
var serversPath = path.join(userData, "servers.json");
|
var serversPath = path.join(userData, "servers.json");
|
||||||
var versionsPath = path.join(userData, "versions.json");
|
var versionsPath = path.join(userData, "versions.json");
|
||||||
|
|
||||||
|
var chunk_size = 1 << 16;
|
||||||
|
var gb = 1 << 30;
|
||||||
|
var cdn = "cdn.dexlabs.systems";
|
||||||
|
|
||||||
var versionArray;
|
var versionArray;
|
||||||
|
var versionHashes;
|
||||||
var serverArray;
|
var serverArray;
|
||||||
var config;
|
var config;
|
||||||
|
|
||||||
@ -158,6 +166,409 @@ function loadServerList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
var labelText = (sizes.intact / gb).toFixed(2) + " / " + (sizes.total / gb).toFixed(2) + " GB";
|
||||||
|
|
||||||
|
if (sizes.altered > 0) {
|
||||||
|
labelText += " (" + (sizes.altered / gb).toFixed(2) + " GB Altered)";
|
||||||
|
}
|
||||||
|
|
||||||
|
return labelText;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheInfoCell(versionString, cacheMode) {
|
||||||
|
var downloadFuncName = "download" + cacheMode.charAt(0).toUpperCase() + cacheMode.slice(1) + "Cache";
|
||||||
|
var deleteFuncName = "delete" + cacheMode.charAt(0).toUpperCase() + cacheMode.slice(1) + "Cache";
|
||||||
|
|
||||||
|
var divID = getCacheElemID(versionString, cacheMode, "div");
|
||||||
|
var labelID = getCacheElemID(versionString, cacheMode, "label");
|
||||||
|
|
||||||
|
var settings = {
|
||||||
|
download: {
|
||||||
|
fn: downloadFuncName,
|
||||||
|
icon: "fas fa-download",
|
||||||
|
class: "btn btn-success mr-1",
|
||||||
|
tooltip: "Download Cache"
|
||||||
|
},
|
||||||
|
fix: {
|
||||||
|
fn: downloadFuncName,
|
||||||
|
icon: "fas fa-hammer",
|
||||||
|
class: "btn btn-warning mr-1",
|
||||||
|
tooltip: "Fix Altered Files in Cache"
|
||||||
|
},
|
||||||
|
delete: {
|
||||||
|
fn: deleteFuncName,
|
||||||
|
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);
|
||||||
|
|
||||||
|
var divCacheButtons = document.createElement("div");
|
||||||
|
divCacheButtons.setAttribute("id", labelID);
|
||||||
|
|
||||||
|
$.each(settings, function (buttonMode, config) {
|
||||||
|
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");
|
||||||
|
buttonCache.setAttribute("onclick", config.fn + "(\"" + versionString + "\");");
|
||||||
|
buttonCache.appendChild(iconItalic);
|
||||||
|
|
||||||
|
divCacheButtons.appendChild(buttonCache);
|
||||||
|
});
|
||||||
|
|
||||||
|
divCacheAll.appendChild(labelCache);
|
||||||
|
divCacheAll.appendChild(divCacheButtons);
|
||||||
|
cellCache.appendChild(divCacheAll);
|
||||||
|
|
||||||
|
return cellCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFileHash(filePath) {
|
||||||
|
var totalReadCount = 0, readCount = 0;
|
||||||
|
var buff = new Buffer(chunk_size);
|
||||||
|
var hash = createHash("sha256");
|
||||||
|
var file = remotefs.openSync(filePath, "r");
|
||||||
|
|
||||||
|
while ((readCount = remotefs.readSync(file, buff, 0, chunk_size, totalReadCount)) > 0) {
|
||||||
|
totalReadCount += readCount;
|
||||||
|
hash.update(buff.slice(0, readCount));
|
||||||
|
}
|
||||||
|
|
||||||
|
remotefs.closeSync(file);
|
||||||
|
return hash.digest(encoding="hex");
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadFiles(root, client, sizes, hashes, updateCallback, endCallback) {
|
||||||
|
if (hashes.length === 0) {
|
||||||
|
endCallback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var filePath = Object.keys(hashes)[0];
|
||||||
|
var fileHash = hashes[filePath];
|
||||||
|
delete hashes[filePath];
|
||||||
|
|
||||||
|
var fullFilePath = path.join(root, filePath);
|
||||||
|
var fullCDNPath = ["http:/", cdn, "ff", "big", filePath].join("/");
|
||||||
|
|
||||||
|
if (remotefs.existsSync(fullFilePath) && fileHash === getFileHash(fullFilePath)) {
|
||||||
|
console.log(fullFilePath + " is intact, skipping...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadFile(client, fullCDNPath, fullFilePath, function () {
|
||||||
|
var sizeRead = remotefs.statSync(fullFilePath).size;
|
||||||
|
|
||||||
|
if (fileHash === getFileHash(fullFilePath)) {
|
||||||
|
sizes.intact += sizeRead;
|
||||||
|
} else {
|
||||||
|
sizes.altered += sizeRead;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(fullFilePath + " was downloaded from " + fullCDNPath);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
updateCallback(sizes);
|
||||||
|
downloadFiles(root, client, sizes, hashes, updateCallback, endCallback);
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadFile(client, fullCDNPath, fullFilePath, callback) {
|
||||||
|
remotefs.ensureDirSync(path.dirname(fullFilePath));
|
||||||
|
|
||||||
|
var urlParts = url.parse(fullCDNPath);
|
||||||
|
var req = client.request("GET", urlParts.path, {
|
||||||
|
"host": urlParts.hostname,
|
||||||
|
"Content-Type": "application/octet-stream"
|
||||||
|
});
|
||||||
|
var writeStream = remotefs.createWriteStream(fullFilePath);
|
||||||
|
|
||||||
|
var retry = function (err) {
|
||||||
|
writeStream.end();
|
||||||
|
writeStream.destroy();
|
||||||
|
|
||||||
|
remotefs.removeSync(fullFilePath);
|
||||||
|
|
||||||
|
console.log("Error writing file " + fullFilePath + "\n" + err);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
console.log("Retrying " + fullCDNPath);
|
||||||
|
downloadFile(client, fullCDNPath, fullFilePath, callback);
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
writeStream.on("error", retry);
|
||||||
|
|
||||||
|
req.on("response", function (res) {
|
||||||
|
if (res.statusCode !== 200) {
|
||||||
|
console.log("Error in fetching file " + fullFilePath + " from " + fullCDNPath);
|
||||||
|
retry("Status Code: " + res.statusCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res.pipe(writeStream);
|
||||||
|
|
||||||
|
res.on("end", callback);
|
||||||
|
res.on("error", retry);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on("error", retry);
|
||||||
|
|
||||||
|
req.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadCacheList() {
|
||||||
|
var versionjson = JSON.parse(
|
||||||
|
remotefs.readFileSync(path.join(userDir, "versions.json"))
|
||||||
|
);
|
||||||
|
versionArray = versionjson["versions"];
|
||||||
|
|
||||||
|
versionHashes = { playable: {}, offline: {} };
|
||||||
|
var hashlines = remotefs.readFileSync(path.join(userDir, "hash.txt"), "utf-8");
|
||||||
|
$.each(hashlines.split(/\r\n|\r|\n/), function (key, line) {
|
||||||
|
if (line.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var linearr = line.split(" ", 2);
|
||||||
|
var fileHash = linearr[0];
|
||||||
|
var filePath = linearr[1].substr(3);
|
||||||
|
var pathArray = filePath.split("/");
|
||||||
|
var hashDict = (pathArray[0] === "Offline") ?
|
||||||
|
versionHashes.offline :
|
||||||
|
versionHashes.playable;
|
||||||
|
var versionString = (pathArray[0] === "Offline") ?
|
||||||
|
pathArray[1] :
|
||||||
|
pathArray[0];
|
||||||
|
|
||||||
|
if (!hashDict.hasOwnProperty(versionString)) {
|
||||||
|
hashDict[versionString] = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
hashDict[versionString][filePath.replace("Offline/", "")] = fileHash;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".cache-listing-entry").remove();
|
||||||
|
|
||||||
|
$.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);
|
||||||
|
|
||||||
|
checkPlayableCache(value.name);
|
||||||
|
checkOfflineCache(value.name);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function deletePlayableCache(versionString) {
|
||||||
|
var cacheroot = path.join(userDir, "..", "..", "LocalLow", "Unity", "Web Player", "Cache");
|
||||||
|
|
||||||
|
resetCacheNames();
|
||||||
|
|
||||||
|
if (versionString === "Offline") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
remotefs.removeSync(path.join(cacheroot, versionString));
|
||||||
|
console.log("Playable cache " + versionString + " has been removed!");
|
||||||
|
|
||||||
|
checkPlayableCache(versionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadOfflineCache(versionString) {
|
||||||
|
var offlineroot = path.join(userDir, "..", "..", "LocalLow", "Unity", "Web Player", "Cache", "Offline");
|
||||||
|
|
||||||
|
var buttonDownload = document.getElementById(getCacheButtonID(versionString, "offline", "download"));
|
||||||
|
var buttonFix = document.getElementById(getCacheButtonID(versionString, "offline", "fix"));
|
||||||
|
var buttonDelete = document.getElementById(getCacheButtonID(versionString, "offline", "delete"));
|
||||||
|
var label = document.getElementById(getCacheElemID(versionString, "offline", "label"));
|
||||||
|
|
||||||
|
var sizes = {
|
||||||
|
intact: 0,
|
||||||
|
altered: 0,
|
||||||
|
total: versionArray.filter(function (value) {
|
||||||
|
return value.name === versionString;
|
||||||
|
})[0].offline_size
|
||||||
|
};
|
||||||
|
|
||||||
|
buttonDownload.setAttribute("disabled", "");
|
||||||
|
buttonFix.setAttribute("disabled", "");
|
||||||
|
buttonDelete.setAttribute("disabled", "");
|
||||||
|
|
||||||
|
buttonDownload.children[0].setAttribute("class", "fas fa-spinner fa-spin fa-fw");
|
||||||
|
buttonFix.children[0].setAttribute("class", "fas fa-spinner fa-spin fa-fw");
|
||||||
|
|
||||||
|
downloadFiles(
|
||||||
|
offlineroot,
|
||||||
|
http.createClient(80, cdn),
|
||||||
|
sizes,
|
||||||
|
JSON.parse(JSON.stringify(versionHashes.offline[versionString])),
|
||||||
|
function (sizesNow) {
|
||||||
|
label.innerHTML = getCacheLabelText(sizesNow);
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
buttonDownload.children[0].setAttribute("class", "fas fa-download");
|
||||||
|
buttonFix.children[0].setAttribute("class", "fas fa-hammer");
|
||||||
|
checkOfflineCache(versionString);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteOfflineCache(versionString) {
|
||||||
|
var offlineroot = path.join(userDir, "..", "..", "LocalLow", "Unity", "Web Player", "Cache", "Offline");
|
||||||
|
|
||||||
|
remotefs.removeSync(path.join(offlineroot, versionString));
|
||||||
|
console.log("Offline cache " + versionString + " has been removed!");
|
||||||
|
|
||||||
|
checkOfflineCache(versionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkPlayableCache(versionString) {
|
||||||
|
var cacheroot = path.join(userDir, "..", "..", "LocalLow", "Unity", "Web Player", "Cache");
|
||||||
|
|
||||||
|
var button = document.getElementById(getCacheButtonID(versionString, "playable", "delete"));
|
||||||
|
var label = document.getElementById(getCacheElemID(versionString, "playable", "label"));
|
||||||
|
|
||||||
|
var sizes = {
|
||||||
|
intact: 0,
|
||||||
|
altered: 0,
|
||||||
|
total: versionArray.filter(function (value) {
|
||||||
|
return value.name === versionString;
|
||||||
|
})[0].playable_size
|
||||||
|
};
|
||||||
|
|
||||||
|
resetCacheNames();
|
||||||
|
|
||||||
|
$.each(versionHashes.playable[versionString], function (filePath, fileHash) {
|
||||||
|
var fullFilePath = path.join(cacheroot, filePath);
|
||||||
|
|
||||||
|
if (remotefs.existsSync(fullFilePath)) {
|
||||||
|
var fileSize = remotefs.statSync(fullFilePath).size;
|
||||||
|
|
||||||
|
if (fileHash === getFileHash(fullFilePath)) {
|
||||||
|
sizes.intact += fileSize;
|
||||||
|
} else {
|
||||||
|
sizes.altered += fileSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (sizes.intact > 0 || sizes.altered > 0) {
|
||||||
|
button.removeAttribute("disabled");
|
||||||
|
} else {
|
||||||
|
button.setAttribute("disabled", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
label.innerHTML = getCacheLabelText(sizes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkOfflineCache(versionString) {
|
||||||
|
var offlineroot = path.join(userDir, "..", "..", "LocalLow", "Unity", "Web Player", "Cache", "Offline");
|
||||||
|
|
||||||
|
var buttonDownload = document.getElementById(getCacheButtonID(versionString, "offline", "download"));
|
||||||
|
var buttonFix = document.getElementById(getCacheButtonID(versionString, "offline", "fix"));
|
||||||
|
var buttonDelete = document.getElementById(getCacheButtonID(versionString, "offline", "delete"));
|
||||||
|
var label = document.getElementById(getCacheElemID(versionString, "offline", "label"));
|
||||||
|
|
||||||
|
var sizes = {
|
||||||
|
intact: 0,
|
||||||
|
altered: 0,
|
||||||
|
total: versionArray.filter(function (value) {
|
||||||
|
return value.name === versionString;
|
||||||
|
})[0].offline_size
|
||||||
|
};
|
||||||
|
|
||||||
|
$.each(versionHashes.offline[versionString], function (filePath, fileHash) {
|
||||||
|
var fullFilePath = path.join(offlineroot, filePath);
|
||||||
|
|
||||||
|
if (remotefs.existsSync(fullFilePath)) {
|
||||||
|
var fileSize = remotefs.statSync(fullFilePath).size;
|
||||||
|
|
||||||
|
if (fileHash === getFileHash(fullFilePath)) {
|
||||||
|
sizes.intact += fileSize;
|
||||||
|
} else {
|
||||||
|
sizes.altered += fileSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (sizes.intact > 0 || sizes.altered > 0) {
|
||||||
|
buttonDownload.setAttribute("disabled", "");
|
||||||
|
buttonDelete.removeAttribute("disabled");
|
||||||
|
} else {
|
||||||
|
buttonDownload.removeAttribute("disabled");
|
||||||
|
buttonDelete.setAttribute("disabled", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizes.altered > 0) {
|
||||||
|
buttonFix.removeAttribute("disabled");
|
||||||
|
} else {
|
||||||
|
buttonFix.setAttribute("disabled", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
label.innerHTML = getCacheLabelText(sizes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetCacheNames() {
|
||||||
|
var cacheroot = path.join(userDir, "..", "..", "LocalLow", "Unity", "Web Player", "Cache");
|
||||||
|
var currentcache = path.join(cacheroot, "Fusionfall");
|
||||||
|
var record = path.join(userDir, ".lastver");
|
||||||
|
|
||||||
|
if (!remotefs.existsSync(currentcache)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastversion = remotefs.readFileSync(record);
|
||||||
|
remotefs.renameSync(
|
||||||
|
currentcache,
|
||||||
|
path.join(cacheroot, lastversion)
|
||||||
|
);
|
||||||
|
console.log("Current cache " + lastversion + " has been renamed to its original name.");
|
||||||
|
}
|
||||||
|
|
||||||
function performCacheSwap(newVersion) {
|
function performCacheSwap(newVersion) {
|
||||||
var cacheRoot = path.join(
|
var cacheRoot = path.join(
|
||||||
userData,
|
userData,
|
||||||
|
35485
defaults/hash.txt
Normal file
35485
defaults/hash.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,107 +2,159 @@
|
|||||||
"versions": [
|
"versions": [
|
||||||
{
|
{
|
||||||
"name": "beta-20100104",
|
"name": "beta-20100104",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100104/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100104/",
|
||||||
|
"playable_size": 1898937430,
|
||||||
|
"offline_size": 498302868
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100119",
|
"name": "beta-20100119",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100119/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100119/",
|
||||||
|
"playable_size": 1962119814,
|
||||||
|
"offline_size": 532090781
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100207",
|
"name": "beta-20100207",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100207/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100207/",
|
||||||
|
"playable_size": 1915480756,
|
||||||
|
"offline_size": 517070093
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100307",
|
"name": "beta-20100307",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100307/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100307/",
|
||||||
|
"playable_size": 1944527727,
|
||||||
|
"offline_size": 523037304
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100322",
|
"name": "beta-20100322",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100322/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100322/",
|
||||||
|
"playable_size": 3667028290,
|
||||||
|
"offline_size": 990428569
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100413",
|
"name": "beta-20100413",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100413/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100413/",
|
||||||
|
"playable_size": 3686606449,
|
||||||
|
"offline_size": 993679155
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100502",
|
"name": "beta-20100502",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100502/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100502/",
|
||||||
|
"playable_size": 3707329381,
|
||||||
|
"offline_size": 998536709
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100524",
|
"name": "beta-20100524",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100524/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100524/",
|
||||||
|
"playable_size": 3728798955,
|
||||||
|
"offline_size": 1006498680
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100604",
|
"name": "beta-20100604",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100604/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100604/",
|
||||||
|
"playable_size": 3708507369,
|
||||||
|
"offline_size": 1000908158
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100616",
|
"name": "beta-20100616",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100616/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100616/",
|
||||||
|
"playable_size": 3727652532,
|
||||||
|
"offline_size": 1003244061
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100711",
|
"name": "beta-20100711",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100711/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100711/",
|
||||||
|
"playable_size": 3749781447,
|
||||||
|
"offline_size": 1008201089
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100728",
|
"name": "beta-20100728",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100728/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100728/",
|
||||||
|
"playable_size": 3743395312,
|
||||||
|
"offline_size": 1010622298
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20100909",
|
"name": "beta-20100909",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100909/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20100909/",
|
||||||
|
"playable_size": 3758419664,
|
||||||
|
"offline_size": 1013860677
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20101003",
|
"name": "beta-20101003",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20101003/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20101003/",
|
||||||
|
"playable_size": 3794257608,
|
||||||
|
"offline_size": 1021988749
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20101011",
|
"name": "beta-20101011",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20101011/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20101011/",
|
||||||
|
"playable_size": 3794587065,
|
||||||
|
"offline_size": 1022182478
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20101028",
|
"name": "beta-20101028",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20101028/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20101028/",
|
||||||
|
"playable_size": 3807285735,
|
||||||
|
"offline_size": 1025430139
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20101123",
|
"name": "beta-20101123",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20101123/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20101123/",
|
||||||
|
"playable_size": 3809454979,
|
||||||
|
"offline_size": 1026041690
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20110213",
|
"name": "beta-20110213",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110213/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110213/",
|
||||||
|
"playable_size": 2369514137,
|
||||||
|
"offline_size": 682125537
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20110314",
|
"name": "beta-20110314",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110314/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110314/",
|
||||||
|
"playable_size": 2379406501,
|
||||||
|
"offline_size": 686277543
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20110330",
|
"name": "beta-20110330",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110330/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110330/",
|
||||||
|
"playable_size": 2370387925,
|
||||||
|
"offline_size": 684674109
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20110424",
|
"name": "beta-20110424",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110424/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110424/",
|
||||||
|
"playable_size": 2420761667,
|
||||||
|
"offline_size": 697693210
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20110523",
|
"name": "beta-20110523",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110523/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110523/",
|
||||||
|
"playable_size": 2444366341,
|
||||||
|
"offline_size": 703101511
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20110725",
|
"name": "beta-20110725",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110725/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110725/",
|
||||||
|
"playable_size": 2487849562,
|
||||||
|
"offline_size": 717289102
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20110818",
|
"name": "beta-20110818",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110818/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110818/",
|
||||||
|
"playable_size": 2504425998,
|
||||||
|
"offline_size": 719058600
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20110912",
|
"name": "beta-20110912",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110912/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20110912/",
|
||||||
|
"playable_size": 2530956034,
|
||||||
|
"offline_size": 725201024
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beta-20111013",
|
"name": "beta-20111013",
|
||||||
"url": "http://cdn.dexlabs.systems/ff/big/beta-20111013/"
|
"url": "http://cdn.dexlabs.systems/ff/big/beta-20111013/",
|
||||||
|
"playable_size": 2541857744,
|
||||||
|
"offline_size": 729959117
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
51
index.html
51
index.html
@ -108,6 +108,18 @@
|
|||||||
</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-editcache-button"
|
||||||
|
type="button"
|
||||||
|
title="Edit Cache Storage"
|
||||||
|
data-target="#of-editcacheconfigmodal"
|
||||||
|
>
|
||||||
|
<i class="fas fa-cog"></i>
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
class="btn btn-primary disabled"
|
class="btn btn-primary disabled"
|
||||||
id="of-connect-button"
|
id="of-connect-button"
|
||||||
@ -443,6 +455,45 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="modal fade"
|
||||||
|
role="dialog"
|
||||||
|
id="of-editcacheconfigmodal"
|
||||||
|
>
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">Edit Cache Config</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="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 id="of-versionnumberdiv">
|
<div id="of-versionnumberdiv">
|
||||||
<a
|
<a
|
||||||
id="of-versionnumber"
|
id="of-versionnumber"
|
||||||
|
4
index.js
4
index.js
@ -28,6 +28,7 @@ var userData = app.getPath("userData");
|
|||||||
var configPath = path.join(userData, "config.json");
|
var configPath = path.join(userData, "config.json");
|
||||||
var serversPath = path.join(userData, "servers.json");
|
var serversPath = path.join(userData, "servers.json");
|
||||||
var versionsPath = path.join(userData, "versions.json");
|
var versionsPath = path.join(userData, "versions.json");
|
||||||
|
var hashPath = path.join(userData, "hash.txt");
|
||||||
|
|
||||||
function initialSetup(firstTime) {
|
function initialSetup(firstTime) {
|
||||||
if (!firstTime) {
|
if (!firstTime) {
|
||||||
@ -36,6 +37,7 @@ function initialSetup(firstTime) {
|
|||||||
fs.copySync(configPath, configPath + ".bak");
|
fs.copySync(configPath, configPath + ".bak");
|
||||||
fs.copySync(serversPath, serversPath + ".bak");
|
fs.copySync(serversPath, serversPath + ".bak");
|
||||||
fs.copySync(versionsPath, versionsPath + ".bak");
|
fs.copySync(versionsPath, versionsPath + ".bak");
|
||||||
|
fs.copySync(hashPath, hashPath + ".bak");
|
||||||
} else {
|
} else {
|
||||||
// First-time setup
|
// First-time setup
|
||||||
// Copy default servers
|
// Copy default servers
|
||||||
@ -48,6 +50,7 @@ function initialSetup(firstTime) {
|
|||||||
// Copy default versions and config
|
// Copy default versions and config
|
||||||
fs.copySync(path.join(__dirname, "/defaults/versions.json"), versionsPath);
|
fs.copySync(path.join(__dirname, "/defaults/versions.json"), versionsPath);
|
||||||
fs.copySync(path.join(__dirname, "/defaults/config.json"), configPath);
|
fs.copySync(path.join(__dirname, "/defaults/config.json"), configPath);
|
||||||
|
fs.copySync(path.join(__dirname, "/defaults/hash.txt"), hashPath);
|
||||||
|
|
||||||
console.log("JSON files copied.");
|
console.log("JSON files copied.");
|
||||||
showMainWindow();
|
showMainWindow();
|
||||||
@ -128,6 +131,7 @@ 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 () {
|
||||||
|
Loading…
Reference in New Issue
Block a user