diff --git a/src/components/EventArchiveCacheSettings/index.tsx b/src/components/EventArchiveCacheSettings/index.tsx index 658d41e5..d222d031 100644 --- a/src/components/EventArchiveCacheSettings/index.tsx +++ b/src/components/EventArchiveCacheSettings/index.tsx @@ -1,6 +1,5 @@ import { Button } from '@/components/ui/button' import { Label } from '@/components/ui/label' -import { Switch } from '@/components/ui/switch' import { Input } from '@/components/ui/input' import { StorageKey } from '@/constants' import { @@ -22,7 +21,6 @@ function platformLabel(): string { export default function EventArchiveCacheSettings() { const { t } = useTranslation() - const [enabled, setEnabled] = useState(true) const [maxMb, setMaxMb] = useState('') const [maxEvents, setMaxEvents] = useState('') const [sessionLru, setSessionLru] = useState('') @@ -51,14 +49,12 @@ export default function EventArchiveCacheSettings() { }, [t]) useEffect(() => { - setEnabled(window.localStorage.getItem(StorageKey.EVENT_ARCHIVE_ENABLED) !== 'false') setMaxMb(window.localStorage.getItem(StorageKey.EVENT_ARCHIVE_MAX_MB) ?? '') setMaxEvents(window.localStorage.getItem(StorageKey.EVENT_ARCHIVE_MAX_EVENTS) ?? '') setSessionLru(window.localStorage.getItem(StorageKey.SESSION_EVENT_LRU_MAX) ?? '') }, []) const apply = useCallback(() => { - window.localStorage.setItem(StorageKey.EVENT_ARCHIVE_ENABLED, enabled ? 'true' : 'false') const mb = maxMb.trim() if (mb) window.localStorage.setItem(StorageKey.EVENT_ARCHIVE_MAX_MB, mb) else window.localStorage.removeItem(StorageKey.EVENT_ARCHIVE_MAX_MB) @@ -71,7 +67,7 @@ export default function EventArchiveCacheSettings() { client.reapplySessionLruFromSettings() invalidateArchiveFootprintCache() toast.success(t('eventArchive.appliedToast')) - }, [enabled, maxMb, maxEvents, sessionLru, t]) + }, [maxMb, maxEvents, sessionLru, t]) const effective = getEventArchiveConfig() @@ -81,17 +77,6 @@ export default function EventArchiveCacheSettings() {
{t('eventArchive.sectionBlurb')}
{defaultsHint}
{t('eventArchive.effectiveSummary', { - enabled: effective.enabled ? t('eventArchive.on') : t('eventArchive.off'), mb: Math.round(effective.maxBytes / (1024 * 1024)), events: effective.maxEvents, lru: effective.sessionLruMax diff --git a/src/constants.ts b/src/constants.ts index 36b43799..0e7ee54a 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -240,8 +240,6 @@ export const StorageKey = { SHOW_PUBLISH_SUCCESS_TOASTS: 'showPublishSuccessToasts', /** When not `'false'`, show NIP-53 live activity banner (default on). */ SHOW_LIVE_ACTIVITIES_BANNER: 'showLiveActivitiesBanner', - /** Persist timeline notes/reactions to IndexedDB (platform defaults; disable for relay-only). */ - EVENT_ARCHIVE_ENABLED: 'eventArchiveEnabled', /** Max approximate archive size (MB). `0` in UI means “use platform default”. */ EVENT_ARCHIVE_MAX_MB: 'eventArchiveMaxMb', /** Max rows in event archive. `0` means use platform default. */ diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index 5df66fbe..0bbd1994 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -631,7 +631,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -643,7 +643,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 5524c823..0d722a65 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -667,7 +667,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -679,7 +679,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 724ea377..fdeaa646 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -660,7 +660,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -672,7 +672,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 52a6e268..1038255c 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -636,7 +636,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -648,7 +648,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/fa.ts b/src/i18n/locales/fa.ts index 2fd296dc..35a86fc3 100644 --- a/src/i18n/locales/fa.ts +++ b/src/i18n/locales/fa.ts @@ -634,7 +634,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -646,7 +646,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index c54d219b..92ce912e 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -635,7 +635,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -647,7 +647,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/hi.ts b/src/i18n/locales/hi.ts index 1215d164..08318ea1 100644 --- a/src/i18n/locales/hi.ts +++ b/src/i18n/locales/hi.ts @@ -635,7 +635,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -647,7 +647,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/it.ts b/src/i18n/locales/it.ts index b7967e38..1bc305d7 100644 --- a/src/i18n/locales/it.ts +++ b/src/i18n/locales/it.ts @@ -636,7 +636,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -648,7 +648,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index 59543405..7166c82b 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -632,7 +632,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -644,7 +644,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/ko.ts b/src/i18n/locales/ko.ts index 61b912fc..f5f3c1d3 100644 --- a/src/i18n/locales/ko.ts +++ b/src/i18n/locales/ko.ts @@ -631,7 +631,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -643,7 +643,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/pl.ts b/src/i18n/locales/pl.ts index d025d14c..3d25e5cb 100644 --- a/src/i18n/locales/pl.ts +++ b/src/i18n/locales/pl.ts @@ -633,7 +633,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -645,7 +645,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/pt-BR.ts b/src/i18n/locales/pt-BR.ts index 3128c2e1..9b2b468d 100644 --- a/src/i18n/locales/pt-BR.ts +++ b/src/i18n/locales/pt-BR.ts @@ -635,7 +635,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -647,7 +647,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/pt-PT.ts b/src/i18n/locales/pt-PT.ts index 8974f442..c9b71195 100644 --- a/src/i18n/locales/pt-PT.ts +++ b/src/i18n/locales/pt-PT.ts @@ -635,7 +635,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -647,7 +647,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 3af85d6e..9e6b7afc 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -635,7 +635,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -647,7 +647,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/th.ts b/src/i18n/locales/th.ts index dc5b057a..1a4eb096 100644 --- a/src/i18n/locales/th.ts +++ b/src/i18n/locales/th.ts @@ -631,7 +631,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -643,7 +643,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index f68d8de8..ba1b6398 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -630,7 +630,7 @@ export default { 'Refresh Cache runs an IndexedDB upgrade check, re-fetches your relay lists and profile-related events from the network (same work as the automatic startup sync), syncs kind-5 deletions into tombstones and removes deleted items from the local cache, then refreshes the store counts below.', 'eventArchive.sectionTitle': 'Notes & feed archive', 'eventArchive.sectionBlurb': - 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events. Turn off to rely on relays only.', + 'Keeps notes, reactions, and timeline order on disk so feeds can load offline or on slow links. Replaceable data (profiles, relay lists, publications) stays in its existing stores — this archive only fills gaps for “firehose” events.', 'eventArchive.defaultsMobile': 'This device profile uses small defaults: about {{lru}} events in memory, ~{{mb}} MB / {{ev}} archived events (reactions/zaps drop first).', 'eventArchive.defaultsElectron': @@ -642,7 +642,7 @@ export default { 'eventArchive.maxEvents': 'Max archived events, blank = default', 'eventArchive.sessionLru': 'In-memory session cache (event count), blank = default', 'eventArchive.effectiveSummary': - 'Currently: {{enabled}} — ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', + 'Currently: ~{{mb}} MB budget, {{events}} events, {{lru}} session LRU.', 'eventArchive.on': 'on', 'eventArchive.off': 'off', 'eventArchive.apply': 'Apply cache settings', diff --git a/src/lib/event-archive-config.ts b/src/lib/event-archive-config.ts index 4a251984..95093261 100644 --- a/src/lib/event-archive-config.ts +++ b/src/lib/event-archive-config.ts @@ -1,6 +1,10 @@ import { StorageKey } from '@/constants' import { isImwaldElectron, isMobileBrowserProfile } from '@/lib/client-platform' +/** Removed from settings; strip so manual `localStorage` edits cannot flip archive behavior. */ +const LEGACY_EVENT_ARCHIVE_ENABLED_KEY = 'eventArchiveEnabled' +let legacyEventArchiveEnabledKeyRemoved = false + /** Platform defaults (overridable in Cache settings). */ export const EVENT_ARCHIVE_DEFAULTS = { sessionLruMobile: 100, @@ -15,23 +19,12 @@ export const EVENT_ARCHIVE_DEFAULTS = { } as const export type TEventArchiveConfig = { - enabled: boolean /** Soft byte budget (approximate, from JSON size). */ maxBytes: number maxEvents: number sessionLruMax: number } -function readBool(key: string, defaultTrue: boolean): boolean { - try { - const v = window.localStorage.getItem(key) - if (v === null) return defaultTrue - return v !== 'false' && v !== '0' - } catch { - return defaultTrue - } -} - function readPositiveInt(key: string, fallback: number): number { try { const v = window.localStorage.getItem(key) @@ -63,14 +56,21 @@ function defaultMaxEvents(): number { /** * Effective archive + session LRU limits (reads Cache settings from localStorage). + * Disk archive is always on; only caps are configurable. */ export function getEventArchiveConfig(): TEventArchiveConfig { - const enabled = readBool(StorageKey.EVENT_ARCHIVE_ENABLED, true) + if (typeof window !== 'undefined' && !legacyEventArchiveEnabledKeyRemoved) { + legacyEventArchiveEnabledKeyRemoved = true + try { + window.localStorage.removeItem(LEGACY_EVENT_ARCHIVE_ENABLED_KEY) + } catch { + // ignore + } + } const maxMb = readPositiveInt(StorageKey.EVENT_ARCHIVE_MAX_MB, defaultMaxMb()) const maxEvents = readPositiveInt(StorageKey.EVENT_ARCHIVE_MAX_EVENTS, defaultMaxEvents()) const sessionLruMax = readPositiveInt(StorageKey.SESSION_EVENT_LRU_MAX, defaultSessionLruMax()) return { - enabled, maxBytes: Math.max(8, maxMb) * 1024 * 1024, maxEvents: Math.max(50, maxEvents), sessionLruMax: Math.max(32, Math.min(200_000, sessionLruMax)) diff --git a/src/services/event-archive.service.ts b/src/services/event-archive.service.ts index eb383489..d5ff8101 100644 --- a/src/services/event-archive.service.ts +++ b/src/services/event-archive.service.ts @@ -58,7 +58,6 @@ function approxEventBytes(ev: Event): number { async function trimArchiveIfNeeded(): Promise { const cfg = getEventArchiveConfig() - if (!cfg.enabled) return await ensureFootprint() let guard = 0 while ( @@ -78,8 +77,7 @@ async function trimArchiveIfNeeded(): Promise { } async function flushArchiveQueue(): Promise { - const cfg = getEventArchiveConfig() - if (!cfg.enabled || pending.size === 0) return + if (pending.size === 0) return const batch = [...pending.values()] pending.clear() for (const ev of batch) { @@ -107,8 +105,6 @@ function scheduleFlush(): void { /** Queue a non-replaceable event for IndexedDB archive (Electron + mobile + desktop web; caps differ). */ export function queuePersistSeenEvent(ev: Event): void { - const cfg = getEventArchiveConfig() - if (!cfg.enabled) return if (shouldSkipArchiving(ev)) return const id = /^[0-9a-f]{64}$/i.test(ev.id) ? ev.id.toLowerCase() : ev.id if (!/^[0-9a-f]{64}$/.test(id)) return @@ -117,15 +113,12 @@ export function queuePersistSeenEvent(ev: Event): void { } export async function loadArchivedEventForFetch(hexId: string): Promise { - const cfg = getEventArchiveConfig() - if (!cfg.enabled) return undefined const ev = await indexedDb.getArchivedEventById(hexId, true) if (!ev || shouldDropEventOnIngest(ev)) return undefined return ev } export async function prefetchArchivedEvents(hexIds: string[]): Promise { - const cfg = getEventArchiveConfig() - if (!cfg.enabled || hexIds.length === 0) return [] + if (hexIds.length === 0) return [] return indexedDb.getArchivedEventsByIds(hexIds) }