Commit Graph
64 Commits
Author SHA1 Message Date
Raven Scott 3466d17eda Add graceful shutdown button and improve shutdown status display
- Add refresh/shutdown button next to status indicator that gracefully
  stops the process without cleaning my-storage
- Create /api/shutdown endpoint that triggers graceful shutdown via SIGTERM
- Update status indicator to show "Gracefully Cleaning...." when system
  is shutting down (instead of "Searching for peers...")
- Include isShuttingDown flag in /api/status endpoint response
- Use built-in ConfirmationModal for shutdown confirmation with warning styling

The shutdown button appears in the top-right corner next to the status
indicator and uses the existing confirmation modal system for user
confirmation before initiating shutdown.
2025-12-26 22:03:23 -05:00
Raven Scott 1888289067 feat: Add persistent domain filters with live data updates
- Add three filter dropdowns to domains tab: Consensus Status, Hash Type, and Ownership
- Implement AND logic filtering with immediate table updates for live data
- Create persistent filter settings system saving to cache/filterSettings.json
- Add backend API endpoints: GET/POST /api/domain-filter-settings
- Set default filters to: All Consensus States, Holesail Hash, All Ownership
- Fix infinite scroll state management to handle filter changes properly
- Auto-save filter preferences on change and restore on page load
- Fix backend response handling (removed undefined sdk reference)
2025-12-26 21:50:25 -05:00
Raven Scott be7bd5ee2b perf: parallelize holesail cleanup operations for 10x faster shutdown
Convert sequential cleanup loops to Promise.allSettled() across multiple files:
- includes/maintenance/cleanup.js: parallelize holesail connections, TLS/HTTP servers, and child process cleanup
- includes/core/domain_cleanup.js: parallelize multiple client cleanup within domain removal
- p2ns.js: parallelize child process and connection cleanup in main shutdown

Before: O(n) sequential execution (100-150s for 10 processes)
After: O(1) parallel execution (~10-15s for 10 processes)
2025-12-26 21:29:39 -05:00
Raven Scott 398e042e81 Fix: Support floating point numbers in settings (Consensus Quorum Threshold)
Changed number type settings parsing from parseInt to parseFloat to
properly handle decimal values. Added step="any" attribute to number
inputs in the frontend when the setting has decimal min/max/default
values.

This ensures that Consensus Quorum Threshold and other floating point
settings (like METRICS_SAMPLING_RATE) can accept and save decimal
values like 0.5, 0.67, etc. instead of being truncated to integers.

- Updated includes/admin/admin-backend/routes/settings.js
- Updated includes/admin/routes/settings.js
- Updated includes/admin/admin-frontend/ui/settings.js
2025-12-26 21:20:58 -05:00
Raven Scott c4fd25c17e version bump file.drop 2025-12-26 20:26:27 -05:00
Raven Scott 94c923cc6d feat: add HyperDB replication to file.drop plugin
- Add database watcher to monitor @filedrop/files collection changes
- Implement robust database initialization with retry logic (30 attempts)
- Add replication status checking and logging on startup
- Add peer connection handlers for active replication updates
- Enable real-time database synchronization across P2NS network
2025-12-26 20:21:15 -05:00
Raven Scott 9edefdb61d center message in p2p conflicts 2025-12-26 18:34:21 -05:00
Raven Scott e925ac22fc Add disclaimer 2025-12-26 18:17:30 -05:00
Raven Scott 0e03ff10e2 feat: implement fully dynamic real-time domains list via WebSocket
Add WebSocket broadcasting of complete domains list from server to clients
Implement periodic domain list updates (10-second intervals)
Fix reconnection issues where domains list remained empty after p2ns restart
Add proper state management for WebSocket disconnect/reconnect scenarios
Enhance empty state messages to show "Disconnected" status during outages
Reset scroll/pagination state when receiving WebSocket domain updates
Add client-server request/response mechanism for immediate domain list refresh
Ensure domains list updates in real-time during consensus resolution
Remove conflicting HTTP fetches during reconnection to prevent race conditions
2025-12-26 18:16:02 -05:00
Raven Scott eff22719ff cleanup/enhance cleanup 2025-12-26 18:02:21 -05:00
Raven Scott 10d7d52079 Disallow internal domains from being claimed 2025-12-26 17:48:50 -05:00
Raven Scott 02a11bc025 update docs 2025-12-26 17:35:10 -05:00
Raven Scott 4465e9aa62 update docs 2025-12-26 17:34:30 -05:00
Raven Scott 9b68e728fd feat: Add separate message for conflict claim removalImplement removeConflictDomainClaim: message type to distinguish betweenfull domain cleanup and conflict claim removal, ensuring other peers'claims are preserved when removing conflicting claims.- Add sendConflictClaimRemoval() function for notification broadcasting- Add handler for removeConflictDomainClaim: messages that updates consensus but does NOT remove other peers' claims- Modify removal logic to conditionally broadcast based on claimant status: - Resolved claimants: broadcast remove_domain: (full cleanup) - Non-resolved claimants: broadcast removeConflictDomainClaim: (notification only)- Update admin routes and SDK to use conditional broadcastingPrevents cross-peer claim deletion when removing conflict claims whilemaintaining proper consensus updates and full cleanup functionality. 2025-12-26 17:28:37 -05:00
Raven Scott 6e1c3f6863 fix: Preserve other peers' claims during domain removal requests
Fix critical bug where removing a conflicting domain would remove ALL claims
from the ledger instead of just the requesting peer's claims. When a peer
removed a domain they had a claim for but weren't the resolved claimant,
the removal request would cause all connected peers to remove all claims
and votes for that domain.

- Modify removal request handler in p2ns.js to process independently per peer
- Each peer checks if they have a claim before processing removal
- Resolved claimants: perform full cleanup (atomicDomainCleanup)
- Non-resolved claimants: remove only own claim and votes (removeOwnClaimAndVotes)
- Peers without claims: ignore removal requests entirely
- Preserve other peers' claims while maintaining proper cleanup functionality

Resolves data integrity issue where removal requests caused unintended
cross-peer claim deletion, ensuring each peer only removes their own entries.
2025-12-26 17:18:39 -05:00
Raven Scott 7a9889befe fix: Add strict ownership validation for claim modifications
Add comprehensive security checks to prevent unauthorized claim modifications
while preserving legitimate owner's ability to update their own claims.

- Add ownership verification before any pass.remove() operations
- Validate claimKey format: claim:domain:claimant
- Ensure claimant matches current user before allowing modifications
- Create safeRemoveClaim() helper with multi-layer validation
- Add security logging for audit trail
- Fail-safe error handling prevents unauthorized claim interference

Resolves critical data integrity issue where claims could be overwritten
by unauthorized peers, while maintaining proper claim management capabilities.
2025-12-26 17:09:16 -05:00
Raven Scott 0d23e296be ix: Prevent claim overwriting and improve domain removal safety
Fix critical bugs in domain claim management to ensure data integrity:

- Domain addition: Check for existing claims before adding to prevent duplicates
  - Update user's own claim if it exists instead of creating duplicates
  - Skip update if hash and SSL flag unchanged (idempotent)
  - Never touch other users' claims when updating own claim

- Domain removal: Add strict validation to prevent removing other users' claims
  - Only perform full cleanup (atomicDomainCleanup) when user is confirmed resolved claimant
  - Require consensus status 'resolved' AND resolvedClaimant matches localWriter
  - Improved logging to show which removal path is taken
  - Enhanced removeOwnClaimAndVotes with explicit vote key parsing

- Hash preferences cleanup: Fix module path resolution error
  - Correct require path from admin-backend/cache.js (../../core/core)
  - Add lazy require pattern with error handling to prevent crashes
  - Ensure cleanup runs after consensus updates and domain removals
2025-12-26 16:59:56 -05:00
Raven Scott 01acfb766c feat: Add P2P Domain Conflicts management
Implement comprehensive P2P domain conflict resolution allowing users to choose between local claim hashes and consensus-resolved hashes for domains where they have local claims but another claimant won consensus.

Key features:
- P2P Domain Conflicts UI tab in Local DNS section
- Hash preference toggle (local vs resolved) with automatic client restart
- Extended selector_cache.json to store hashPreferences alongside versionPreferences
- DNS cache invalidation for immediate preference application
- REST API endpoints for conflict detection and preference management
- Automatic Holesail client restart when hash preferences change
- Complete documentation updates across README, API docs, and glossary

Resolves conflicts between local claims and consensus resolution by giving users control over which hash their domain resolves to, with seamless client management ensuring immediate effect.
2025-12-26 16:36:19 -05:00
Raven Scott 480f99ae28 feat: allow partial domain removal and add conflict status
- Add partial domain removal functionality allowing users to remove their own claims and votes even when they're not the resolved claimant
- Add conflict status detection for domains where local peer has claim but another claimant won consensus
- Update UI to display conflict status with red badge
- Enhance API responses with detailed consensus information
- Update all documentation with new features

Changes:
- core/core.js: Add removeOwnClaimAndVotes() function for partial removal
- admin/routes/domains.js: Implement partial/full removal logic in /api/remove-domain
- admin/admin-backend/routes/domains.js: Same partial removal logic for backend routes
- plugins/sdk.js: Update removeDomain() to support partial removal
- admin/ui/config.js: Add conflict status badge and update postFetch
- admin/admin-frontend/ui/config.js: Add conflict status badge and fix status rendering
- admin/utils.js: Add conflict status to utility functions
- admin/admin-frontend/utils.js: Add conflict status to utility functions
- docs/CONSENSUS.md: Add conflict status to resolution states
- docs/README_LONGFORM.md: Add conflict status to consensus states
- docs/RESTAPI.md: Update /api/resolved-domains with new fields and examples
- docs/ARCHITECTURE.md: Document full vs partial removal modes
- docs/OPENAPI.yaml: Update Domain schema and add ConsensusState schema
2025-12-26 15:32:41 -05:00
Raven Scott ea1bcb569a fix: correct consensus vote counting to prevent duplicate voter inflation
- Modified getConsensusState() to track votes per voter and ensure each voter only counts once per domain
- Added logging to detect when voters have multiple votes for different claimants
- Prevents vote count inflation that could cause wrong claimants to win consensus
- Maintains most recent vote when duplicates are detected
2025-12-26 02:31:26 -05:00
Raven Scott 7ec24c8122 Added recreation check: Before creating a missing channel, the code now checks isRecreating(pluginDomain, protocol, peerId) to prevent duplicate creation attempts 2025-12-21 07:52:38 -05:00
snxraven 8a14e33bad Merge pull request 'refactor: bind to 127.0.0.1' (#1) from Cyber/p2ns:refactor/bind-to-local into main
Reviewed-on: #1
2025-12-21 06:14:28 -05:00
Cyber 1755ecb955 refactor: bind to 127.0.0.1 2025-12-21 12:09:56 +01:00
Raven Scott bd93b03388 Fix up Automatic Updates via Websocket | peer.directory 2025-12-21 05:14:42 -05:00
snxraven 453e3e4154 revert ba417d537d
revert Remove redunant updates - we dont need them
2025-12-21 04:51:50 -05:00
Raven Scott ba417d537d Remove redunant updates - we dont need them 2025-12-21 04:46:58 -05:00
Raven Scott 93de490353 make peer.directory updates smoother 2025-12-21 04:43:09 -05:00
Raven Scott 4629a7690e Update peer.directory to full websockets with auto updating 2025-12-21 04:36:24 -05:00
Raven Scott 75a2792579 - Fix "removedIPs is not defined" error in cleanupInterfaces function
by initializing removedIPs outside conditional block
2025-12-21 02:15:59 -05:00
Raven Scott cbeffd61f7 Seperate Peer Stats and Peer list 2025-12-21 02:14:17 -05:00
Raven Scott aedf2b5beb GUI: Fix scrolling in the peers tab 2025-12-21 02:11:57 -05:00
Raven Scott 3deb968553 Attempt to stabilize channel reconnecting 2025-12-20 19:09:23 -05:00
Raven Scott 575d1c359d Auto Assign IPs when domains are resolved 2025-12-20 17:11:48 -05:00
Raven Scott 14cd0d98dd allow public holesail keys 2025-12-20 17:03:20 -05:00
Raven Scott a2cdd0497d test 2025-12-20 16:15:31 -05:00
Raven Scott 954b98d9ce test 2025-12-20 15:47:22 -05:00
Raven Scott 6128abe902 tests 2025-12-20 15:41:48 -05:00
snxraven 0dbdcdd641 revert 5e34e90de5
revert Changes to master and connections
2025-12-20 15:23:10 -05:00
Raven Scott 5e34e90de5 Changes to master and connections 2025-12-19 23:14:05 -05:00
Raven Scott ed2e3c8b5a Add loading indicator while enabling a plugin 2025-12-19 23:02:51 -05:00
Raven Scott 3275f937e8 do not init plugins that are disabled 2025-12-19 22:58:32 -05:00
Raven Scott a3ea306a76 update builder 2025-12-18 02:07:51 -05:00
Raven Scott 1e9115d599 clean up old data 2025-12-17 23:32:42 -05:00
Raven Scott 1966062a12 connection tracking 2025-12-17 22:54:46 -05:00
Raven Scott 7dc7f2ee95 Remove DS_Store 2025-12-17 22:51:24 -05:00
Raven Scott db77833402 remove test-scripts 2025-12-17 22:50:41 -05:00
Raven Scott 5f022eae91 further adjustments 2025-12-17 22:39:20 -05:00
Raven Scott eb5675adb2 fixes 2025-12-17 22:32:07 -05:00
Raven Scott ad4784d05d feat: consolidate utility functions into P2NS Plugin SDK
- Centralized common formatting, DOM, and status utilities in `includes/plugins/sdk.js`
- Created `sdk.utils.format`, `sdk.utils.dom`, and `sdk.utils.status` namespaces
- Refactored `domain.consensus` and `peer.visualize` plugins to use the global SDK
- Updated `plugin-handler` to serve SDK utilities globally via `/sdk-utils.js`
- Enhanced SDK validation by delegating to the core validation infrastructure
- Fixed bugs in metric rendering and missing frontend utility functions
2025-12-17 22:21:58 -05:00
Raven Scott 5f5ed3848e resolve circle dep 2025-12-17 21:49:54 -05:00