mirror of
https://github.com/dergigi/boris.git
synced 2025-12-19 07:34:28 +01:00
feat: change default image cache size to 210MB
Increase default cache size from 50MB to 210MB for better offline experience
This commit is contained in:
@@ -65,8 +65,8 @@ const OfflineModeSettings: React.FC<OfflineModeSettingsProps> = ({ settings, onU
|
||||
type="number"
|
||||
min="10"
|
||||
max="500"
|
||||
value={settings.imageCacheSizeMB ?? 50}
|
||||
onChange={(e) => onUpdate({ imageCacheSizeMB: parseInt(e.target.value) || 50 })}
|
||||
value={settings.imageCacheSizeMB ?? 210}
|
||||
onChange={(e) => onUpdate({ imageCacheSizeMB: parseInt(e.target.value) || 210 })}
|
||||
style={{
|
||||
width: '50px',
|
||||
padding: '0.15rem 0.35rem',
|
||||
|
||||
@@ -43,7 +43,7 @@ export function useImageCache(
|
||||
// Cache image in background
|
||||
if (!isLoading) {
|
||||
setIsLoading(true)
|
||||
const maxSize = settings?.imageCacheSizeMB ?? 50
|
||||
const maxSize = settings?.imageCacheSizeMB ?? 210
|
||||
|
||||
cacheImage(imageUrl, maxSize)
|
||||
.then(dataUrl => {
|
||||
@@ -81,7 +81,7 @@ export function useCacheImageOnLoad(
|
||||
if (cached) return
|
||||
|
||||
// Cache in background
|
||||
const maxSize = settings?.imageCacheSizeMB ?? 50
|
||||
const maxSize = settings?.imageCacheSizeMB ?? 210
|
||||
cacheImage(imageUrl, maxSize).catch(err => {
|
||||
console.error('Failed to cache image:', err)
|
||||
})
|
||||
|
||||
@@ -148,7 +148,7 @@ export async function fetchArticleByNaddr(
|
||||
|
||||
// Cache cover image if enabled and present
|
||||
if (image && settings?.enableImageCache !== false) {
|
||||
const maxSize = settings?.imageCacheSizeMB ?? 50
|
||||
const maxSize = settings?.imageCacheSizeMB ?? 210
|
||||
cacheImage(image, maxSize).catch(err => {
|
||||
console.warn('Failed to cache article cover image:', err)
|
||||
})
|
||||
|
||||
@@ -44,7 +44,7 @@ export interface UserSettings {
|
||||
rebroadcastToAllRelays?: boolean // Rebroadcast events to all relays
|
||||
// Image cache settings
|
||||
enableImageCache?: boolean // Enable caching images in localStorage
|
||||
imageCacheSizeMB?: number // Maximum cache size in megabytes (default: 50MB)
|
||||
imageCacheSizeMB?: number // Maximum cache size in megabytes (default: 210MB)
|
||||
}
|
||||
|
||||
export async function loadSettings(
|
||||
|
||||
Reference in New Issue
Block a user