kifaru 1.0.174 → 1.0.178
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/assurance.html +26 -8
- package/kifaru-gateway.js +69381 -0
- package/kifaru-pi.js +235 -2
- package/model-catalog.json +110 -0
- package/package.json +4 -2
package/dashboard/assurance.html
CHANGED
|
@@ -2489,7 +2489,7 @@ ${f.dpa.map((d) => " - " + d).join("\n")}`
|
|
|
2489
2489
|
)
|
|
2490
2490
|
}
|
|
2491
2491
|
function startRun() {
|
|
2492
|
-
|
|
2492
|
+
signedIn() ? (window.location.href = "/assessments") : openLogin()
|
|
2493
2493
|
}
|
|
2494
2494
|
|
|
2495
2495
|
function switchTab(name) {
|
|
@@ -2543,17 +2543,33 @@ ${f.dpa.map((d) => " - " + d).join("\n")}`
|
|
|
2543
2543
|
return ""
|
|
2544
2544
|
}
|
|
2545
2545
|
}
|
|
2546
|
+
// The loopback dev sign-in establishes an httpOnly cookie session; no
|
|
2547
|
+
// bearer token is returned, so this flag tracks that it succeeded.
|
|
2548
|
+
function devSessionActive() {
|
|
2549
|
+
try {
|
|
2550
|
+
return localStorage.getItem("kifaru_dev_session") === "1"
|
|
2551
|
+
} catch (_) {
|
|
2552
|
+
return false
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
function setDevSession(on) {
|
|
2556
|
+
try {
|
|
2557
|
+
on ? localStorage.setItem("kifaru_dev_session", "1") : localStorage.removeItem("kifaru_dev_session")
|
|
2558
|
+
} catch (_) {}
|
|
2559
|
+
}
|
|
2560
|
+
function signedIn() {
|
|
2561
|
+
return Boolean(getToken()) || devSessionActive()
|
|
2562
|
+
}
|
|
2546
2563
|
async function autoDiscoverToken() {
|
|
2547
2564
|
let t = getToken()
|
|
2548
|
-
if (t) return t
|
|
2565
|
+
if (t || devSessionActive()) return t
|
|
2549
2566
|
try {
|
|
2550
|
-
|
|
2567
|
+
// Session-scoped dev sign-in: the gateway sets an httpOnly session
|
|
2568
|
+
// cookie for loopback browsers and returns no token.
|
|
2569
|
+
const r = await fetch("/api/v1/auth/dev-token", { credentials: "include" })
|
|
2551
2570
|
if (r.ok) {
|
|
2552
2571
|
const d = await r.json()
|
|
2553
|
-
if (d?.
|
|
2554
|
-
setToken(d.token)
|
|
2555
|
-
return d.token
|
|
2556
|
-
}
|
|
2572
|
+
if (d?.ok) setDevSession(true)
|
|
2557
2573
|
}
|
|
2558
2574
|
} catch (_) {}
|
|
2559
2575
|
return ""
|
|
@@ -2565,7 +2581,7 @@ ${f.dpa.map((d) => " - " + d).join("\n")}`
|
|
|
2565
2581
|
}
|
|
2566
2582
|
function openLogin() {
|
|
2567
2583
|
$("#loginErr").textContent = ""
|
|
2568
|
-
$("#logoutBtn").hidden = !
|
|
2584
|
+
$("#logoutBtn").hidden = !signedIn()
|
|
2569
2585
|
$("#loginModal").hidden = false
|
|
2570
2586
|
setTimeout(() => $("#loginEmail").focus(), 30)
|
|
2571
2587
|
}
|
|
@@ -2658,6 +2674,8 @@ ${f.dpa.map((d) => " - " + d).join("\n")}`
|
|
|
2658
2674
|
}
|
|
2659
2675
|
function signOut() {
|
|
2660
2676
|
setToken("")
|
|
2677
|
+
setDevSession(false)
|
|
2678
|
+
fetch("/api/v1/auth/logout", { method: "POST", credentials: "include" }).catch(() => {})
|
|
2661
2679
|
LIVE = null
|
|
2662
2680
|
ACTIVE_RUN = null
|
|
2663
2681
|
findingDetailCache.clear()
|