Implement Knowledge City platform, organizer and DAV integration
Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
This commit is contained in:
1 parent
288e6e94ac
commit
c1175d389f
699 files changed
+110197
-4117
No files matched your search
+58
@@ -0,0 +1,58 @@
|
||||
(() => {
|
||||
let sawPending = false
|
||||
const originalFetch = window.fetch
|
||||
window.fetch = async (...args) => {
|
||||
const response = await originalFetch(...args)
|
||||
if (String(args[0]).includes("metadata=1") && response.status === 202) sawPending = true
|
||||
return response
|
||||
}
|
||||
const wait = async predicate => {
|
||||
for (let i = 0; i < 600; i++) {
|
||||
if (predicate()) return
|
||||
await new Promise(resolve => setTimeout(resolve, 25))
|
||||
}
|
||||
throw Error("metadata UI timed out")
|
||||
}
|
||||
const assert = (condition, message) => { if (!condition) throw Error(message) }
|
||||
window.addEventListener("load", async () => {
|
||||
try {
|
||||
const mode = new URLSearchParams(location.search).get("fixture")
|
||||
if (mode === "failed") {
|
||||
await wait(() => [...document.querySelectorAll("[data-projection-retry]")].some(button => !button.hidden))
|
||||
assert(document.querySelector("[data-projection-status]").textContent.trim(), "failed metadata became an empty final state")
|
||||
} else if (mode === "pdf") {
|
||||
const viewer = document.querySelector("[data-pdf-viewer]")
|
||||
await wait(() => viewer.dataset.pages === "3")
|
||||
const next = document.querySelector("[data-pdf-next]")
|
||||
next.click(); next.click(); next.click()
|
||||
assert(document.querySelector("[data-pdf-status]").textContent === "3 / 3", "PDF count did not update navigation bounds")
|
||||
assert(viewer.querySelector("img").src.includes("page=3"), "PDF did not retain the requested page")
|
||||
} else {
|
||||
const viewer = document.querySelector("[data-archive-metadata]")
|
||||
await wait(() => viewer.dataset.metadataStatus === "ready")
|
||||
if (mode === "comic") {
|
||||
const comic = viewer.querySelector("[data-comic-viewer]")
|
||||
const pages = [...comic.querySelectorAll("[data-comic-page]")]
|
||||
assert(pages.length === 3 && pages.filter(page => !page.hidden).length === 1, "pending comic images did not initialize safely")
|
||||
const before = history.length
|
||||
comic.querySelector("[data-comic-next]").click()
|
||||
comic.querySelector("[data-comic-layout]").click()
|
||||
assert(pages.filter(page => !page.hidden).length === 2, "async comic spread is broken")
|
||||
assert(history.length === before, "comic navigation polluted browser history")
|
||||
} else {
|
||||
const rows = [...viewer.querySelectorAll("[data-archive-entries] tr")]
|
||||
assert(rows.length === 3, "asynchronous archive table is incomplete")
|
||||
assert(rows[2].textContent.includes("<img onerror=alert(1)>.png"), "archive filename was not shown as text")
|
||||
assert(!rows[2].querySelector("img"), "archive filename was interpreted as markup")
|
||||
assert(rows.every(row => new URL(row.querySelector("a").href).searchParams.has("rev")), "archive links lost immutable revision binding")
|
||||
}
|
||||
}
|
||||
assert(sawPending, "browser did not exercise the asynchronous pending transition")
|
||||
document.body.dataset.vimReady = "true"
|
||||
} catch (error) {
|
||||
const message = document.createElement("pre")
|
||||
message.id = "error"; message.textContent = error.stack || String(error)
|
||||
document.body.append(message)
|
||||
}
|
||||
})
|
||||
})()
|
||||
Reference in new issue
Block a user