big ui update, page search + full text
- split file chooser from coll index, insert as header, make file chooser collapsible - revamp collection index to be responsive - add separate sorter component, used for collection index and pages - combine 'curated lists' + pages, with page search + narrative - ensure page + narrative lists are collapsible - page search: support title, url and full text search if available, using flexsearch - page search: keyword highlighting, load all pages, showing in increments of 100 - page and resource search: delay search to 1/4 sec of inactivity to avoid too many queries - electron app: ensure noCache is set to true for local files - embedding: remove separate embed.js, just use ui.js for embed as well - embedding: support embedding iframe in a local origin with just sw.js and ui.js: sw.js serves index.html, <replay-web-page> embed injects ui.js into iframe - sw.js, new service worker entry point - sw and ww inited only from <replay-app-main>, ui.js loaded from <replay-web-page> embed component
This commit is contained in:
+27
-4
@@ -1,3 +1,29 @@
|
||||
import { register } from 'register-service-worker';
|
||||
|
||||
async function registerSW(name = "sw.js", scope = "./") {
|
||||
let resolve, reject;
|
||||
|
||||
const p = new Promise((res, rej) => {
|
||||
resolve = res;
|
||||
reject = rej;
|
||||
});
|
||||
|
||||
register(scope + name, {
|
||||
registrationOptions: { scope },
|
||||
registered (reg) {
|
||||
console.log('Service worker is registered');
|
||||
resolve();
|
||||
},
|
||||
|
||||
error (error) {
|
||||
console.error('Error during service worker registration:', error);
|
||||
reject();
|
||||
}
|
||||
});
|
||||
|
||||
await p;
|
||||
}
|
||||
|
||||
async function digestMessage(message, hashtype) {
|
||||
const msgUint8 = new TextEncoder().encode(message); // encode as (utf-8) Uint8Array
|
||||
const hashBuffer = await crypto.subtle.digest(hashtype, msgUint8); // hash the message
|
||||
@@ -71,7 +97,4 @@ function parseURLSchemeHostPath(url) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export { digestMessage, tsToDate, getTS, sourceToId, parseURLSchemeHostPath };
|
||||
export { digestMessage, tsToDate, getTS, sourceToId, parseURLSchemeHostPath, registerSW };
|
||||
|
||||
Reference in New Issue
Block a user