From 8d48909e4f0e8dbbf9af85b42e3dd26884eb3c9c Mon Sep 17 00:00:00 2001 From: eternal-flame-AD Date: Thu, 21 Nov 2024 06:06:30 -0600 Subject: [PATCH] remove unused httpAgent Signed-off-by: eternal-flame-AD --- packages/backend/src/core/DownloadService.ts | 1 - packages/backend/src/server/web/UrlPreviewService.ts | 1 - packages/sw/src/sw.ts | 8 +++++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/core/DownloadService.ts b/packages/backend/src/core/DownloadService.ts index 93f4a38246..6266e51496 100644 --- a/packages/backend/src/core/DownloadService.ts +++ b/packages/backend/src/core/DownloadService.ts @@ -61,7 +61,6 @@ export class DownloadService { request: operationTimeout, // whole operation timeout }, agent: { - http: this.httpRequestService.httpAgent, https: this.httpRequestService.httpsAgent, }, http2: false, // default diff --git a/packages/backend/src/server/web/UrlPreviewService.ts b/packages/backend/src/server/web/UrlPreviewService.ts index 5d493c2c46..94b4a9fd90 100644 --- a/packages/backend/src/server/web/UrlPreviewService.ts +++ b/packages/backend/src/server/web/UrlPreviewService.ts @@ -118,7 +118,6 @@ export class UrlPreviewService { private fetchSummary(url: string, meta: MiMeta, lang?: string): Promise { const agent = this.config.proxy ? { - http: this.httpRequestService.httpAgent, https: this.httpRequestService.httpsAgent, } : undefined; diff --git a/packages/sw/src/sw.ts b/packages/sw/src/sw.ts index 89754c976e..dba5bd55ad 100644 --- a/packages/sw/src/sw.ts +++ b/packages/sw/src/sw.ts @@ -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));