Download history to client

This commit is contained in:
Magnus Åhall 2026-06-06 14:29:22 +02:00
parent 65a0225d74
commit 9506b89453
5 changed files with 249 additions and 75 deletions

View file

@ -456,7 +456,24 @@ class NodeHistoryStore extends SimpleNodeStore {
request.onerror = (event) => reject(event.target.error)
})
}//}}}
retrievePage(uuid, perPage, page) {
hasNode(uuid, updated) {
return new Promise((resolve, reject) => {
const req = this.db
.transaction(['nodes', this.storeName], 'readonly')
.objectStore(this.storeName)
.getKey([uuid, updated])
req.onsuccess = (event) => {
resolve(event.target.result !== undefined)
}
req.onerror = (event) => {
console.log(event.target.error)
reject(event.target.error)
}
})
}
retrievePage(uuid, perPage, page) {// {{{
return new Promise((resolve, _reject) => {
const cursor = this.db
.transaction(['nodes', this.storeName], 'readonly')
@ -497,10 +514,10 @@ class NodeHistoryStore extends SimpleNodeStore {
}
}
})
}
}// }}}
}
export function uuidv7() {
export function uuidv7() {// {{{
// random bytes
const value = new Uint8Array(16)
crypto.getRandomValues(value)
@ -524,6 +541,6 @@ export function uuidv7() {
.map((b) => b.toString(16).padStart(2, "0"))
.join("")
return `${str.slice(0, 8)}-${str.slice(8, 12)}-${str.slice(12, 16)}-${str.slice(16, 20)}-${str.slice(20)}`
}
}// }}}
// vim: foldmethod=marker