Some Admin Interface updates

- Updated datatables
- Added NTP Time check
- Added Collections, Groups and Events count for orgs
- Renamed `Items` to `Ciphers`
- Some small style updates
This commit is contained in:
BlackDex
2023-02-28 20:43:22 +01:00
parent af6d17b701
commit f10e6b6ac2
13 changed files with 199 additions and 64 deletions

View File

@@ -4,6 +4,7 @@
var dnsCheck = false;
var timeCheck = false;
var ntpTimeCheck = false;
var domainCheck = false;
var httpsCheck = false;
@@ -90,7 +91,8 @@ async function generateSupportString(event, dj) {
supportString += `* Internet access: ${dj.has_http_access}\n`;
supportString += `* Internet access via a proxy: ${dj.uses_proxy}\n`;
supportString += `* DNS Check: ${dnsCheck}\n`;
supportString += `* Time Check: ${timeCheck}\n`;
supportString += `* Browser/Server Time Check: ${timeCheck}\n`;
supportString += `* Server/NTP Time Check: ${ntpTimeCheck}\n`;
supportString += `* Domain Configuration Check: ${domainCheck}\n`;
supportString += `* HTTPS Check: ${httpsCheck}\n`;
supportString += `* Database type: ${dj.db_type}\n`;
@@ -136,16 +138,17 @@ function copyToClipboard(event) {
new BSN.Toast("#toastClipboardCopy").show();
}
function checkTimeDrift(browserUTC, serverUTC) {
function checkTimeDrift(utcTimeA, utcTimeB, statusPrefix) {
const timeDrift = (
Date.parse(serverUTC.replace(" ", "T").replace(" UTC", "")) -
Date.parse(browserUTC.replace(" ", "T").replace(" UTC", ""))
Date.parse(utcTimeA.replace(" ", "T").replace(" UTC", "")) -
Date.parse(utcTimeB.replace(" ", "T").replace(" UTC", ""))
) / 1000;
if (timeDrift > 20 || timeDrift < -20) {
document.getElementById("time-warning").classList.remove("d-none");
if (timeDrift > 15 || timeDrift < -15) {
document.getElementById(`${statusPrefix}-warning`).classList.remove("d-none");
return false;
} else {
document.getElementById("time-success").classList.remove("d-none");
timeCheck = true;
document.getElementById(`${statusPrefix}-success`).classList.remove("d-none");
return true;
}
}
@@ -195,7 +198,18 @@ function checkDns(dns_resolved) {
function init(dj) {
// Time check
document.getElementById("time-browser-string").innerText = browserUTC;
checkTimeDrift(browserUTC, dj.server_time);
// Check if we were able to fetch a valid NTP Time
// If so, compare both browser and server with NTP
// Else, compare browser and server.
if (dj.ntp_time.indexOf("UTC") !== -1) {
timeCheck = checkTimeDrift(dj.server_time, browserUTC, "time");
checkTimeDrift(dj.ntp_time, browserUTC, "ntp-browser");
ntpTimeCheck = checkTimeDrift(dj.ntp_time, dj.server_time, "ntp-server");
} else {
timeCheck = checkTimeDrift(dj.server_time, browserUTC, "time");
ntpTimeCheck = "n/a";
}
// Domain check
const browserURL = location.href.toLowerCase();