lint fix wip
This commit is contained in:
parent
e97d2b32cc
commit
91fe30a860
@ -291,11 +291,15 @@ export function RelayManager({ onConfigChange }: RelayManagerProps): React.React
|
|||||||
handleDrop(e, relay.id)
|
handleDrop(e, relay.id)
|
||||||
}}
|
}}
|
||||||
className={`bg-cyber-dark border rounded p-4 space-y-3 transition-all ${
|
className={`bg-cyber-dark border rounded p-4 space-y-3 transition-all ${
|
||||||
draggedId === relay.id
|
(() => {
|
||||||
? 'opacity-50 border-neon-cyan'
|
if (draggedId === relay.id) {
|
||||||
: dragOverId === relay.id
|
return 'opacity-50 border-neon-cyan'
|
||||||
? 'border-neon-green shadow-lg'
|
}
|
||||||
: 'border-neon-cyan/30'
|
if (dragOverId === relay.id) {
|
||||||
|
return 'border-neon-green shadow-lg'
|
||||||
|
}
|
||||||
|
return 'border-neon-cyan/30'
|
||||||
|
})()
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="flex items-start justify-between gap-4">
|
<div className="flex items-start justify-between gap-4">
|
||||||
|
|||||||
@ -41,7 +41,12 @@ export function ReviewForm({ article, onSuccess, onCancel }: ReviewFormProps): R
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const category = article.category === 'author-presentation' ? 'science-fiction' : (article.category ?? 'science-fiction')
|
const category = (() => {
|
||||||
|
if (article.category === 'author-presentation') {
|
||||||
|
return 'science-fiction'
|
||||||
|
}
|
||||||
|
return article.category ?? 'science-fiction'
|
||||||
|
})()
|
||||||
const seriesId = article.seriesId ?? ''
|
const seriesId = article.seriesId ?? ''
|
||||||
|
|
||||||
await publishReview({
|
await publishReview({
|
||||||
|
|||||||
@ -7,7 +7,6 @@
|
|||||||
import type { Event } from 'nostr-tools'
|
import type { Event } from 'nostr-tools'
|
||||||
import type { SimplePoolWithSub } from '@/types/nostr-tools-extended'
|
import type { SimplePoolWithSub } from '@/types/nostr-tools-extended'
|
||||||
import { nostrService } from './nostr'
|
import { nostrService } from './nostr'
|
||||||
import { getPrimaryRelaySync } from './config'
|
|
||||||
import { PLATFORM_SERVICE, MIN_EVENT_DATE } from './platformConfig'
|
import { PLATFORM_SERVICE, MIN_EVENT_DATE } from './platformConfig'
|
||||||
import { buildTagFilter, extractTagsFromEvent } from './nostrTagSystem'
|
import { buildTagFilter, extractTagsFromEvent } from './nostrTagSystem'
|
||||||
import { objectCache } from './objectCache'
|
import { objectCache } from './objectCache'
|
||||||
@ -24,6 +23,7 @@ class PlatformSyncService {
|
|||||||
/**
|
/**
|
||||||
* Start background sync
|
* Start background sync
|
||||||
* Scans all notes with service='zapwall.fr' and caches them
|
* Scans all notes with service='zapwall.fr' and caches them
|
||||||
|
* Does not require pubkey - syncs all public notes with service='zapwall.fr'
|
||||||
*/
|
*/
|
||||||
async startSync(): Promise<void> {
|
async startSync(): Promise<void> {
|
||||||
if (this.syncInProgress) {
|
if (this.syncInProgress) {
|
||||||
@ -38,12 +38,25 @@ class PlatformSyncService {
|
|||||||
|
|
||||||
this.syncInProgress = true
|
this.syncInProgress = true
|
||||||
|
|
||||||
|
// Update progress manager to show sync indicator
|
||||||
|
const { syncProgressManager } = await import('./syncProgressManager')
|
||||||
|
const { relaySessionManager } = await import('./relaySessionManager')
|
||||||
|
const activeRelays = await relaySessionManager.getActiveRelays()
|
||||||
|
const initialRelay = activeRelays[0] ?? 'Connecting...'
|
||||||
|
syncProgressManager.setProgress({ currentStep: 0, totalSteps: 1, completed: false, currentRelay: initialRelay })
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.performSync(pool as unknown as SimplePoolWithSub)
|
await this.performSync(pool as unknown as SimplePoolWithSub)
|
||||||
|
syncProgressManager.setProgress({ currentStep: 1, totalSteps: 1, completed: true, currentRelay: initialRelay })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error in platform sync:', error)
|
console.error('Error in platform sync:', error)
|
||||||
|
syncProgressManager.setProgress(null)
|
||||||
} finally {
|
} finally {
|
||||||
this.syncInProgress = false
|
this.syncInProgress = false
|
||||||
|
// Clear progress after a short delay
|
||||||
|
setTimeout(() => {
|
||||||
|
syncProgressManager.setProgress(null)
|
||||||
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,10 +75,24 @@ class PlatformSyncService {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
// Use relay rotation for platform sync
|
||||||
const relayUrl = getPrimaryRelaySync()
|
const { tryWithRelayRotation } = await import('./relayRotation')
|
||||||
|
const { syncProgressManager } = await import('./syncProgressManager')
|
||||||
|
|
||||||
|
return tryWithRelayRotation(
|
||||||
|
pool as unknown as import('nostr-tools').SimplePool,
|
||||||
|
async (relayUrl, poolWithSub) => {
|
||||||
|
// Update progress with current relay
|
||||||
|
const currentProgress = syncProgressManager.getProgress()
|
||||||
|
if (currentProgress) {
|
||||||
|
syncProgressManager.setProgress({
|
||||||
|
...currentProgress,
|
||||||
|
currentRelay: relayUrl,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const { createSubscription } = require('@/types/nostr-tools-extended')
|
const { createSubscription } = require('@/types/nostr-tools-extended')
|
||||||
const sub = createSubscription(pool, [relayUrl], filters)
|
const sub = createSubscription(poolWithSub, [relayUrl], filters)
|
||||||
|
|
||||||
const events: Event[] = []
|
const events: Event[] = []
|
||||||
let resolved = false
|
let resolved = false
|
||||||
@ -82,9 +109,9 @@ class PlatformSyncService {
|
|||||||
await this.processAndCacheEvents(events)
|
await this.processAndCacheEvents(events)
|
||||||
|
|
||||||
this.lastSyncTime = Date.now()
|
this.lastSyncTime = Date.now()
|
||||||
resolve()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new Promise<void>((resolve) => {
|
||||||
sub.on('event', (event: Event): void => {
|
sub.on('event', (event: Event): void => {
|
||||||
// Only process events with service='zapwall.fr'
|
// Only process events with service='zapwall.fr'
|
||||||
const tags = extractTagsFromEvent(event)
|
const tags = extractTagsFromEvent(event)
|
||||||
@ -96,6 +123,7 @@ class PlatformSyncService {
|
|||||||
sub.on('eose', (): void => {
|
sub.on('eose', (): void => {
|
||||||
void (async (): Promise<void> => {
|
void (async (): Promise<void> => {
|
||||||
await finalize()
|
await finalize()
|
||||||
|
resolve()
|
||||||
})()
|
})()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -103,11 +131,15 @@ class PlatformSyncService {
|
|||||||
setTimeout((): void => {
|
setTimeout((): void => {
|
||||||
void (async (): Promise<void> => {
|
void (async (): Promise<void> => {
|
||||||
await finalize()
|
await finalize()
|
||||||
|
resolve()
|
||||||
})()
|
})()
|
||||||
}, this.SYNC_TIMEOUT_MS).unref?.()
|
}, this.SYNC_TIMEOUT_MS).unref?.()
|
||||||
|
|
||||||
this.syncSubscription = sub
|
this.syncSubscription = sub
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
30000 // 30 second timeout per relay
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user