feat: hide notifications from untrusted users

This commit is contained in:
codytseng
2025-06-01 23:00:01 +08:00
parent 587038d51a
commit c17d1b8ab5
18 changed files with 81 additions and 33 deletions

View File

@@ -25,7 +25,7 @@ class LocalStorageService {
private accountFeedInfoMap: Record<string, TFeedInfo | undefined> = {}
private mediaUploadService: string = DEFAULT_NIP_96_SERVICE
private autoplay: boolean = true
private hideUntrustedReplies: boolean = true
private hideUntrustedEvents: boolean = true
constructor() {
if (!LocalStorageService.instance) {
@@ -93,8 +93,8 @@ class LocalStorageService {
this.autoplay = window.localStorage.getItem(StorageKey.AUTOPLAY) !== 'false'
this.hideUntrustedReplies =
window.localStorage.getItem(StorageKey.HIDE_UNTRUSTED_REPLIES) !== 'false'
this.hideUntrustedEvents =
window.localStorage.getItem(StorageKey.HIDE_UNTRUSTED_EVENTS) !== 'false'
// Clean up deprecated data
window.localStorage.removeItem(StorageKey.ACCOUNT_PROFILE_EVENT_MAP)
@@ -252,12 +252,13 @@ class LocalStorageService {
window.localStorage.setItem(StorageKey.AUTOPLAY, autoplay.toString())
}
getHideUntrustedReplies() {
return this.hideUntrustedReplies
getHideUntrustedEvents() {
return this.hideUntrustedEvents
}
setHideUntrustedReplies(hide: boolean) {
this.hideUntrustedReplies = hide
window.localStorage.setItem(StorageKey.HIDE_UNTRUSTED_REPLIES, hide.toString())
setHideUntrustedEvents(hide: boolean) {
this.hideUntrustedEvents = hide
window.localStorage.setItem(StorageKey.HIDE_UNTRUSTED_EVENTS, hide.toString())
}
}