mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 15:14:20 +01:00
refactor: simplify image caching to use Service Worker only
- Remove complex Cache API management with blob URLs and metadata - useImageCache now simply returns the URL (Service Worker handles caching) - imageCacheService reduced to just stats and clear functions - Service Worker automatically caches all images on fetch - Much simpler, DRY code that 'just works' for offline mode - Stats now read directly from Cache API instead of localStorage metadata
This commit is contained in:
@@ -7,7 +7,6 @@ import { Helpers } from 'applesauce-core'
|
||||
import { RELAYS } from '../config/relays'
|
||||
import { UserSettings } from './settingsService'
|
||||
import { rebroadcastEvents } from './rebroadcastService'
|
||||
import { cacheImage } from './imageCacheService'
|
||||
|
||||
const { getArticleTitle, getArticleImage, getArticlePublished, getArticleSummary } = Helpers
|
||||
|
||||
@@ -146,13 +145,7 @@ export async function fetchArticleByNaddr(
|
||||
// Save to cache before returning
|
||||
saveToCache(naddr, content)
|
||||
|
||||
// Cache cover image if enabled and present
|
||||
if (image && settings?.enableImageCache !== false) {
|
||||
const maxSize = settings?.imageCacheSizeMB ?? 210
|
||||
cacheImage(image, maxSize).catch(err => {
|
||||
console.warn('Failed to cache article cover image:', err)
|
||||
})
|
||||
}
|
||||
// Image caching is handled automatically by Service Worker
|
||||
|
||||
return content
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user