Merge upstream #40
3 changed files with 7 additions and 3 deletions
|
@ -61,7 +61,6 @@ export class DownloadService {
|
|||
request: operationTimeout, // whole operation timeout
|
||||
},
|
||||
agent: {
|
||||
http: this.httpRequestService.httpAgent,
|
||||
https: this.httpRequestService.httpsAgent,
|
||||
},
|
||||
http2: false, // default
|
||||
|
|
|
@ -118,7 +118,6 @@ export class UrlPreviewService {
|
|||
private fetchSummary(url: string, meta: MiMeta, lang?: string): Promise<SummalyResult> {
|
||||
const agent = this.config.proxy
|
||||
? {
|
||||
http: this.httpRequestService.httpAgent,
|
||||
https: this.httpRequestService.httpsAgent,
|
||||
}
|
||||
: undefined;
|
||||
|
|
|
@ -43,7 +43,7 @@ async function cacheWithFallback(cache, paths) {
|
|||
globalThis.addEventListener('install', (ev) => {
|
||||
ev.waitUntil((async () => {
|
||||
const storage = await requestStorage();
|
||||
registerFetchHandler(storage);
|
||||
await registerFetchHandler(storage);
|
||||
const cache = await caches.open(STATIC_CACHE_NAME);
|
||||
await cacheWithFallback(cache, PATHS_TO_CACHE);
|
||||
await globalThis.skipWaiting();
|
||||
|
@ -75,6 +75,12 @@ async function offlineContentHTML() {
|
|||
|
||||
async function registerFetchHandler(root: FileSystemDirectoryHandle | null) {
|
||||
console.debug('rootfs:', root);
|
||||
const state = await root?.getFileHandle('state.json', { create: true })
|
||||
await state?.createWritable().then(async writable => {
|
||||
await writable.write(JSON.stringify({ started: Date.now() }));
|
||||
await writable.close();
|
||||
});
|
||||
|
||||
|
||||
globalThis.addEventListener('fetch', ev => {
|
||||
const shouldCache = PATHS_TO_CACHE.some(path => ev.request.url.includes(path));
|
||||
|
|
Loading…
Reference in a new issue