53 Commits

Author SHA1 Message Date
a061cee73a lint fix wip 2026-01-06 23:40:47 +01:00
fa1db1faa6 lint fix wip 2026-01-06 22:48:58 +01:00
ec50e564b2 lint fix wip 2026-01-06 22:43:48 +01:00
e97d2b32cc lint fix wip 2026-01-06 21:44:43 +01:00
b7d65a55c7 lint fix wip 2026-01-06 21:16:28 +01:00
cdd923e981 lint fix wip 2026-01-06 20:59:59 +01:00
07b9d9d7bb lint fix wip 2026-01-06 18:09:23 +01:00
cc84d85193 lint fix wip 2026-01-06 16:44:12 +01:00
cc0f3816fa lint fix wip 2026-01-06 16:35:15 +01:00
ccf2fdf759 lint fix wip 2026-01-06 16:10:08 +01:00
303c0bf7df lint fix wip 2026-01-06 15:57:34 +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
c39e732049 Fix author page to use structured JSON data instead of raw content
**Motivations:**
- The author page was displaying the raw note content (visible part) instead of using the structured JSON data
- This caused elements like 'Nouveau profil publié sur zapwall.fr' to appear, which should not be visible
- The page should follow the structure of the creation form for consistency

**Root causes:**
- AuthorPageHeader was using presentation.content which contains the raw note visible content
- The structured data (description, contentDescription) extracted from JSON tags was not being used for display

**Correctifs:**
- Modified AuthorPageHeader to use presentation.description and presentation.contentDescription instead of presentation.content
- Extract author name from title (format: 'Présentation de <name>')
- Display structured fields following the creation form structure: presentation personnelle and description du contenu
- Fixed TypeScript errors for null/undefined handling

**Evolutions:**
- Author page now displays data in a structured way matching the creation form
- Better user experience with clear sections for presentation and content description

**Pages affectées:**
- pages/author/[pubkey].tsx
2026-01-06 14:54:49 +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
572ee2dde5 fix key import 2026-01-06 08:10:43 +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
94ac35f309 Fix: profil image 2026-01-05 22:57:46 +01:00
3740b93513 Add detailed logging for nostrimg.com requests to diagnose 500 errors
**Motivations:**
- Diagnose why nostrimg.com returns 500 errors
- Verify if the code is causing the errors or if it's a server-side issue
- Log request and response details for troubleshooting

**Root causes:**
- Unknown: Could be code issue (wrong field name, headers, format) or server issue
- Need detailed logs to determine the cause

**Correctifs:**
- Added detailed request logging for nostrimg.com:
  - URL, method, field name, filename, content type, file size
  - All headers (Content-Type, Accept, User-Agent, Authorization)
- Added detailed response logging for nostrimg.com:
  - Status code, status message, response headers
  - Body preview (500 chars), body length, HTML detection
- Added comment about field name ('file') - some endpoints might need different names

**Evolutions:**
- None

**Pages affectées:**
- pages/api/nip95-upload.ts
2026-01-05 22:56:07 +01:00
dbe4dba70f Fix: profil image 2026-01-05 22:51:30 +01:00
cee363c598 Add Accept and User-Agent headers, improve HTML error detection
**Motivations:**
- Some NIP-95 endpoints require Accept and User-Agent headers
- Better diagnosis of HTML error responses (404, 403, 500)
- More detailed error messages for troubleshooting

**Root causes:**
- Missing Accept: application/json header may cause endpoints to return HTML
- Missing User-Agent header may cause some servers to reject requests
- HTML error pages need better detection and classification

**Correctifs:**
- Added Accept: application/json header to all requests
- Added User-Agent: zapwall.fr/1.0 header to all requests
- Improved HTML error detection with 404/403/500 classification
- Enhanced error messages with specific suggestions based on error type
- Increased body preview in logs from 200 to 500 characters for better diagnosis

**Evolutions:**
- None

**Pages affectées:**
- pages/api/nip95-upload.ts
2026-01-05 22:50:37 +01:00
c7f8d301d5 Improve HTML response detection in NIP-95 upload API
**Motivations:**
- Better error handling when endpoints return HTML error pages instead of JSON
- Provide clearer error messages to users

**Root causes:**
- Some NIP-95 endpoints (e.g., nostrimg.com) return HTML error pages instead of JSON
- Current error handling only catches JSON parse errors without detecting HTML responses
- Users get confusing error messages about JSON parsing when the real issue is an HTML response

**Correctifs:**
- Added HTML detection before JSON parsing
- Extract error message from HTML title or h1 tags when possible
- Provide clearer error message indicating HTML response instead of JSON
- Improved error logging with HTML body preview

**Evolutions:**
- None

**Pages affectées:**
- pages/api/nip95-upload.ts
2026-01-05 22:49:05 +01:00
32b33d56a1 Add translations for settings page (fr/en)
**Motivations:**
- Translate settings page and all its components to French and English
- Provide consistent multilingual experience

**Root causes:**
- Settings page and components were hardcoded in English
- No translation support for key management and NIP-95 configuration

**Correctifs:**
- None (new feature)

**Evolutions:**
- Added translations for settings page title
- Added translations for KeyManagementManager component:
  - Public keys display (npub and hex)
  - Import form and validation messages
  - Recovery phrase display
  - All buttons and warnings
- Added translations for Nip95ConfigManager component:
  - Endpoint list and management
  - Add/edit/remove actions
  - Error messages
- Updated both fr.txt and en.txt translation files
- All text now uses t() function for i18n support

**Pages affectées:**
- pages/settings.tsx
- components/KeyManagementManager.tsx
- components/Nip95ConfigManager.tsx
- public/locales/fr.txt
- public/locales/en.txt
- locales/fr.txt
- locales/en.txt
2026-01-05 22:43:11 +01:00
7791370b37 Add key management configuration page
**Motivations:**
- Provide a dedicated interface for managing Nostr keys
- Allow users to view public keys (npub and hex)
- Enable importing private keys via URL or text format
- Respect the existing two-level encryption system

**Root causes:**
- No dedicated interface for key management
- Users need to view their public keys easily
- Users need to import keys in various formats (nsec URL, nsec text, hex)

**Correctifs:**
- None (new feature)

**Evolutions:**
- Created KeyManagementManager component for key management
- Added public key display (npub and hex formats)
- Implemented private key import with support for:
  - nostr:// URLs with nsec
  - nsec text format (nsec1...)
  - hex format (64 characters)
- Automatic key extraction from URLs
- Account replacement warning and confirmation
- Recovery phrase display after import
- Individual copy buttons for each key format
- Integration in settings page

**Pages affectées:**
- components/KeyManagementManager.tsx (new)
- pages/settings.tsx (modified)
- features/key-management-configuration.md (new)
2026-01-05 22:13:40 +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
065ab30828 Fix: favicon 404 error and NIP-95 upload 500 error
**Motivations:**
- Corriger l'erreur 404 pour favicon.ico demandé par les navigateurs
- Corriger l'erreur 500 de l'API NIP-95 upload empêchant les uploads de fichiers

**Root causes:**
- Fichier favicon.ico manquant dans public/ causant des erreurs 404 répétées
- Incompatibilité entre form-data (npm) et fetch() natif de Node.js dans l'API NIP-95

**Correctifs:**
- Ajout de favicon.svg et mise à jour des références dans les pages
- Remplacement de fetch() par https/http natifs de Node.js dans nip95-upload.ts
- Amélioration de la gestion des erreurs et nettoyage des fichiers temporaires

**Evolutions:**
- Documentation des problèmes et solutions dans fixKnowledge/

**Pages affectées:**
- components/HomeView.tsx
- pages/docs.tsx
- pages/presentation.tsx
- pages/api/nip95-upload.ts
- features/account-creation-buttons-separation.md
- fixKnowledge/favicon-404-error.md (nouveau)
- fixKnowledge/nip95-upload-500-error.md (nouveau)
- public/favicon.svg (nouveau)
2026-01-05 01:34:55 +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
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
970f8761ac Fix TypeScript syntax error in NIP-95 upload proxy endpoint by using interface 2025-12-29 00:20:26 +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
b8daab2bcd Remove initializeCookieCleanup function and migration code 2025-12-28 22:38:34 +01:00
46d5f03fbe Remove connection button and replace with direct account creation/import options 2025-12-28 20:35:50 +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
d3cae85b3d Update presentation page to dark theme and add language selector
- Update /presentation page to use dark theme (PageHeader, Footer, bg-cyber-darker)
- Add LanguageSelector component to PageHeader for all pages
- Update AuthorPresentationEditor to use dark theme styling
- Update ArticleField and ArticleFormButtons to use dark theme
- Add locale persistence in localStorage
- Update _app.tsx to load saved locale from localStorage
- All pages now support FR/EN language switching
2025-12-27 23:17:50 +01:00
5ea0ed21e1 Update /docs page with dark theme and modern styling
- Replace DocsHeader with PageHeader and Footer
- Update DocsSidebar with dark cyberpunk theme
- Update DocsContent with dark theme and styled prose
- Use i18n for page title
- All TypeScript checks pass
2025-12-27 23:01:34 +01:00
2a191f35f4 Fix all TypeScript errors and warnings
- Fix unused function warnings by renaming to _unusedExtractTags
- Fix type errors in nostrTagSystem.ts for includes() calls
- Fix type errors in reviews.ts for filter kinds array
- Fix ArrayBuffer type errors in articleEncryption.ts
- Remove unused imports (DecryptionKey, decryptArticleContent, extractTagsFromEvent)
- All TypeScript checks now pass without disabling any controls
2025-12-27 22:26:13 +01:00
90ff8282f1 feat: Implémentation système de commissions systématique et incontournable
- Création lib/platformCommissions.ts : configuration centralisée des commissions
  - Articles : 800 sats (700 auteur, 100 plateforme)
  - Avis : 70 sats (49 lecteur, 21 plateforme)
  - Sponsoring : 0.046 BTC (0.042 auteur, 0.004 plateforme)

- Validation des montants à chaque étape :
  - Publication : vérification du montant avant publication
  - Paiement : vérification du montant avant acceptation
  - Erreurs explicites si montant incorrect

- Tracking des commissions sur Nostr :
  - Tags author_amount et platform_commission dans événements
  - Interface ContentDeliveryTracking étendue
  - Traçabilité complète pour audit

- Logs structurés avec informations de commission
- Documentation complète du système

Les commissions sont maintenant systématiques, validées et traçables.
2025-12-27 21:11:09 +01:00