64 Commits

Author SHA1 Message Date
390f895920 lint fix wip 2026-01-06 15:41:58 +01:00
29cb20c614 Fix authors not loading from cache on startup
**Motivations:**
- Authors were not being loaded from cache, causing 'Aucun contenu trouvé' message even when authors exist
- useArticles only loaded articles from Nostr subscription, not authors from cache
- Authors should be loaded from cache first (cache-first architecture)

**Root causes:**
- useArticles hook only subscribed to articles from Nostr, not loading authors from cache
- No method to get all authors from cache
- Authors were only extracted from articles returned by subscription, which may not include author presentations

**Correctifs:**
- Added getAll method to objectCache to retrieve all objects of a type from cache
- Modified useArticles to load authors from cache on startup before subscribing to Nostr
- Authors are now loaded from cache and merged with articles from subscription
- totalSponsoring is calculated for each author when loading from cache

**Evolutions:**
- Authors are now available immediately from cache on page load
- Better user experience: no 'Aucun contenu trouvé' when authors exist in cache
- Cache-first architecture: authors loaded from cache before Nostr subscription

**Pages affectées:**
- lib/objectCache.ts
- hooks/useArticles.ts
2026-01-06 15:33:02 +01:00
52bd9492b7 lint fix wip 2026-01-06 15:11:52 +01:00
f5d9033183 Refactor to use cache-first architecture with background sync
**Motivations:**
- total_sponsoring should be calculated from cache, not stored in tags
- Author searches should use cache first, not query Nostr directly
- All elements should be read/written from/to database
- Background sync should scan all notes with service='zapwall.fr' tag and update cache
- Sync should run at startup and resume on each page navigation

**Root causes:**
- total_sponsoring was stored in tags which required updates on every sponsoring payment
- Author queries were querying Nostr directly instead of using cache
- No background sync service to keep cache up to date with new notes

**Correctifs:**
- Removed totalSponsoring from AuthorTags interface and buildAuthorTags
- Modified getAuthorSponsoring to calculate from cache (sponsoring queries) instead of tags
- Modified parsePresentationEvent to set totalSponsoring to 0 (calculated on demand from cache)
- Modified fetchAuthorByHashId and fetchAuthorPresentationFromPool to use cache first and calculate totalSponsoring from cache
- Created platformSyncService that scans all notes with service='zapwall.fr' tag and caches them
- Modified _app.tsx to start continuous sync on mount and resume on page navigation
- All author presentations now calculate totalSponsoring from cache when loaded

**Evolutions:**
- Cache-first architecture: all queries check cache before querying Nostr
- Background sync service keeps cache up to date automatically
- totalSponsoring is always calculated from actual sponsoring data in cache
- Better performance: cache queries are faster than Nostr queries
- Non-blocking sync: background sync doesn't block UI

**Pages affectées:**
- lib/nostrTagSystemTypes.ts
- lib/nostrTagSystemBuild.ts
- lib/articlePublisherHelpersPresentation.ts
- lib/sponsoring.ts
- lib/authorQueries.ts
- lib/platformSync.ts (new)
- pages/_app.tsx
2026-01-06 15:04:14 +01:00
cc49c9d7c1 Add language preference selector in settings
**Motivations:**
- Allow users to set their preferred language (fr/en) in the settings page
- Load language preference from localStorage at startup to configure the application locale

**Root causes:**
- Language preference was only available in the header via LanguageSelector component
- Language preference was stored in IndexedDB instead of localStorage
- No centralized language settings management in the settings page

**Correctifs:**
- Created LanguageSettingsManager component for settings page
- Migrated language storage from IndexedDB to localStorage for consistency
- Updated _app.tsx to load locale from localStorage synchronously at startup
- Updated useI18n hook to use localStorage instead of IndexedDB
- Updated LanguageSelector component to use localStorage instead of IndexedDB

**Evolutions:**
- Added language preference section in settings page (displayed first)
- Language preference is now loaded at application startup from localStorage
- Added translations for language settings (settings.language.*)

**Pages affectées:**
- components/LanguageSettingsManager.tsx (new)
- pages/settings.tsx
- pages/_app.tsx
- hooks/useI18n.ts
- components/LanguageSelector.tsx
- locales/fr.txt
- locales/en.txt
2026-01-06 14:57:38 +01:00
8e7d234e68 lint fix wip3 2026-01-06 14:48:13 +01:00
1c9f3a2afa lint fix wip3 2026-01-06 14:41:02 +01:00
ba5f4a6cc4 lint fix wip3 2026-01-06 14:38:38 +01:00
f6cd63a34d lint fix wip3 2026-01-06 14:33:32 +01:00
20032c00ae lint fix wip2 2026-01-06 14:28:19 +01:00
a219d1ad42 lint fix wip2 2026-01-06 14:24:35 +01:00
13e0e0d801 lint fix wip 2026-01-06 14:17:55 +01:00
412989e6af lint fix wip 2026-01-06 11:30:23 +01:00
5ac5aab089 series wip & code quality checks 2026-01-06 09:26:07 +01:00
572ee2dde5 fix key import 2026-01-06 08:10:43 +01:00
a4a39fd0ba fix 'Chargement..' for profil 2026-01-06 01:11:20 +01:00
05382f34ab series building 2026-01-06 00:54:49 +01:00
ba0fcbfc96 series building 2026-01-06 00:37:49 +01:00
758ab5c966 series building 2026-01-06 00:26:31 +01:00
4a619c9576 series building 2026-01-05 23:37:29 +01:00
4787bd5410 Fix: profil image2 2026-01-05 23:24:10 +01:00
a058056475 Fix: profil image2 2026-01-05 23:07:12 +01:00
4e3254a078 Temporarily enable nostrimg.com for diagnostic logging
**Motivations:**
- Enable nostrimg.com to see detailed diagnostic logs
- Verify if the issue is code-related or server-side
- Collect logs to diagnose 500 errors

**Root causes:**
- Need to see actual request/response logs to diagnose the issue

**Correctifs:**
- Temporarily enabled nostrimg.com (enabled: true)
- Added comment indicating it's for diagnostic purposes
- Detailed logging already in place to capture request/response details

**Evolutions:**
- None

**Pages affectées:**
- lib/configStorageTypes.ts
2026-01-05 22:57:13 +01:00
2b5df250f6 Improve NIP-98 error messages and disable nostrimg.com by default
**Motivations:**
- Provide clearer error messages when NIP-98 authentication is not available
- Disable nostrimg.com by default since it returns server errors (500)
- Help users understand why nostrcheck.me endpoint is skipped

**Root causes:**
- NIP-98 authentication requires unlocked account but error message was generic
- nostrimg.com endpoint consistently returns 500 errors
- Users don't understand why nostrcheck.me is skipped

**Correctifs:**
- Added detailed error messages for NIP-98 unavailability:
  - No account: 'Please create or import an account'
  - Account not unlocked: 'Please unlock your account with your recovery phrase'
- Disabled nostrimg.com by default (enabled: false) due to server errors
- Improved console warnings with specific reasons for skipping endpoints

**Evolutions:**
- None

**Pages affectées:**
- lib/nip95.ts
- lib/configStorageTypes.ts
2026-01-05 22:53:45 +01:00
d7a04dd8f8 Fix nsec import validation for Uint8Array data
**Motivations:**
- Fix import error when importing nsec private keys
- Support both string and Uint8Array formats from nip19.decode

**Root causes:**
- nip19.decode returns decoded.data as Uint8Array, not string
- Validation in KeyManagementManager only checked for string type
- importPrivateKey in keyManagement.ts only handled string type

**Correctifs:**
- Updated KeyManagementManager validation to accept Uint8Array
- Updated importPrivateKey to convert Uint8Array to hex using bytesToHex
- Improved error messages to show actual validation errors

**Evolutions:**
- None

**Pages affectées:**
- components/KeyManagementManager.tsx
- lib/keyManagement.ts
2026-01-05 22:38:21 +01:00
57ac98ebe4 Fix: NIP-95 upload 500 error 2026-01-05 22:14:01 +01:00
b5ec69624c Fix: NIP-95 upload 500 error 2026-01-05 22:07:11 +01:00
d8311078bc Fix: NIP-95 upload 500 error 2026-01-05 21:56:09 +01:00
a90b77cec3 Fix: NIP-95 upload 500 error 2026-01-05 21:22:49 +01:00
17aa64070e Change default NIP-95 endpoint to void.cat as nostr.build returns 405 2025-12-29 00:59:04 +01:00
35d4a94bb4 Change default NIP-95 endpoint back to nostr.build for proxy usage 2025-12-29 00:33:12 +01:00
0533122919 Always use proxy for all NIP-95 uploads to avoid all endpoint issues 2025-12-29 00:32:01 +01:00
a4820da2df Use proxy for all NIP-95 uploads to avoid CORS and endpoint issues, improve error logging 2025-12-29 00:30:54 +01:00
bafd8ca0bc Change default NIP-95 endpoint to picstr.build and fix proxy to accept endpoint parameter 2025-12-29 00:27:00 +01:00
7bab834f89 Fix multipart parsing in NIP-95 upload proxy by removing manual Content-Type header and improving error handling 2025-12-29 00:23:00 +01:00
2b57b1d445 Add proxy API endpoint for NIP-95 upload to bypass CORS issues with nostr.build 2025-12-29 00:17:10 +01:00
07b9f513bb Change default NIP-95 endpoint to nostrcheck.me as void.cat is not accessible 2025-12-29 00:10:03 +01:00
333c8e4d7f Fix CORS issue by changing default NIP-95 endpoint to void.cat and adding fallback to try multiple endpoints 2025-12-28 23:41:52 +01:00
a2656ef3f8 Fix: Replace pool.sub() with createSubscription() for nostr-tools 2.19.4 compatibility 2025-12-28 22:56:34 +01:00
b8daab2bcd Remove initializeCookieCleanup function and migration code 2025-12-28 22:38:34 +01:00
42e3e7e692 Update all dependencies to latest versions and fix compatibility issues
**Motivations:**
- Keep dependencies up to date for security and features
- Automate dependency updates in deployment script
- Fix compatibility issues with major version updates (React 19, Next.js 16, nostr-tools 2.x)

**Root causes:**
- Dependencies were outdated
- Deployment script did not update dependencies before deploying
- Major version updates introduced breaking API changes

**Correctifs:**
- Updated all dependencies to latest versions using npm-check-updates
- Modified deploy.sh to run npm-check-updates before installing dependencies
- Fixed nostr-tools 2.x API changes (generatePrivateKey -> generateSecretKey, signEvent -> finalizeEvent, verifySignature -> verifyEvent)
- Fixed React 19 ref types to accept null
- Fixed JSX namespace issues (JSX.Element -> React.ReactElement)
- Added proper types for event callbacks
- Fixed SimplePool.sub typing issues with type assertions

**Evolutions:**
- Deployment script now automatically updates dependencies to latest versions before deploying
- All dependencies updated to latest versions (Next.js 14->16, React 18->19, nostr-tools 1->2, etc.)

**Pages affectées:**
- package.json
- deploy.sh
- lib/keyManagement.ts
- lib/nostr.ts
- lib/nostrRemoteSigner.ts
- lib/zapVerification.ts
- lib/platformTrackingEvents.ts
- lib/sponsoringTracking.ts
- lib/articlePublisherHelpersVerification.ts
- lib/contentDeliveryVerification.ts
- lib/paymentPollingZapReceipt.ts
- lib/nostrPrivateMessages.ts
- lib/nostrSubscription.ts
- lib/nostrZapVerification.ts
- lib/markdownRenderer.tsx
- components/AuthorFilter.tsx
- components/AuthorFilterButton.tsx
- components/UserArticlesList.tsx
- types/nostr-tools-extended.ts
2025-12-28 21:49:19 +01:00
46d5f03fbe Remove connection button and replace with direct account creation/import options 2025-12-28 20:35:50 +01:00
55a70866eb Add NIP-95 upload endpoint documentation and improve error message
- Add NEXT_PUBLIC_NIP95_UPLOAD_URL to README environment variables section
- Add NIP-95 upload service documentation with examples
- Create .env.example file with all required environment variables
- Improve error message to guide users to README for setup instructions
- All TypeScript checks pass
2025-12-28 16:19:48 +01:00
a19b601205 Add image upload to presentation form and profile note
- Add ImageUploadField component for profile picture upload (NIP-95)
- Add pictureUrl field to AuthorPresentationDraft interface
- Store picture URL in Nostr event tags as 'picture'
- Display profile picture on author page
- Add discrete note indicating zapwall.fr profile differs from Nostr profile
- Update translations (FR/EN) for profile note
- All TypeScript checks pass
2025-12-28 16:11:54 +01:00
398b9506e6 Remove duplicate title and description from presentation page
- Remove title and description from pages/presentation.tsx
- Keep title with user name in AuthorPresentationEditor form
- Fix duplicate display issue
2025-12-27 23:56:31 +01:00
cb7ee0cfd4 Replace nos2x and NostrConnect with Alby authentication
- Remove nos2x and NostrConnect support
- Create new NostrAuthService using Alby (window.nostr NIP-07)
- Replace useNostrConnect with useNostrAuth in all components
- Update NostrRemoteSigner to use Alby for signing
- Delete NostrConnect-related files (nostrconnect.ts, handlers, etc.)
- Update documentation to reflect Alby-only authentication
- Remove NOSTRCONNECT_BRIDGE environment variable
- All TypeScript checks pass
2025-12-27 23:54:34 +01:00
fd26c42a17 Replace use.nsec.app with nos2x extension (NIP-07)
- Update NostrConnectService to use nos2x (window.nostr) by default
- Fallback to NostrConnect bridge only if nos2x is not available
- Update NostrRemoteSigner to use window.nostr.signEvent() for signing
- Add TypeScript definitions for NIP-07 window.nostr API
- Update documentation to reflect nos2x as primary authentication method
- Remove default use.nsec.app bridge URL
- All TypeScript checks pass
2025-12-27 23:48:16 +01:00
6d478acd2c Remove unused _unusedExtractTags function
- Function was kept for backward compatibility but is never used
- Removing it to fix TypeScript warning
- All TypeScript checks now pass
2025-12-27 23:27:13 +01:00
716ba4b9b6 Remove unused MediaRef import
- Remove MediaRef from imports in nostrEventParsing.ts
- All TypeScript checks now pass
2025-12-27 23:19:10 +01:00
ef3d2cf52e Fix TypeScript errors
- Remove unused 't' import from HomeView.tsx
- Fix _unusedExtractTags function to properly mark parameter as unused
- All TypeScript checks now pass
2025-12-27 23:18:39 +01:00