Skip to content

Commit 259183e

Browse files
author
renlord
committed
implements toggle for device info body
1 parent 5a856d7 commit 259183e

1 file changed

Lines changed: 35 additions & 31 deletions

File tree

static/monitoring.js

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ function fetchDevices() {
169169
link.href = "#" + fingerprint;
170170
header.appendChild(link);
171171
info.appendChild(header);
172-
173172
const deleteButton = info.appendChild(create("button", "delete device"));
174173
deleteButton.onclick = event => {
175174
if (confirm("Are you sure you want to delete the device " + fingerprint + "?")) {
@@ -194,27 +193,32 @@ function fetchDevices() {
194193
});
195194
}
196195
};
197-
198-
info.appendChild(create("h3", "Verified device information:"));
199-
appendLine(info, "Device: " + device.name);
200-
appendLine(info, "OS: " + device.osName);
201-
appendLine(info, "OS version: " + formatOsVersion(device.pinnedOsVersion));
202-
appendLine(info, "OS patch level: " + formatPatchLevel(device.pinnedOsPatchLevel));
196+
const infoBody = create("div", null, `infobody-${fingerprint}`);
197+
info.appendChild(infoBody);
198+
infoBody.hidden = true;
199+
header.onclick = function toggleInfoBody() {
200+
infoBody.hidden = !infoBody.hidden;
201+
};
202+
infoBody.appendChild(create("h3", "Verified device infoBodyrmation:"));
203+
appendLine(infoBody, "Device: " + device.name);
204+
appendLine(infoBody, "OS: " + device.osName);
205+
appendLine(infoBody, "OS version: " + formatOsVersion(device.pinnedOsVersion));
206+
appendLine(infoBody, "OS patch level: " + formatPatchLevel(device.pinnedOsPatchLevel));
203207
if (device.pinnedVendorPatchLevel !== undefined) {
204-
appendLine(info, "Vendor patch level: " + formatPatchLevel(device.pinnedVendorPatchLevel));
208+
appendLine(infoBody, "Vendor patch level: " + formatPatchLevel(device.pinnedVendorPatchLevel));
205209
}
206210
if (device.pinnedBootPatchLevel !== undefined) {
207-
appendLine(info, "Boot patch level: " + formatPatchLevel(device.pinnedBootPatchLevel));
211+
appendLine(infoBody, "Boot patch level: " + formatPatchLevel(device.pinnedBootPatchLevel));
208212
}
209213
if (device.verifiedBootHash !== undefined) {
210-
info.appendChild(document.createTextNode("Verified boot hash: "));
211-
info.appendChild(create("span", device.verifiedBootHash, "fingerprint"));
212-
info.appendChild(document.createElement("br"));
214+
infoBody.appendChild(document.createTextNode("Verified boot hash: "));
215+
infoBody.appendChild(create("span", device.verifiedBootHash, "fingerprint"));
216+
infoBody.appendChild(document.createElement("br"));
213217
}
214-
appendLine(info, "Security level: " + toSecurityLevelString(device.pinnedSecurityLevel));
218+
appendLine(infoBody, "Security level: " + toSecurityLevelString(device.pinnedSecurityLevel));
215219

216-
info.appendChild(create("button", "show advanced information", "toggle"));
217-
const advanced = info.appendChild(document.createElement("section"));
220+
infoBody.appendChild(create("button", "show advanced information", "toggle"));
221+
const advanced = infoBody.appendChild(document.createElement("section"));
218222
advanced.hidden = true;
219223
advanced.appendChild(document.createTextNode("Certificate 0 (persistent Auditor key): "));
220224
advanced.appendChild(create("button", "show", "toggle"));
@@ -235,25 +239,25 @@ function fetchDevices() {
235239
advanced.appendChild(document.createTextNode("Verified boot key fingerprint: "));
236240
advanced.appendChild(create("span", device.verifiedBootKey, "fingerprint"));
237241

238-
info.appendChild(create("h3", "Information provided by the verified OS:"));
239-
appendLine(info, "Auditor app version: " + device.pinnedAppVersion);
240-
appendLine(info, "User profile secure: " + toYesNoString(device.userProfileSecure));
241-
appendLine(info, "Enrolled fingerprints: " + toYesNoString(device.enrolledFingerprints));
242-
appendLine(info, "Accessibility service(s) enabled: " + toYesNoString(device.accessibility));
243-
appendLine(info, "Device administrator(s) enabled: " + deviceAdminStrings.get(device.deviceAdmin));
244-
appendLine(info, "Android Debug Bridge enabled: " + toYesNoString(device.adbEnabled));
245-
appendLine(info, "Add users from lock screen: " + toYesNoString(device.addUsersWhenLocked));
246-
appendLine(info, "Disallow new USB peripherals when locked: " + toYesNoString(device.denyNewUsb));
247-
appendLine(info, "OEM unlocking allowed: " + toYesNoString(device.oemUnlockAllowed));
242+
infoBody.appendChild(create("h3", "Information provided by the verified OS:"));
243+
appendLine(infoBody, "Auditor app version: " + device.pinnedAppVersion);
244+
appendLine(infoBody, "User profile secure: " + toYesNoString(device.userProfileSecure));
245+
appendLine(infoBody, "Enrolled fingerprints: " + toYesNoString(device.enrolledFingerprints));
246+
appendLine(infoBody, "Accessibility service(s) enabled: " + toYesNoString(device.accessibility));
247+
appendLine(infoBody, "Device administrator(s) enabled: " + deviceAdminStrings.get(device.deviceAdmin));
248+
appendLine(infoBody, "Android Debug Bridge enabled: " + toYesNoString(device.adbEnabled));
249+
appendLine(infoBody, "Add users from lock screen: " + toYesNoString(device.addUsersWhenLocked));
250+
appendLine(infoBody, "Disallow new USB peripherals when locked: " + toYesNoString(device.denyNewUsb));
251+
appendLine(infoBody, "OEM unlocking allowed: " + toYesNoString(device.oemUnlockAllowed));
248252
if (device.systemUser !== undefined) {
249-
appendLine(info, "Main user account: " + toYesNoString(device.systemUser));
253+
appendLine(infoBody, "Main user account: " + toYesNoString(device.systemUser));
250254
}
251255

252-
info.appendChild(create("h3", "Attestation history"));
253-
appendLine(info, "First verified time: " + new Date(device.verifiedTimeFirst));
254-
appendLine(info, "Last verified time: " + new Date(device.verifiedTimeLast));
255-
const historyButton = info.appendChild(create("button", "show detailed history", "toggle"));
256-
const history = info.appendChild(document.createElement("div"));
256+
infoBody.appendChild(create("h3", "Attestation history"));
257+
appendLine(infoBody, "First verified time: " + new Date(device.verifiedTimeFirst));
258+
appendLine(infoBody, "Last verified time: " + new Date(device.verifiedTimeLast));
259+
const historyButton = infoBody.appendChild(create("button", "show detailed history", "toggle"));
260+
const history = infoBody.appendChild(document.createElement("div"));
257261
history.dataset.deviceFingerprint = device.fingerprint;
258262
history.dataset.minId = Number(device.minId);
259263
history.dataset.maxId = Number(device.maxId);

0 commit comments

Comments
 (0)