lint fix wip
This commit is contained in:
parent
ec50e564b2
commit
fa1db1faa6
@ -11,7 +11,7 @@ interface PublicKeys {
|
||||
}
|
||||
|
||||
export function KeyManagementManager(): React.ReactElement {
|
||||
console.log('[KeyManagementManager] Component rendered')
|
||||
console.warn('[KeyManagementManager] Component rendered')
|
||||
|
||||
const [publicKeys, setPublicKeys] = useState<PublicKeys | null>(null)
|
||||
const [accountExists, setAccountExists] = useState(false)
|
||||
|
||||
@ -59,7 +59,7 @@ export function SponsoringForm({ author, onSuccess, onCancel }: SponsoringFormPr
|
||||
|
||||
// Store payment info for later verification
|
||||
// The user will need to provide the transaction ID after payment
|
||||
console.log('Sponsoring payment info:', {
|
||||
console.warn('Sponsoring payment info:', {
|
||||
authorAddress: result.authorAddress,
|
||||
platformAddress: result.platformAddress,
|
||||
authorAmount: result.split.authorSats,
|
||||
|
||||
@ -7,7 +7,7 @@ import { objectCache } from '@/lib/objectCache'
|
||||
import { t } from '@/lib/i18n'
|
||||
|
||||
export function SyncProgressBar(): React.ReactElement | null {
|
||||
console.log('[SyncProgressBar] Component function called')
|
||||
console.warn('[SyncProgressBar] Component function called')
|
||||
|
||||
const [syncProgress, setSyncProgress] = useState<SyncProgress | null>(null)
|
||||
const [isSyncing, setIsSyncing] = useState(false)
|
||||
@ -39,7 +39,7 @@ export function SyncProgressBar(): React.ReactElement | null {
|
||||
// Check connection state
|
||||
const checkConnection = (): void => {
|
||||
const state = nostrAuthService.getState()
|
||||
console.log('[SyncProgressBar] Initial connection check:', { connected: state.connected, pubkey: state.pubkey })
|
||||
console.warn('[SyncProgressBar] Initial connection check:', { connected: state.connected, pubkey: state.pubkey })
|
||||
setConnectionState({ connected: state.connected ?? false, pubkey: state.pubkey ?? null })
|
||||
setIsInitialized(true)
|
||||
}
|
||||
@ -49,7 +49,7 @@ export function SyncProgressBar(): React.ReactElement | null {
|
||||
|
||||
// Listen to connection changes
|
||||
const unsubscribe = nostrAuthService.subscribe((state) => {
|
||||
console.log('[SyncProgressBar] Connection state changed:', { connected: state.connected, pubkey: state.pubkey })
|
||||
console.warn('[SyncProgressBar] Connection state changed:', { connected: state.connected, pubkey: state.pubkey })
|
||||
setConnectionState({ connected: state.connected ?? false, pubkey: state.pubkey ?? null })
|
||||
})
|
||||
|
||||
@ -59,25 +59,25 @@ export function SyncProgressBar(): React.ReactElement | null {
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
console.log('[SyncProgressBar] Effect triggered:', { isInitialized, connected: connectionState.connected, pubkey: connectionState.pubkey, isSyncing })
|
||||
console.warn('[SyncProgressBar] Effect triggered:', { isInitialized, connected: connectionState.connected, pubkey: connectionState.pubkey, isSyncing })
|
||||
|
||||
if (!isInitialized) {
|
||||
console.log('[SyncProgressBar] Not initialized yet')
|
||||
console.warn('[SyncProgressBar] Not initialized yet')
|
||||
return
|
||||
}
|
||||
|
||||
if (!connectionState.connected) {
|
||||
console.log('[SyncProgressBar] Not connected')
|
||||
console.warn('[SyncProgressBar] Not connected')
|
||||
return
|
||||
}
|
||||
|
||||
if (!connectionState.pubkey) {
|
||||
console.log('[SyncProgressBar] No pubkey')
|
||||
console.warn('[SyncProgressBar] No pubkey')
|
||||
return
|
||||
}
|
||||
|
||||
void (async () => {
|
||||
console.log('[SyncProgressBar] Starting sync check...')
|
||||
console.warn('[SyncProgressBar] Starting sync check...')
|
||||
await loadSyncStatus()
|
||||
|
||||
// Auto-start sync if not recently synced
|
||||
@ -85,11 +85,11 @@ export function SyncProgressBar(): React.ReactElement | null {
|
||||
const currentTimestamp = getCurrentTimestamp()
|
||||
const isRecentlySynced = storedLastSyncDate >= currentTimestamp - 3600
|
||||
|
||||
console.log('[SyncProgressBar] Sync status:', { storedLastSyncDate, currentTimestamp, isRecentlySynced, isSyncing })
|
||||
console.warn('[SyncProgressBar] Sync status:', { storedLastSyncDate, currentTimestamp, isRecentlySynced, isSyncing })
|
||||
|
||||
// Only auto-start if not recently synced
|
||||
if (!isRecentlySynced && !isSyncing && connectionState.pubkey) {
|
||||
console.log('[SyncProgressBar] Starting auto-sync...')
|
||||
console.warn('[SyncProgressBar] Starting auto-sync...')
|
||||
setIsSyncing(true)
|
||||
setSyncProgress({ currentStep: 0, totalSteps: 6, completed: false })
|
||||
|
||||
@ -109,7 +109,7 @@ export function SyncProgressBar(): React.ReactElement | null {
|
||||
setError(autoSyncError instanceof Error ? autoSyncError.message : 'Erreur de synchronisation')
|
||||
}
|
||||
} else {
|
||||
console.log('[SyncProgressBar] Skipping auto-sync:', { isRecentlySynced, isSyncing, hasPubkey: Boolean(connectionState.pubkey) })
|
||||
console.warn('[SyncProgressBar] Skipping auto-sync:', { isRecentlySynced, isSyncing, hasPubkey: Boolean(connectionState.pubkey) })
|
||||
}
|
||||
})()
|
||||
}, [isInitialized, connectionState.connected, connectionState.pubkey, isSyncing])
|
||||
@ -159,11 +159,11 @@ export function SyncProgressBar(): React.ReactElement | null {
|
||||
|
||||
// Don't show if not initialized or not connected
|
||||
if (!isInitialized || !connectionState.connected || !connectionState.pubkey) {
|
||||
console.log('[SyncProgressBar] Not rendering:', { isInitialized, connected: connectionState.connected, pubkey: connectionState.pubkey })
|
||||
console.warn('[SyncProgressBar] Not rendering:', { isInitialized, connected: connectionState.connected, pubkey: connectionState.pubkey })
|
||||
return null
|
||||
}
|
||||
|
||||
console.log('[SyncProgressBar] Rendering component')
|
||||
console.warn('[SyncProgressBar] Rendering component')
|
||||
|
||||
// Check if sync is recently completed (within last hour)
|
||||
const isRecentlySynced = lastSyncDate !== null && lastSyncDate >= getCurrentTimestamp() - 3600
|
||||
|
||||
@ -106,7 +106,7 @@ export class ArticlePublisher {
|
||||
*/
|
||||
private logSendResult(result: import('./articlePublisherHelpers').SendContentResult, articleId: string, recipientPubkey: string): void {
|
||||
if (result.success) {
|
||||
console.log('Private content sent successfully', {
|
||||
console.warn('Private content sent successfully', {
|
||||
articleId,
|
||||
recipientPubkey,
|
||||
messageEventId: result.messageEventId,
|
||||
|
||||
@ -89,7 +89,7 @@ class NostrService {
|
||||
await Promise.all(pubs)
|
||||
} else {
|
||||
// Publish to all active relays
|
||||
console.log(`[NostrService] Publishing event ${event.id} to ${activeRelays.length} active relay(s)`)
|
||||
console.warn(`[NostrService] Publishing event ${event.id} to ${activeRelays.length} active relay(s)`)
|
||||
const pubs = this.pool.publish(activeRelays, event)
|
||||
|
||||
// Track failed relays and mark them inactive for the session
|
||||
|
||||
@ -360,18 +360,18 @@ async function fetchAndCachePurchases(
|
||||
}
|
||||
|
||||
sub.on('event', (event: Event): void => {
|
||||
console.log('[Sync] Received purchase event:', event.id)
|
||||
console.warn('[Sync] Received purchase event:', event.id)
|
||||
events.push(event)
|
||||
})
|
||||
|
||||
sub.on('eose', (): void => {
|
||||
console.log(`[Sync] EOSE for purchases, received ${events.length} events`)
|
||||
console.warn(`[Sync] EOSE for purchases, received ${events.length} events`)
|
||||
void done()
|
||||
})
|
||||
|
||||
setTimeout((): void => {
|
||||
if (!finished) {
|
||||
console.log(`[Sync] Timeout for purchases, received ${events.length} events`)
|
||||
console.warn(`[Sync] Timeout for purchases, received ${events.length} events`)
|
||||
}
|
||||
void done()
|
||||
}, 10000).unref?.()
|
||||
@ -461,18 +461,18 @@ async function fetchAndCacheSponsoring(
|
||||
}
|
||||
|
||||
sub.on('event', (event: Event): void => {
|
||||
console.log('[Sync] Received sponsoring event:', event.id)
|
||||
console.warn('[Sync] Received sponsoring event:', event.id)
|
||||
events.push(event)
|
||||
})
|
||||
|
||||
sub.on('eose', (): void => {
|
||||
console.log(`[Sync] EOSE for sponsoring, received ${events.length} events`)
|
||||
console.warn(`[Sync] EOSE for sponsoring, received ${events.length} events`)
|
||||
void done()
|
||||
})
|
||||
|
||||
setTimeout((): void => {
|
||||
if (!finished) {
|
||||
console.log(`[Sync] Timeout for sponsoring, received ${events.length} events`)
|
||||
console.warn(`[Sync] Timeout for sponsoring, received ${events.length} events`)
|
||||
}
|
||||
void done()
|
||||
}, 10000).unref?.()
|
||||
@ -562,18 +562,18 @@ async function fetchAndCacheReviewTips(
|
||||
}
|
||||
|
||||
sub.on('event', (event: Event): void => {
|
||||
console.log('[Sync] Received review tip event:', event.id)
|
||||
console.warn('[Sync] Received review tip event:', event.id)
|
||||
events.push(event)
|
||||
})
|
||||
|
||||
sub.on('eose', (): void => {
|
||||
console.log(`[Sync] EOSE for review tips, received ${events.length} events`)
|
||||
console.warn(`[Sync] EOSE for review tips, received ${events.length} events`)
|
||||
void done()
|
||||
})
|
||||
|
||||
setTimeout((): void => {
|
||||
if (!finished) {
|
||||
console.log(`[Sync] Timeout for review tips, received ${events.length} events`)
|
||||
console.warn(`[Sync] Timeout for review tips, received ${events.length} events`)
|
||||
}
|
||||
void done()
|
||||
}, 10000).unref?.()
|
||||
@ -687,7 +687,7 @@ async function fetchAndCachePaymentNotes(
|
||||
sub.on('event', (event: Event): void => {
|
||||
const tags = extractTagsFromEvent(event)
|
||||
if (tags.type === 'payment' && tags.payment) {
|
||||
console.log('[Sync] Received payment note event:', event.id)
|
||||
console.warn('[Sync] Received payment note event:', event.id)
|
||||
// Deduplicate events (same event might match both filters)
|
||||
if (!events.some((e) => e.id === event.id)) {
|
||||
events.push(event)
|
||||
@ -698,7 +698,7 @@ async function fetchAndCachePaymentNotes(
|
||||
sub.on('eose', (): void => {
|
||||
eoseCount++
|
||||
if (eoseCount >= subscriptions.length) {
|
||||
console.log(`[Sync] EOSE for payment notes, received ${events.length} events`)
|
||||
console.warn(`[Sync] EOSE for payment notes, received ${events.length} events`)
|
||||
void done()
|
||||
}
|
||||
})
|
||||
@ -706,7 +706,7 @@ async function fetchAndCachePaymentNotes(
|
||||
|
||||
setTimeout((): void => {
|
||||
if (!finished) {
|
||||
console.log(`[Sync] Timeout for payment notes, received ${events.length} events`)
|
||||
console.warn(`[Sync] Timeout for payment notes, received ${events.length} events`)
|
||||
}
|
||||
void done()
|
||||
}, 10000).unref?.()
|
||||
@ -763,51 +763,51 @@ export async function syncUserContentToCache(
|
||||
}
|
||||
|
||||
// Fetch and cache author profile (already caches itself)
|
||||
console.log('[Sync] Step 1/7: Fetching author profile...')
|
||||
console.warn('[Sync] Step 1/7: Fetching author profile...')
|
||||
await fetchAuthorPresentationFromPool(poolWithSub, userPubkey)
|
||||
console.log('[Sync] Step 1/7: Author profile fetch completed')
|
||||
console.warn('[Sync] Step 1/7: Author profile fetch completed')
|
||||
currentStep++
|
||||
updateProgress(currentStep)
|
||||
|
||||
// Fetch and cache all series
|
||||
console.log('[Sync] Step 2/7: Fetching series...')
|
||||
console.warn('[Sync] Step 2/7: Fetching series...')
|
||||
await fetchAndCacheSeries(poolWithSub, userPubkey)
|
||||
currentStep++
|
||||
updateProgress(currentStep)
|
||||
|
||||
// Fetch and cache all publications
|
||||
console.log('[Sync] Step 3/7: Fetching publications...')
|
||||
console.warn('[Sync] Step 3/7: Fetching publications...')
|
||||
await fetchAndCachePublications(poolWithSub, userPubkey)
|
||||
currentStep++
|
||||
updateProgress(currentStep)
|
||||
|
||||
// Fetch and cache all purchases (as payer)
|
||||
console.log('[Sync] Step 4/7: Fetching purchases...')
|
||||
console.warn('[Sync] Step 4/7: Fetching purchases...')
|
||||
await fetchAndCachePurchases(poolWithSub, userPubkey)
|
||||
currentStep++
|
||||
updateProgress(currentStep)
|
||||
|
||||
// Fetch and cache all sponsoring (as author)
|
||||
console.log('[Sync] Step 5/7: Fetching sponsoring...')
|
||||
console.warn('[Sync] Step 5/7: Fetching sponsoring...')
|
||||
await fetchAndCacheSponsoring(poolWithSub, userPubkey)
|
||||
currentStep++
|
||||
updateProgress(currentStep)
|
||||
|
||||
// Fetch and cache all review tips (as author)
|
||||
console.log('[Sync] Step 6/7: Fetching review tips...')
|
||||
console.warn('[Sync] Step 6/7: Fetching review tips...')
|
||||
await fetchAndCacheReviewTips(poolWithSub, userPubkey)
|
||||
currentStep++
|
||||
updateProgress(currentStep)
|
||||
|
||||
// Fetch and cache all payment notes (kind 1 with type='payment')
|
||||
console.log('[Sync] Step 7/7: Fetching payment notes...')
|
||||
console.warn('[Sync] Step 7/7: Fetching payment notes...')
|
||||
await fetchAndCachePaymentNotes(poolWithSub, userPubkey)
|
||||
currentStep++
|
||||
updateProgress(currentStep, true)
|
||||
|
||||
// Store the current timestamp as last sync date
|
||||
await setLastSyncDate(currentTimestamp)
|
||||
console.log('[Sync] Synchronization completed successfully')
|
||||
console.warn('[Sync] Synchronization completed successfully')
|
||||
} catch (syncError) {
|
||||
console.error('Error syncing user content to cache:', syncError)
|
||||
throw syncError // Re-throw to allow UI to handle it
|
||||
|
||||
@ -97,7 +97,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
|
||||
// Log request details for debugging (only for problematic endpoints)
|
||||
if (url.hostname.includes('nostrimg.com')) {
|
||||
console.log('NIP-95 proxy request to nostrimg.com:', {
|
||||
console.warn('NIP-95 proxy request to nostrimg.com:', {
|
||||
url: url.toString(),
|
||||
method: 'POST',
|
||||
fieldName,
|
||||
@ -131,7 +131,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
try {
|
||||
// Handle relative and absolute URLs
|
||||
redirectUrl = new URL(location, url.toString())
|
||||
console.log('NIP-95 proxy redirect:', {
|
||||
console.warn('NIP-95 proxy redirect:', {
|
||||
from: url.toString(),
|
||||
to: redirectUrl.toString(),
|
||||
statusCode,
|
||||
@ -160,7 +160,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
proxyResponse.on('end', () => {
|
||||
// Log response details for debugging problematic endpoints
|
||||
if (url.hostname.includes('nostrimg.com')) {
|
||||
console.log('NIP-95 proxy response from nostrimg.com:', {
|
||||
console.warn('NIP-95 proxy response from nostrimg.com:', {
|
||||
url: url.toString(),
|
||||
statusCode,
|
||||
statusMessage: proxyResponse.statusMessage,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user