feat: support configurable trust score threshold per context
This commit is contained in:
parent
28a1b3096a
commit
ca9610b711
46 changed files with 350 additions and 122 deletions
|
|
@ -64,9 +64,10 @@ class LocalStorageService {
|
|||
private quickReaction: boolean = false
|
||||
private quickReactionEmoji: string | TEmoji = '+'
|
||||
private nsfwDisplayPolicy: TNsfwDisplayPolicy = NSFW_DISPLAY_POLICY.HIDE_CONTENT
|
||||
private minTrustScore: number = 40
|
||||
private defaultRelayUrls: string[] = BIG_RELAY_URLS
|
||||
private mutedWords: string[] = []
|
||||
private minTrustScore: number = 0
|
||||
private minTrustScoreMap: Record<string, number> = {}
|
||||
|
||||
constructor() {
|
||||
if (!LocalStorageService.instance) {
|
||||
|
|
@ -278,6 +279,18 @@ class LocalStorageService {
|
|||
}
|
||||
}
|
||||
|
||||
const minTrustScoreMapStr = window.localStorage.getItem(StorageKey.MIN_TRUST_SCORE_MAP)
|
||||
if (minTrustScoreMapStr) {
|
||||
try {
|
||||
const map = JSON.parse(minTrustScoreMapStr)
|
||||
if (typeof map === 'object' && map !== null) {
|
||||
this.minTrustScoreMap = map
|
||||
}
|
||||
} catch {
|
||||
// Invalid JSON, use default
|
||||
}
|
||||
}
|
||||
|
||||
const defaultRelayUrlsStr = window.localStorage.getItem(StorageKey.DEFAULT_RELAY_URLS)
|
||||
if (defaultRelayUrlsStr) {
|
||||
try {
|
||||
|
|
@ -645,6 +658,15 @@ class LocalStorageService {
|
|||
}
|
||||
}
|
||||
|
||||
getMinTrustScoreMap() {
|
||||
return this.minTrustScoreMap
|
||||
}
|
||||
|
||||
setMinTrustScoreMap(map: Record<string, number>) {
|
||||
this.minTrustScoreMap = map
|
||||
window.localStorage.setItem(StorageKey.MIN_TRUST_SCORE_MAP, JSON.stringify(map))
|
||||
}
|
||||
|
||||
getDefaultRelayUrls() {
|
||||
return this.defaultRelayUrls
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue