red version for not matching
This commit is contained in:
@@ -16,6 +16,23 @@ const pluginsLink = document.getElementById("plugins-link");
|
|||||||
const rawServerListCheckbox = document.getElementById("raw-server-list");
|
const rawServerListCheckbox = document.getElementById("raw-server-list");
|
||||||
const serverUrlInput = document.getElementById("server-url");
|
const serverUrlInput = document.getElementById("server-url");
|
||||||
|
|
||||||
|
let currentServerVersion = null;
|
||||||
|
|
||||||
|
async function loadServerVersion() {
|
||||||
|
try {
|
||||||
|
const res = await fetch("/api/version", { credentials: "include" });
|
||||||
|
if (!res.ok) {
|
||||||
|
currentServerVersion = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const payload = await res.json();
|
||||||
|
const version = typeof payload?.version === "string" ? payload.version.trim() : "";
|
||||||
|
currentServerVersion = version || null;
|
||||||
|
} catch {
|
||||||
|
currentServerVersion = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getDefaultServerUrlPlaceholder(isRawList) {
|
function getDefaultServerUrlPlaceholder(isRawList) {
|
||||||
const isHttps = window.location.protocol === "https:";
|
const isHttps = window.location.protocol === "https:";
|
||||||
const host = window.location.host;
|
const host = window.location.host;
|
||||||
@@ -126,7 +143,8 @@ async function init() {
|
|||||||
'<i class="fa-solid fa-lock"></i> <span>Build requires admin/operator role</span>';
|
'<i class="fa-solid fa-lock"></i> <span>Build requires admin/operator role</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSavedBuilds();
|
await loadServerVersion();
|
||||||
|
await loadSavedBuilds();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Failed to fetch user info:", err);
|
console.error("Failed to fetch user info:", err);
|
||||||
window.location.href = "/login.html";
|
window.location.href = "/login.html";
|
||||||
@@ -547,6 +565,11 @@ function formatStubVersion(version) {
|
|||||||
return "unknown (legacy build)";
|
return "unknown (legacy build)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isVersionMismatch(versionValue) {
|
||||||
|
if (!currentServerVersion) return false;
|
||||||
|
return versionValue !== currentServerVersion;
|
||||||
|
}
|
||||||
|
|
||||||
function saveBuildToStorage(buildId, buildData) {
|
function saveBuildToStorage(buildId, buildData) {
|
||||||
try {
|
try {
|
||||||
const builds = JSON.parse(localStorage.getItem("overlord_builds") || "[]");
|
const builds = JSON.parse(localStorage.getItem("overlord_builds") || "[]");
|
||||||
@@ -747,7 +770,9 @@ function showBuildFilesForContainer(build, containerId, timerId) {
|
|||||||
const platformText = document.createElement("span");
|
const platformText = document.createElement("span");
|
||||||
platformText.textContent = `${file.platform} | `;
|
platformText.textContent = `${file.platform} | `;
|
||||||
const versionText = document.createElement("span");
|
const versionText = document.createElement("span");
|
||||||
versionText.className = "server-version-number";
|
versionText.className = isVersionMismatch(versionValue)
|
||||||
|
? "server-version-number-mismatch"
|
||||||
|
: "server-version-number";
|
||||||
versionText.textContent =
|
versionText.textContent =
|
||||||
versionValue === "unknown (legacy build)" ? versionValue : `v${versionValue}`;
|
versionValue === "unknown (legacy build)" ? versionValue : `v${versionValue}`;
|
||||||
filePlatform.appendChild(platformText);
|
filePlatform.appendChild(platformText);
|
||||||
|
|||||||
@@ -1588,6 +1588,14 @@ mark.search-current {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.server-version-number-mismatch {
|
||||||
|
color: #f87171;
|
||||||
|
text-shadow:
|
||||||
|
0 0 8px rgba(248, 113, 113, 0.65),
|
||||||
|
0 0 16px rgba(239, 68, 68, 0.45);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
#filter-status,
|
#filter-status,
|
||||||
#filter-os,
|
#filter-os,
|
||||||
#sort {
|
#sort {
|
||||||
|
|||||||
Reference in New Issue
Block a user