Fixed Datetime Formatting and Changed Default Password to "Password"

This commit is contained in:
2025-09-02 18:41:51 -06:00
parent cbfed4c6ff
commit 7dc0c1c097
2 changed files with 21 additions and 4 deletions

View File

@@ -35,6 +35,23 @@ export default function DeviceDetails({ device, onBack }) {
const statusColor = (s) => (s === "Online" ? "#00d18c" : "#ff4f4f");
const formatLastSeen = (tsSec, offlineAfter = 15) => {
if (!tsSec) return "unknown";
const now = Date.now() / 1000;
if (now - tsSec <= offlineAfter) return "Currently Online";
const d = new Date(tsSec * 1000);
const date = d.toLocaleDateString("en-US", {
month: "2-digit",
day: "2-digit",
year: "numeric",
});
const time = d.toLocaleTimeString("en-US", {
hour: "numeric",
minute: "2-digit",
});
return `${date} @ ${time}`;
};
useEffect(() => {
if (!device || !device.hostname) return;
const load = async () => {
@@ -84,7 +101,7 @@ export default function DeviceDetails({ device, onBack }) {
hh = hh % 12 || 12;
return `${m.toString().padStart(2, "0")}/${d.toString().padStart(2, "0")}/${y} @ ${hh}:${mm
.toString()
.padStart(2, "0")}${ampm}`;
.padStart(2, "0")} ${ampm}`;
} catch {
return str;
}
@@ -134,7 +151,8 @@ export default function DeviceDetails({ device, onBack }) {
{ label: "Internal IP", value: summary.internal_ip || "unknown" },
{ label: "External IP", value: summary.external_ip || "unknown" },
{ label: "Last Reboot", value: summary.last_reboot ? formatDateTime(summary.last_reboot) : "unknown" },
{ label: "Created", value: summary.created ? formatDateTime(summary.created) : "unknown" }
{ label: "Created", value: summary.created ? formatDateTime(summary.created) : "unknown" },
{ label: "Last Seen", value: formatLastSeen(agent.last_seen || device?.lastSeen) }
];
const renderSummary = () => (
@@ -483,4 +501,3 @@ export default function DeviceDetails({ device, onBack }) {
</Paper>
);
}

View File

@@ -2,7 +2,7 @@
"users": [
{
"username": "admin",
"password": "18ec3210467c363a6cf96901261be4431bb4a75285ccd362b8cf8eae504ce6250ea4d64264a75486bf446051e3d4a6ac004410914ae706d29a01e96ba53f49a3"
"password": "e6c83b282aeb2e022844595721cc00bbda47cb24537c1779f9bb84f04039e1676e6ba8573e588da1052510e3aa0a32a9e55879ae22b0c2d62136fc0a3e85f8bb"
}
]
}