feat: configurable favicon service URL (#659)

This commit is contained in:
Alex Gleason 2025-11-14 05:28:10 -03:00 committed by GitHub
parent e544c0a801
commit f8cca5522f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 151 additions and 20 deletions

View file

@ -1,4 +1,5 @@
import {
DEFAULT_FAVICON_URL_TEMPLATE,
DEFAULT_NIP_96_SERVICE,
ExtendedKind,
MEDIA_AUTO_LOAD_POLICY,
@ -52,6 +53,7 @@ class LocalStorageService {
private sidebarCollapse: boolean = false
private primaryColor: TPrimaryColor = 'DEFAULT'
private enableSingleColumnLayout: boolean = true
private faviconUrlTemplate: string = DEFAULT_FAVICON_URL_TEMPLATE
constructor() {
if (!LocalStorageService.instance) {
@ -205,6 +207,9 @@ class LocalStorageService {
this.enableSingleColumnLayout =
window.localStorage.getItem(StorageKey.ENABLE_SINGLE_COLUMN_LAYOUT) !== 'false'
this.faviconUrlTemplate =
window.localStorage.getItem(StorageKey.FAVICON_URL_TEMPLATE) ?? DEFAULT_FAVICON_URL_TEMPLATE
// Clean up deprecated data
window.localStorage.removeItem(StorageKey.ACCOUNT_PROFILE_EVENT_MAP)
window.localStorage.removeItem(StorageKey.ACCOUNT_FOLLOW_LIST_EVENT_MAP)
@ -515,6 +520,15 @@ class LocalStorageService {
this.enableSingleColumnLayout = enable
window.localStorage.setItem(StorageKey.ENABLE_SINGLE_COLUMN_LAYOUT, enable.toString())
}
getFaviconUrlTemplate() {
return this.faviconUrlTemplate
}
setFaviconUrlTemplate(template: string) {
this.faviconUrlTemplate = template
window.localStorage.setItem(StorageKey.FAVICON_URL_TEMPLATE, template)
}
}
const instance = new LocalStorageService()