mirror of
https://github.com/dergigi/boris.git
synced 2026-01-08 17:34:52 +01:00
feat: add offline highlight creation with local relay tracking
- Add relay tracking to Highlight type (publishedRelays, isLocalOnly fields) - Create utility functions to identify local relays (localhost/127.0.0.1) - Update highlight creation service to track which relays received the event - Detect when highlights are only on local relays and mark accordingly - Add visual indicator in UI for local-only highlights with amber badge - Enable immediate display of highlights created offline - Ensure highlights work even when only local relay is available
This commit is contained in:
@@ -40,3 +40,26 @@ export const classifyUrl = (url: string | undefined): UrlClassification => {
|
||||
return { type: 'article', buttonText: 'READ NOW' }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a relay URL is a local relay (localhost or 127.0.0.1)
|
||||
*/
|
||||
export const isLocalRelay = (relayUrl: string): boolean => {
|
||||
return relayUrl.includes('localhost') || relayUrl.includes('127.0.0.1')
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if all relays in the list are local relays
|
||||
*/
|
||||
export const areAllRelaysLocal = (relayUrls: string[]): boolean => {
|
||||
if (!relayUrls || relayUrls.length === 0) return false
|
||||
return relayUrls.every(isLocalRelay)
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if at least one relay is a remote (non-local) relay
|
||||
*/
|
||||
export const hasRemoteRelay = (relayUrls: string[]): boolean => {
|
||||
if (!relayUrls || relayUrls.length === 0) return false
|
||||
return relayUrls.some(url => !isLocalRelay(url))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user