|
|
|
@ -28,6 +28,7 @@ class LocalStorageService { |
|
|
|
private autoplay: boolean = true |
|
|
|
private autoplay: boolean = true |
|
|
|
private hideUntrustedInteractions: boolean = false |
|
|
|
private hideUntrustedInteractions: boolean = false |
|
|
|
private hideUntrustedNotifications: boolean = false |
|
|
|
private hideUntrustedNotifications: boolean = false |
|
|
|
|
|
|
|
private hideUntrustedNotes: boolean = false |
|
|
|
private translationServiceConfigMap: Record<string, TTranslationServiceConfig> = {} |
|
|
|
private translationServiceConfigMap: Record<string, TTranslationServiceConfig> = {} |
|
|
|
|
|
|
|
|
|
|
|
constructor() { |
|
|
|
constructor() { |
|
|
|
@ -95,8 +96,9 @@ class LocalStorageService { |
|
|
|
window.localStorage.getItem(StorageKey.MEDIA_UPLOAD_SERVICE) ?? DEFAULT_NIP_96_SERVICE |
|
|
|
window.localStorage.getItem(StorageKey.MEDIA_UPLOAD_SERVICE) ?? DEFAULT_NIP_96_SERVICE |
|
|
|
|
|
|
|
|
|
|
|
this.autoplay = window.localStorage.getItem(StorageKey.AUTOPLAY) !== 'false' |
|
|
|
this.autoplay = window.localStorage.getItem(StorageKey.AUTOPLAY) !== 'false' |
|
|
|
|
|
|
|
this.hideUntrustedNotes = window.localStorage.getItem(StorageKey.HIDE_UNTRUSTED_NOTES) === 'true' |
|
|
|
|
|
|
|
|
|
|
|
const hideUntrustedEvents = |
|
|
|
const hideUntrustedNotes = |
|
|
|
window.localStorage.getItem(StorageKey.HIDE_UNTRUSTED_EVENTS) === 'true' |
|
|
|
window.localStorage.getItem(StorageKey.HIDE_UNTRUSTED_EVENTS) === 'true' |
|
|
|
const storedHideUntrustedInteractions = window.localStorage.getItem( |
|
|
|
const storedHideUntrustedInteractions = window.localStorage.getItem( |
|
|
|
StorageKey.HIDE_UNTRUSTED_INTERACTIONS |
|
|
|
StorageKey.HIDE_UNTRUSTED_INTERACTIONS |
|
|
|
@ -106,10 +108,11 @@ class LocalStorageService { |
|
|
|
) |
|
|
|
) |
|
|
|
this.hideUntrustedInteractions = storedHideUntrustedInteractions |
|
|
|
this.hideUntrustedInteractions = storedHideUntrustedInteractions |
|
|
|
? storedHideUntrustedInteractions === 'true' |
|
|
|
? storedHideUntrustedInteractions === 'true' |
|
|
|
: hideUntrustedEvents |
|
|
|
: hideUntrustedNotes |
|
|
|
this.hideUntrustedNotifications = storedHideUntrustedNotifications |
|
|
|
this.hideUntrustedNotifications = storedHideUntrustedNotifications |
|
|
|
? storedHideUntrustedNotifications === 'true' |
|
|
|
? storedHideUntrustedNotifications === 'true' |
|
|
|
: hideUntrustedEvents |
|
|
|
: hideUntrustedNotes |
|
|
|
|
|
|
|
this.hideUntrustedNotes = hideUntrustedNotes |
|
|
|
|
|
|
|
|
|
|
|
const translationServiceConfigMapStr = window.localStorage.getItem( |
|
|
|
const translationServiceConfigMapStr = window.localStorage.getItem( |
|
|
|
StorageKey.TRANSLATION_SERVICE_CONFIG_MAP |
|
|
|
StorageKey.TRANSLATION_SERVICE_CONFIG_MAP |
|
|
|
@ -301,6 +304,18 @@ class LocalStorageService { |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getHideUntrustedNotes() { |
|
|
|
|
|
|
|
return this.hideUntrustedNotes |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setHideUntrustedNotes(hideUntrustedNotes: boolean) { |
|
|
|
|
|
|
|
this.hideUntrustedNotes = hideUntrustedNotes |
|
|
|
|
|
|
|
window.localStorage.setItem( |
|
|
|
|
|
|
|
StorageKey.HIDE_UNTRUSTED_NOTES, |
|
|
|
|
|
|
|
hideUntrustedNotes.toString() |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getTranslationServiceConfig(pubkey?: string | null) { |
|
|
|
getTranslationServiceConfig(pubkey?: string | null) { |
|
|
|
return this.translationServiceConfigMap[pubkey ?? '_'] ?? { service: 'jumble' } |
|
|
|
return this.translationServiceConfigMap[pubkey ?? '_'] ?? { service: 'jumble' } |
|
|
|
} |
|
|
|
} |
|
|
|
|