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"
|
type="number"
|
||||||
min="10"
|
min="10"
|
||||||
max="500"
|
max="500"
|
||||||
value={settings.imageCacheSizeMB ?? 50}
|
value={settings.imageCacheSizeMB ?? 210}
|
||||||
onChange={(e) => onUpdate({ imageCacheSizeMB: parseInt(e.target.value) || 50 })}
|
onChange={(e) => onUpdate({ imageCacheSizeMB: parseInt(e.target.value) || 210 })}
|
||||||
style={{
|
style={{
|
||||||
width: '50px',
|
width: '50px',
|
||||||
padding: '0.15rem 0.35rem',
|
padding: '0.15rem 0.35rem',
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export function useImageCache(
|
|||||||
// Cache image in background
|
// Cache image in background
|
||||||
if (!isLoading) {
|
if (!isLoading) {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
const maxSize = settings?.imageCacheSizeMB ?? 50
|
const maxSize = settings?.imageCacheSizeMB ?? 210
|
||||||
|
|
||||||
cacheImage(imageUrl, maxSize)
|
cacheImage(imageUrl, maxSize)
|
||||||
.then(dataUrl => {
|
.then(dataUrl => {
|
||||||
@@ -81,7 +81,7 @@ export function useCacheImageOnLoad(
|
|||||||
if (cached) return
|
if (cached) return
|
||||||
|
|
||||||
// Cache in background
|
// Cache in background
|
||||||
const maxSize = settings?.imageCacheSizeMB ?? 50
|
const maxSize = settings?.imageCacheSizeMB ?? 210
|
||||||
cacheImage(imageUrl, maxSize).catch(err => {
|
cacheImage(imageUrl, maxSize).catch(err => {
|
||||||
console.error('Failed to cache image:', err)
|
console.error('Failed to cache image:', err)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ export async function fetchArticleByNaddr(
|
|||||||
|
|
||||||
// Cache cover image if enabled and present
|
// Cache cover image if enabled and present
|
||||||
if (image && settings?.enableImageCache !== false) {
|
if (image && settings?.enableImageCache !== false) {
|
||||||
const maxSize = settings?.imageCacheSizeMB ?? 50
|
const maxSize = settings?.imageCacheSizeMB ?? 210
|
||||||
cacheImage(image, maxSize).catch(err => {
|
cacheImage(image, maxSize).catch(err => {
|
||||||
console.warn('Failed to cache article cover image:', err)
|
console.warn('Failed to cache article cover image:', err)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export interface UserSettings {
|
|||||||
rebroadcastToAllRelays?: boolean // Rebroadcast events to all relays
|
rebroadcastToAllRelays?: boolean // Rebroadcast events to all relays
|
||||||
// Image cache settings
|
// Image cache settings
|
||||||
enableImageCache?: boolean // Enable caching images in localStorage
|
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(
|
export async function loadSettings(
|
||||||
|
|||||||
Reference in New Issue
Block a user