130 Commits

Author SHA1 Message Date
303c0bf7df lint fix wip 2026-01-06 15:57:34 +01:00
390f895920 lint fix wip 2026-01-06 15:41:58 +01:00
c8479efece Add missing language settings translations
**Motivations:**
- Missing translations for language settings in public locale files
- settings.language.title, settings.language.description, settings.language.french, and settings.language.english were missing from public/locales files

**Root causes:**
- Translations existed in locales/ but not in public/locales/
- LanguageSettingsManager component uses these keys but they were not available in public files

**Correctifs:**
- Added settings.language.title=Langue de préférence in public/locales/fr.txt
- Added settings.language.description=Choisissez votre langue préférée pour l'interface in public/locales/fr.txt
- Added settings.language.loading=Chargement... in public/locales/fr.txt
- Added settings.language.french=Français in public/locales/fr.txt
- Added settings.language.english=Anglais in public/locales/fr.txt
- Added settings.language.title=Preferred Language in public/locales/en.txt
- Added settings.language.description=Choose your preferred language for the interface in public/locales/en.txt
- Added settings.language.loading=Loading... in public/locales/en.txt
- Added settings.language.french=French in public/locales/en.txt
- Added settings.language.english=English in public/locales/en.txt

**Evolutions:**
- Language settings now display correctly in both French and English
- All translation keys are now available in public locale files

**Pages affectées:**
- public/locales/fr.txt
- public/locales/en.txt
2026-01-06 15:41:03 +01:00
a50d308578 lint fix wip 2026-01-06 15:35:06 +01:00
fbcf8fcd91 Add spinner and page reload after cache update
**Motivations:**
- User requested spinner during cache update and page reload after completion
- Better UX: visual feedback during update and automatic refresh to show updated data

**Root causes:**
- No visual spinner during cache update operation
- Page was not reloaded after cache update, requiring manual refresh

**Correctifs:**
- Added Spinner component with CSS animation
- Modified button to show spinner during update
- Added page reload using router.reload() after successful cache update
- Wait 1 second after success message before reloading to show feedback

**Evolutions:**
- Better user experience with visual feedback during cache update
- Automatic page reload ensures updated data is displayed immediately
- Spinner provides clear indication that operation is in progress

**Pages affectées:**
- components/CacheUpdateManager.tsx
2026-01-06 15:34:26 +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
568ec17f03 Document language preference settings feature 2026-01-06 14:58:09 +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
8e7d234e68 lint fix wip3 2026-01-06 14:48:13 +01:00
b22259ff2f Remove SSH multiplexing to eliminate connection errors
**Motivations:**
- SSH multiplexing (ControlMaster) was causing connection reset errors
- Complex socket management was creating more problems than it solved
- Script makes sequential SSH calls, so multiplexing not necessary
- Simpler is better - remove unnecessary complexity

**Root causes:**
- ControlMaster multiplexing was added to avoid MaxStartups errors
- But it caused connection reset, socket invalidation, and cleanup issues
- Root cause: unnecessary complexity that created more problems than it solved
- Sequential SSH calls don't need multiplexing anyway

**Correctifs:**
- Removed all ControlMaster/ControlPath configuration
- Removed cleanup_dead_ssh() function
- Removed cleanup_ssh() trap
- Removed SSH_CONTROL_DIR and SSH_CONTROL_PATH variables
- Simplified ssh_exec() to basic SSH call without multiplexing
- Kept only ConnectTimeout for basic connection management

**Evolutions:**
- Much simpler code without socket management complexity
- No more connection reset errors from multiplexing
- No more socket cleanup issues
- Each SSH call is independent and reliable

**Pages affectées:**
- deploy.sh: Removed all ControlMaster multiplexing code, simplified to basic SSH
2026-01-06 14:47:46 +01:00
03d0c6e4bc Remove check_ssh_connection that causes connection reset errors
**Motivations:**
- check_ssh_connection() was causing connection reset errors
- Trying to use a potentially dead ControlMaster connection for checking interferes with multiplexing
- SSH ControlMaster=auto can handle invalid sockets automatically

**Root causes:**
- check_ssh_connection() uses ssh with ControlPath to test connection
- If connection is dead, this causes 'Connection reset by peer' errors
- This check interferes with ControlMaster multiplexing
- Root cause: unnecessary pre-check that causes more problems than it solves

**Correctifs:**
- Removed check_ssh_connection() function completely
- Removed pre-execution connection validation from ssh_exec()
- Let SSH ControlMaster=auto handle invalid sockets automatically
- SSH will detect invalid socket and create new connection automatically
- Removed unnecessary keepalive options (not needed if no firewall/NAT issues)
- Simplified to basic ControlMaster configuration

**Evolutions:**
- Simpler code without interference from connection checks
- SSH handles connection management automatically
- No more connection reset errors from check_ssh_connection()

**Pages affectées:**
- deploy.sh: Removed check_ssh_connection() and simplified ssh_exec()
2026-01-06 14:46:33 +01:00
b096efe072 Fix root cause of SSH connection drops with proper keepalive configuration
**Motivations:**
- SSH connections were being dropped by firewalls/NAT due to insufficient keepalives
- Connection reset by peer errors were occurring because connections were idle too long
- Need to prevent connection drops at the source, not just handle errors after

**Root causes:**
- ServerAliveInterval=60 was too long - many firewalls/NAT close idle connections after 30-45 seconds
- No TCPKeepAlive enabled - missing system-level keepalives
- ControlPersist=300 kept dead connections too long
- ServerAliveCountMax=3 was too lenient for detecting dead connections
- Root cause: connections were being closed by network equipment due to inactivity

**Correctifs:**
- Reduced ServerAliveInterval from 60 to 15 seconds to send keepalives more frequently
- Added TCPKeepAlive=yes to use system-level TCP keepalives
- Reduced ServerAliveCountMax from 3 to 2 to detect dead connections faster
- Reduced ControlPersist from 300 to 60 seconds to avoid keeping dead sockets
- Added Compression=no to reduce overhead
- Removed error detection/retry logic - fixing root cause instead of handling symptoms
- Updated check_ssh_connection() to use same keepalive options for consistency

**Evolutions:**
- Connections now stay alive through firewalls/NAT with frequent keepalives
- Dead connections detected and cleaned up faster
- No more connection reset errors due to proper keepalive configuration

**Pages affectées:**
- deploy.sh: Fixed SSH keepalive configuration to prevent connection drops
2026-01-06 14:42:43 +01:00
1c9f3a2afa lint fix wip3 2026-01-06 14:41:02 +01:00
681d1cebb9 Detect and handle ControlSocket errors during SSH execution
**Motivations:**
- ControlSocket errors still occurring during command execution
- Socket can become invalid DURING execution of long commands
- Need to detect socket errors in command output and clean up immediately

**Root causes:**
- Socket validation before command execution cannot detect if socket dies during execution
- Long commands (npm install, build) can cause connection to die mid-execution
- Next command finds invalid socket and SSH disables multiplexing but leaves socket
- Previous cleanup only happened before execution, not after detecting errors

**Correctifs:**
- Capture SSH command output to detect 'ControlSocket already exists' errors
- If socket error detected, immediately cleanup and retry once
- This is a specific retry for socket errors only, not a general retry mechanism
- Ensures dead sockets are cleaned up even if they die during command execution

**Evolutions:**
- Better handling of socket invalidation during long-running commands
- Automatic recovery from socket errors detected during execution

**Pages affectées:**
- deploy.sh: Enhanced ssh_exec() to detect and handle socket errors in output
2026-01-06 14:40:31 +01:00
ba5f4a6cc4 lint fix wip3 2026-01-06 14:38:38 +01:00
f02b3938a1 Update SSH connection errors documentation with root cause analysis
**Motivations:**
- Document the deep root cause of ControlSocket already exists errors
- Explain why ControlMaster=auto doesn't remove invalid sockets
- Document the solution to aggressively clean up dead sockets

**Root causes:**
- Documentation needed to explain the root cause of socket invalidation
- Need to document why directory removal is necessary for proper cleanup

**Correctifs:**
- Added deep root cause analysis section explaining ControlMaster=auto behavior
- Documented why dead sockets accumulate and cause subsequent failures
- Updated corrections section with latest improvements

**Evolutions:**
- More complete documentation of the problem and solution

**Pages affectées:**
- fixKnowledge/ssh-connection-errors-deployment.md: Added root cause analysis and updated corrections
2026-01-06 14:37:19 +01:00
01110cd322 Fix root cause of ControlSocket already exists errors
**Motivations:**
- SSH errors 'ControlSocket already exists, disabling multiplexing' were occurring
- Socket could become invalid between check and execution
- ControlMaster=auto detects invalid socket but doesn't remove it, just disables multiplexing
- Dead socket remains and causes issues for subsequent commands

**Root causes:**
- ControlMaster socket can exist but connection can be dead
- Socket can become invalid between check_ssh_connection() and ssh_exec() execution
- ControlMaster=auto detects invalid socket but doesn't remove it, leaving dead socket
- Dead socket causes 'ControlSocket already exists' errors on subsequent commands
- Previous cleanup was not aggressive enough to remove dead sockets

**Correctifs:**
- Improved check_ssh_connection() to test actual connection with 'true' command instead of just 'ssh -O check'
- Enhanced cleanup_dead_ssh() to remove entire directory instead of just socket file
- This ensures socket is truly removed even if process is still holding it
- Removed complex multi-step cleanup, using simple directory removal and recreation
- Socket validation now tests actual connection usability, not just socket existence

**Evolutions:**
- More robust socket cleanup that guarantees removal of dead sockets
- Better detection of invalid sockets before command execution

**Pages affectées:**
- deploy.sh: Improved cleanup_dead_ssh() and check_ssh_connection() functions
2026-01-06 14:36:41 +01:00
f6cd63a34d lint fix wip3 2026-01-06 14:33:32 +01:00
a943ed62e2 Remove retry mechanism from SSH connections
**Motivations:**
- Retries are useless, connection must work on first attempt or fail
- Simplifying code by removing unnecessary retry logic
- Reducing complexity and potential for multiple connection attempts

**Root causes:**
- Retry mechanism was adding complexity without real benefit
- If SSH connection fails, retrying won't help, it should fail immediately

**Correctifs:**
- Removed all retry logic from ssh_exec() function
- Simplified to single attempt execution
- Kept socket validation and cleanup before execution
- Removed retry loop and counter variables

**Evolutions:**
- Simpler and more straightforward SSH connection handling
- Faster failure detection when connection issues occur

**Pages affectées:**
- deploy.sh: Simplified ssh_exec() function, removed retry mechanism
2026-01-06 14:32:17 +01:00
7cbb57f8c9 Reduce SSH connection attempts and improve socket cleanup
**Motivations:**
- Too many SSH connection attempts were being made during deployment
- ControlMaster socket cleanup was not aggressive enough
- Multiple SSH calls at step 5 created excessive connection attempts

**Root causes:**
- ControlMaster socket could remain but be invalid, causing SSH to disable multiplexing
- Each ssh_exec had up to 3 retries, and step 5 made 4-5 ssh_exec calls
- Socket cleanup was not forceful enough to remove invalid sockets
- Complex retry logic at step 5 created unnecessary SSH calls

**Correctifs:**
- Improved cleanup_dead_ssh() to forcefully remove socket and wait for proper closure
- Reduced max retries in ssh_exec from 3 to 2
- Simplified step 5 logic to reduce SSH calls from 4-5 to 2 (one check, one init if needed)
- Combined Git initialization commands into single SSH call to reduce connections
- Added sleep after socket cleanup to ensure proper closure

**Evolutions:**
- More efficient SSH connection management
- Reduced deployment time by minimizing connection attempts

**Pages affectées:**
- deploy.sh: Improved cleanup_dead_ssh(), reduced retries, simplified step 5 logic
2026-01-06 14:31:04 +01:00
20032c00ae lint fix wip2 2026-01-06 14:28:19 +01:00
17219ea662 Update SSH connection errors documentation with blocking fix
**Motivations:**
- Document the blocking issue fix in the SSH connection errors documentation
- Keep documentation up to date with all fixes applied

**Root causes:**
- Documentation needed to reflect the blocking issue and its resolution

**Correctifs:**
- Added information about the blocking issue at step 5
- Documented the fix for command substitution blocking
- Updated root cause analysis to include blocking causes

**Evolutions:**
- Documentation now complete with all fixes

**Pages affectées:**
- fixKnowledge/ssh-connection-errors-deployment.md: Added blocking issue documentation
2026-01-06 14:27:22 +01:00
ce63c08ac9 Fix deployment script blocking at Git repository check
**Motivations:**
- Deployment script was blocking at step 5 (Git repository verification)
- Command substitution with SSH could hang indefinitely
- Need to avoid blocking on SSH connection failures

**Root causes:**
- Command substitution \ with ssh_exec could block if SSH connection hangs
- Complex logic with grep on command output was fragile
- No proper timeout handling in the verification step

**Correctifs:**
- Simplified Git repository verification logic
- Removed command substitution that could block
- Use direct exit code checking instead of parsing output
- Improved error handling with explicit SSH exit code checking
- Added cleanup and retry mechanism for connection failures

**Evolutions:**
- More robust Git repository verification that doesn't block

**Pages affectées:**
- deploy.sh: Simplified Git repository verification step
2026-01-06 14:26:30 +01:00
a219d1ad42 lint fix wip2 2026-01-06 14:24:35 +01:00
8813498de4 Fix SSH connection errors during deployment
**Motivations:**
- SSH ControlMaster connection errors were causing deployment failures
- Connection reset errors were not handled properly
- No retry mechanism for failed SSH connections

**Root causes:**
- SSH ControlMaster socket could become stale or be closed prematurely
- No validation of connection before use
- No cleanup of dead connections
- Silent failures in conditional checks

**Correctifs:**
- Added connection validation before each SSH command
- Implemented automatic cleanup of dead SSH connections
- Added retry mechanism (up to 3 attempts) with connection cleanup
- Enhanced SSH options for better connection stability (ConnectTimeout, ServerAliveInterval, ServerAliveCountMax)
- Improved error handling in Git repository verification step with explicit error detection and recovery

**Evolutions:**
- Enhanced SSH connection management with robust error handling
- Better error messages to distinguish connection errors from other failures

**Pages affectées:**
- deploy.sh: Enhanced ssh_exec() function, added helper functions, improved error handling
- fixKnowledge/ssh-connection-errors-deployment.md: Documentation of the problem, root cause, and solution
2026-01-06 14:22:24 +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
27cb1a7b5b fix key import 2026-01-06 01:14:49 +01:00
a4a39fd0ba fix 'Chargement..' for profil 2026-01-06 01:11:20 +01:00
16560e0b52 series building 2026-01-06 00:59:38 +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
3009c4664f Fix: profil image2 2026-01-05 23:14:47 +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
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
a52a261459 Document nostrimg.com 500 error diagnosis
**Motivations:**
- Document the code verification for nostrimg.com 500 errors
- Explain what was checked and what might be the issue
- Provide next steps for diagnosis

**Root causes:**
- Unknown: Could be code issue or server-side issue
- Need detailed logs to determine

**Correctifs:**
- Documented all code verifications
- Listed potential issues to check
- Provided next steps for diagnosis

**Evolutions:**
- None

**Pages affectées:**
- fixKnowledge/nostrimg-500-error-diagnosis.md (new)
2026-01-05 22:56:36 +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
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
015117686b Remove deprecated eslint config from next.config.js
**Motivations:**
- Fix Next.js 16.1.1 warning about unsupported eslint configuration
- Remove deprecated eslint option from next.config.js

**Root causes:**
- Next.js 16+ no longer supports eslint configuration in next.config.js
- The eslint option has been moved to command-line options or .eslintrc.json

**Correctifs:**
- Removed eslint configuration block from next.config.js
- Added comment explaining the change and alternatives

**Evolutions:**
- None

**Pages affectées:**
- next.config.js
2026-01-05 22:52:42 +01:00
dbe4dba70f Fix: profil image 2026-01-05 22:51:30 +01:00
e69b0178bc Document nostrimg.com HTML response issue and fixes
**Motivations:**
- Document the issue with nostrimg.com returning HTML instead of JSON
- Explain possible root causes and solutions
- Provide diagnostic steps for troubleshooting

**Root causes:**
- Missing HTTP headers (Accept, User-Agent)
- Possible incorrect endpoint URL
- Possible authentication requirements
- Endpoint may be unavailable or changed

**Correctifs:**
- Added Accept and User-Agent headers
- Improved HTML error detection and classification
- Enhanced error messages and logging

**Evolutions:**
- None

**Pages affectées:**
- fixKnowledge/nostrimg-html-response-error.md (new)
2026-01-05 22:51:06 +01:00