lint fix wip

This commit is contained in:
Nicolas Cantu 2026-01-06 22:48:58 +01:00
parent ec50e564b2
commit fa1db1faa6
7 changed files with 41 additions and 41 deletions

View File

@ -11,7 +11,7 @@ interface PublicKeys {
} }
export function KeyManagementManager(): React.ReactElement { export function KeyManagementManager(): React.ReactElement {
console.log('[KeyManagementManager] Component rendered') console.warn('[KeyManagementManager] Component rendered')
const [publicKeys, setPublicKeys] = useState<PublicKeys | null>(null) const [publicKeys, setPublicKeys] = useState<PublicKeys | null>(null)
const [accountExists, setAccountExists] = useState(false) const [accountExists, setAccountExists] = useState(false)

View File

@ -59,7 +59,7 @@ export function SponsoringForm({ author, onSuccess, onCancel }: SponsoringFormPr
// Store payment info for later verification // Store payment info for later verification
// The user will need to provide the transaction ID after payment // The user will need to provide the transaction ID after payment
console.log('Sponsoring payment info:', { console.warn('Sponsoring payment info:', {
authorAddress: result.authorAddress, authorAddress: result.authorAddress,
platformAddress: result.platformAddress, platformAddress: result.platformAddress,
authorAmount: result.split.authorSats, authorAmount: result.split.authorSats,

View File

@ -7,7 +7,7 @@ import { objectCache } from '@/lib/objectCache'
import { t } from '@/lib/i18n' import { t } from '@/lib/i18n'
export function SyncProgressBar(): React.ReactElement | null { 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 [syncProgress, setSyncProgress] = useState<SyncProgress | null>(null)
const [isSyncing, setIsSyncing] = useState(false) const [isSyncing, setIsSyncing] = useState(false)
@ -39,7 +39,7 @@ export function SyncProgressBar(): React.ReactElement | null {
// Check connection state // Check connection state
const checkConnection = (): void => { const checkConnection = (): void => {
const state = nostrAuthService.getState() 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 }) setConnectionState({ connected: state.connected ?? false, pubkey: state.pubkey ?? null })
setIsInitialized(true) setIsInitialized(true)
} }
@ -49,7 +49,7 @@ export function SyncProgressBar(): React.ReactElement | null {
// Listen to connection changes // Listen to connection changes
const unsubscribe = nostrAuthService.subscribe((state) => { 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 }) setConnectionState({ connected: state.connected ?? false, pubkey: state.pubkey ?? null })
}) })
@ -59,25 +59,25 @@ export function SyncProgressBar(): React.ReactElement | null {
}, []) }, [])
useEffect(() => { 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) { if (!isInitialized) {
console.log('[SyncProgressBar] Not initialized yet') console.warn('[SyncProgressBar] Not initialized yet')
return return
} }
if (!connectionState.connected) { if (!connectionState.connected) {
console.log('[SyncProgressBar] Not connected') console.warn('[SyncProgressBar] Not connected')
return return
} }
if (!connectionState.pubkey) { if (!connectionState.pubkey) {
console.log('[SyncProgressBar] No pubkey') console.warn('[SyncProgressBar] No pubkey')
return return
} }
void (async () => { void (async () => {
console.log('[SyncProgressBar] Starting sync check...') console.warn('[SyncProgressBar] Starting sync check...')
await loadSyncStatus() await loadSyncStatus()
// Auto-start sync if not recently synced // Auto-start sync if not recently synced
@ -85,11 +85,11 @@ export function SyncProgressBar(): React.ReactElement | null {
const currentTimestamp = getCurrentTimestamp() const currentTimestamp = getCurrentTimestamp()
const isRecentlySynced = storedLastSyncDate >= currentTimestamp - 3600 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 // Only auto-start if not recently synced
if (!isRecentlySynced && !isSyncing && connectionState.pubkey) { if (!isRecentlySynced && !isSyncing && connectionState.pubkey) {
console.log('[SyncProgressBar] Starting auto-sync...') console.warn('[SyncProgressBar] Starting auto-sync...')
setIsSyncing(true) setIsSyncing(true)
setSyncProgress({ currentStep: 0, totalSteps: 6, completed: false }) 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') setError(autoSyncError instanceof Error ? autoSyncError.message : 'Erreur de synchronisation')
} }
} else { } 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]) }, [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 // Don't show if not initialized or not connected
if (!isInitialized || !connectionState.connected || !connectionState.pubkey) { 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 return null
} }
console.log('[SyncProgressBar] Rendering component') console.warn('[SyncProgressBar] Rendering component')
// Check if sync is recently completed (within last hour) // Check if sync is recently completed (within last hour)
const isRecentlySynced = lastSyncDate !== null && lastSyncDate >= getCurrentTimestamp() - 3600 const isRecentlySynced = lastSyncDate !== null && lastSyncDate >= getCurrentTimestamp() - 3600

View File

@ -106,7 +106,7 @@ export class ArticlePublisher {
*/ */
private logSendResult(result: import('./articlePublisherHelpers').SendContentResult, articleId: string, recipientPubkey: string): void { private logSendResult(result: import('./articlePublisherHelpers').SendContentResult, articleId: string, recipientPubkey: string): void {
if (result.success) { if (result.success) {
console.log('Private content sent successfully', { console.warn('Private content sent successfully', {
articleId, articleId,
recipientPubkey, recipientPubkey,
messageEventId: result.messageEventId, messageEventId: result.messageEventId,

View File

@ -89,7 +89,7 @@ class NostrService {
await Promise.all(pubs) await Promise.all(pubs)
} else { } else {
// Publish to all active relays // 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) const pubs = this.pool.publish(activeRelays, event)
// Track failed relays and mark them inactive for the session // Track failed relays and mark them inactive for the session

View File

@ -360,18 +360,18 @@ async function fetchAndCachePurchases(
} }
sub.on('event', (event: Event): void => { 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) events.push(event)
}) })
sub.on('eose', (): void => { 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() void done()
}) })
setTimeout((): void => { setTimeout((): void => {
if (!finished) { if (!finished) {
console.log(`[Sync] Timeout for purchases, received ${events.length} events`) console.warn(`[Sync] Timeout for purchases, received ${events.length} events`)
} }
void done() void done()
}, 10000).unref?.() }, 10000).unref?.()
@ -461,18 +461,18 @@ async function fetchAndCacheSponsoring(
} }
sub.on('event', (event: Event): void => { 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) events.push(event)
}) })
sub.on('eose', (): void => { 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() void done()
}) })
setTimeout((): void => { setTimeout((): void => {
if (!finished) { if (!finished) {
console.log(`[Sync] Timeout for sponsoring, received ${events.length} events`) console.warn(`[Sync] Timeout for sponsoring, received ${events.length} events`)
} }
void done() void done()
}, 10000).unref?.() }, 10000).unref?.()
@ -562,18 +562,18 @@ async function fetchAndCacheReviewTips(
} }
sub.on('event', (event: Event): void => { 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) events.push(event)
}) })
sub.on('eose', (): void => { 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() void done()
}) })
setTimeout((): void => { setTimeout((): void => {
if (!finished) { 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() void done()
}, 10000).unref?.() }, 10000).unref?.()
@ -687,7 +687,7 @@ async function fetchAndCachePaymentNotes(
sub.on('event', (event: Event): void => { sub.on('event', (event: Event): void => {
const tags = extractTagsFromEvent(event) const tags = extractTagsFromEvent(event)
if (tags.type === 'payment' && tags.payment) { 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) // Deduplicate events (same event might match both filters)
if (!events.some((e) => e.id === event.id)) { if (!events.some((e) => e.id === event.id)) {
events.push(event) events.push(event)
@ -698,7 +698,7 @@ async function fetchAndCachePaymentNotes(
sub.on('eose', (): void => { sub.on('eose', (): void => {
eoseCount++ eoseCount++
if (eoseCount >= subscriptions.length) { 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() void done()
} }
}) })
@ -706,7 +706,7 @@ async function fetchAndCachePaymentNotes(
setTimeout((): void => { setTimeout((): void => {
if (!finished) { 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() void done()
}, 10000).unref?.() }, 10000).unref?.()
@ -763,51 +763,51 @@ export async function syncUserContentToCache(
} }
// Fetch and cache author profile (already caches itself) // 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) 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++ currentStep++
updateProgress(currentStep) updateProgress(currentStep)
// Fetch and cache all series // 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) await fetchAndCacheSeries(poolWithSub, userPubkey)
currentStep++ currentStep++
updateProgress(currentStep) updateProgress(currentStep)
// Fetch and cache all publications // 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) await fetchAndCachePublications(poolWithSub, userPubkey)
currentStep++ currentStep++
updateProgress(currentStep) updateProgress(currentStep)
// Fetch and cache all purchases (as payer) // 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) await fetchAndCachePurchases(poolWithSub, userPubkey)
currentStep++ currentStep++
updateProgress(currentStep) updateProgress(currentStep)
// Fetch and cache all sponsoring (as author) // 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) await fetchAndCacheSponsoring(poolWithSub, userPubkey)
currentStep++ currentStep++
updateProgress(currentStep) updateProgress(currentStep)
// Fetch and cache all review tips (as author) // 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) await fetchAndCacheReviewTips(poolWithSub, userPubkey)
currentStep++ currentStep++
updateProgress(currentStep) updateProgress(currentStep)
// Fetch and cache all payment notes (kind 1 with type='payment') // 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) await fetchAndCachePaymentNotes(poolWithSub, userPubkey)
currentStep++ currentStep++
updateProgress(currentStep, true) updateProgress(currentStep, true)
// Store the current timestamp as last sync date // Store the current timestamp as last sync date
await setLastSyncDate(currentTimestamp) await setLastSyncDate(currentTimestamp)
console.log('[Sync] Synchronization completed successfully') console.warn('[Sync] Synchronization completed successfully')
} catch (syncError) { } catch (syncError) {
console.error('Error syncing user content to cache:', syncError) console.error('Error syncing user content to cache:', syncError)
throw syncError // Re-throw to allow UI to handle it throw syncError // Re-throw to allow UI to handle it

View File

@ -97,7 +97,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
// Log request details for debugging (only for problematic endpoints) // Log request details for debugging (only for problematic endpoints)
if (url.hostname.includes('nostrimg.com')) { 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(), url: url.toString(),
method: 'POST', method: 'POST',
fieldName, fieldName,
@ -131,7 +131,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
try { try {
// Handle relative and absolute URLs // Handle relative and absolute URLs
redirectUrl = new URL(location, url.toString()) redirectUrl = new URL(location, url.toString())
console.log('NIP-95 proxy redirect:', { console.warn('NIP-95 proxy redirect:', {
from: url.toString(), from: url.toString(),
to: redirectUrl.toString(), to: redirectUrl.toString(),
statusCode, statusCode,
@ -160,7 +160,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
proxyResponse.on('end', () => { proxyResponse.on('end', () => {
// Log response details for debugging problematic endpoints // Log response details for debugging problematic endpoints
if (url.hostname.includes('nostrimg.com')) { 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(), url: url.toString(),
statusCode, statusCode,
statusMessage: proxyResponse.statusMessage, statusMessage: proxyResponse.statusMessage,