Update docs
This commit is contained in:
+104
-92
@@ -8,28 +8,32 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
## WebSocket Endpoint
|
||||
- **URL**: `wss://p2ns.admin/ws`
|
||||
- **Description**: Establishes a WebSocket connection for real-time updates from the server.
|
||||
- **Message Types**:
|
||||
- `log`: System logs with `level` (info, error) and `message`.
|
||||
- `holesail-log`: Holesail server/client logs with `id`, `level`, and `message`.
|
||||
- `update-database`: Triggers refresh of domains and entries.
|
||||
- `update-peers`: Triggers refresh of peers.
|
||||
- `update-certs`: Triggers refresh of certificates.
|
||||
- `update-interfaces`: Triggers refresh of virtual interfaces.
|
||||
- `update-local-dns`: Triggers refresh of local DNS and conflict selector.
|
||||
- `update-holesail`: Triggers refresh of Holesail servers.
|
||||
- `update-holesail-clients`: Triggers refresh of Holesail clients.
|
||||
- `update-settings`: Triggers refresh of settings and subnets.
|
||||
- `update-stats`: Triggers refresh of stats tab.
|
||||
- `update-plugins`: Triggers refresh of plugins tab.
|
||||
- `update-plugin-settings`: Triggers refresh of plugin settings.
|
||||
- `plugin-log`: Plugin log messages with `domain` (string), `level` (string: debug/info/warn/error), `component` (string), and `message` (string).
|
||||
- `system-reset`: Signals a system reset, requiring a client reload.
|
||||
- **Example**:
|
||||
- **Client → server messages**:
|
||||
- `subscribe-stats` / `unsubscribe-stats` / `request-stats-snapshot` — Stats tab live data.
|
||||
- `subscribe-log` — `{ "type": "subscribe-log", "channel": "core", "lines": 1000 }` (channels: `core`, `proxy`, `httpProxy`, `dns`, `plugins`, `holesail`).
|
||||
- `unsubscribe-log` — Stop log tail.
|
||||
- `request-domains` — Refresh domains list (server replies with `domains-list`).
|
||||
|
||||
- **Server → client messages**:
|
||||
- `stats-snapshot` — Full stats page payload (`stats`, `historical`, `health`, `status`, `minutes`). Includes `stats.core` (invite RPC diagnostics) and `stats.pluginRpc` / `stats.peerChannels` (plugin RPC metrics).
|
||||
- `update-stats` — Notifies stats subscribers to apply their latest snapshot (does not embed metrics itself).
|
||||
- `update-health` — Health payload for Diagnostics tab subscribers.
|
||||
- `file-log` — `{ "type": "file-log", "channel": "dns", "level": "info", "message": "<line>" }` (live log tail).
|
||||
- `log-snapshot` — Initial tail after `subscribe-log`: `{ "type": "log-snapshot", "channel": "core", "lines": ["..."] }`.
|
||||
- `log` — **Legacy**; may still map to core. Prefer `file-log` + `subscribe-log`.
|
||||
- `holesail-log` — Holesail child process logs (`id`, `level`, `message`).
|
||||
- `plugin-log` — Per-plugin logs (`domain`, `level`, `component`, `message`).
|
||||
- `domains-list` — Resolved domains array.
|
||||
- `update-database`, `update-peers`, `update-certs`, `update-interfaces`, `update-local-dns`, `update-holesail`, `update-holesail-clients`, `update-settings`, `update-plugins`, `update-plugin-settings` — Tab refresh hints.
|
||||
- `system-reset` — Client should reload.
|
||||
|
||||
- **Example (`file-log`)**:
|
||||
```json
|
||||
{
|
||||
"type": "log",
|
||||
"type": "file-log",
|
||||
"channel": "core",
|
||||
"level": "info",
|
||||
"message": "Starting main function..."
|
||||
"message": "2026-05-28T12:00:00.000Z [INFO] [Main] Starting..."
|
||||
}
|
||||
```
|
||||
|
||||
@@ -724,7 +728,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
{"id":"abc123"}
|
||||
```
|
||||
|
||||
### 29. POST /api/holesail-delete
|
||||
### 33. POST /api/holesail-delete
|
||||
- **Description**: Deletes a Holesail server by ID and removes it from `holesail_servers.json`.
|
||||
- **Request Body**: JSON with `id` (string).
|
||||
- **Response**: Plain text `OK` on success, error message on failure.
|
||||
@@ -743,7 +747,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
OK
|
||||
```
|
||||
|
||||
### 30. POST /api/holesail-restart
|
||||
### 34. POST /api/holesail-restart
|
||||
- **Description**: Restarts a Holesail server by ID, optionally reassigning its domain. Persists to `holesail_servers.json`.
|
||||
- **Request Body**: JSON with `id` (string).
|
||||
- **Response**: Plain text `OK` on success, error message on failure.
|
||||
@@ -762,7 +766,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
OK
|
||||
```
|
||||
|
||||
### 31. POST /api/holesail-client-create
|
||||
### 35. POST /api/holesail-client-create
|
||||
- **Description**: Creates a new Holesail client for a domain and port. Persists to `holesail_clients.json`. If `serviceName` is provided, the client ID will be `domain_servicename`; otherwise, a generated ID is used. The client is also added to the domain's claim record `clients` array.
|
||||
- **Request Body**: JSON with:
|
||||
- `domain` (string, required): Domain name (must be owned by local writer)
|
||||
@@ -787,7 +791,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
{"id":"example.tld_web"}
|
||||
```
|
||||
|
||||
### 32. POST /api/holesail-client-delete
|
||||
### 36. POST /api/holesail-client-delete
|
||||
- **Description**: Deletes a Holesail client by ID, closing connections and removing it from `holesail_clients.json`.
|
||||
- **Request Body**: JSON with `id` (string).
|
||||
- **Response**: Plain text `OK` on success, error message on failure.
|
||||
@@ -806,7 +810,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
OK
|
||||
```
|
||||
|
||||
### 33. POST /api/holesail-client-restart
|
||||
### 37. POST /api/holesail-client-restart
|
||||
- **Description**: Restarts a Holesail client by ID, ensuring the port is free and connections are closed.
|
||||
- **Request Body**: JSON with `id` (string).
|
||||
- **Response**: Plain text `OK` on success, error message on failure.
|
||||
@@ -825,7 +829,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
OK
|
||||
```
|
||||
|
||||
### 34. POST /api/update-settings
|
||||
### 38. POST /api/update-settings
|
||||
- **Description**: Updates environment settings (whitelisted variables) and persists them to `.env`. Note: `SUBNETS` can be updated here, but it's recommended to use `/api/subnets` for subnet management. `SUBNET_BASE` and `INITIAL_IP_INDEX` are deprecated in favor of the subnet configurator.
|
||||
- **Request Body**: JSON with `settings` (object mapping whitelisted keys to values). For `SUBNETS`, provide a JSON array string.
|
||||
- **Response**: JSON object with `message` (string), `restartRequired` (boolean), and optionally `restartRequiredSettings` (array of strings).
|
||||
@@ -848,7 +852,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 35. GET /api/network-interfaces
|
||||
### 39. GET /api/network-interfaces
|
||||
- **Description**: Retrieves a list of available network interfaces on the system. Used by the admin interface to populate the Subnet Interface Name dropdown setting.
|
||||
- **Response**: JSON object with `interfaces` (array of interface objects). Each interface object contains:
|
||||
- `value` (string): Interface name (e.g., "lo0", "lo", "eth0")
|
||||
@@ -872,7 +876,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
```
|
||||
- **Note**: Interfaces are sorted with loopback interfaces (lo, lo0) and OS-specific defaults (lo0 on macOS, lo on Linux, Loopback Pseudo-Interface 1 on Windows) prioritized first.
|
||||
|
||||
### 36. GET /api/subnets
|
||||
### 40. GET /api/subnets
|
||||
- **Description**: Retrieves all configured subnets with capacity information. Returns default subnet from `SUBNET_BASE` if no subnets are configured.
|
||||
- **Response**: JSON object with `subnets` (array of subnet objects). Each subnet object contains:
|
||||
- `base` (string): Network base IP address (e.g., "192.168.3.0")
|
||||
@@ -918,7 +922,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 36. POST /api/subnets
|
||||
### 41. POST /api/subnets
|
||||
- **Description**: Updates subnet configuration. Replaces all existing subnets with the provided array. Changes require a system restart to fully take effect.
|
||||
- **Request Body**: JSON object with `subnets` (array of subnet objects). Each subnet object must contain:
|
||||
- `base` (string, required): Network base IP address (e.g., "192.168.3.0")
|
||||
@@ -950,7 +954,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
- `startIndex` must be between 1 and 254 (or up to subnet size - 2)
|
||||
- Subnets must not overlap with each other
|
||||
|
||||
### 37. GET /api/health
|
||||
### 42. GET /api/health
|
||||
- **Description**: Health check endpoint supporting liveness and readiness probes.
|
||||
- **Query Parameters**:
|
||||
- `probe`: Type of health probe (`liveness` or `readiness`, default: `liveness`).
|
||||
@@ -981,13 +985,14 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 38. GET /api/stats
|
||||
- **Description**: Retrieves real-time system metrics including request statistics, Holesail connections, process metrics, and peer information.
|
||||
- **Response**: JSON object with comprehensive metrics including:
|
||||
### 43. GET /api/stats
|
||||
- **Description**: Retrieves a one-shot system metrics snapshot (same data shape as `stats-snapshot` over WebSocket). The admin UI loads this once, then uses `subscribe-stats` for live updates.
|
||||
- **Response**: JSON object including:
|
||||
- Request statistics (total, success rate, average response time, failed requests)
|
||||
- Holesail children (servers, clients, P2P domain connections) with status, PID, uptime, CPU/memory usage
|
||||
- Process metrics
|
||||
- Peer connection metrics
|
||||
- `core` — Core control-plane / invite RPC diagnostics (`diagnoseInviteIssues`)
|
||||
- `pluginRpc` and `peerChannels` — Per-plugin protomux-rpc protocol stats (`transport: 'rpc'`, methods, `rpcOpen` counts)
|
||||
- HyperDB / Hyperdrive sections when available
|
||||
- **Status Codes**:
|
||||
- `200`: Success.
|
||||
- `500`: Failed to fetch stats.
|
||||
@@ -1019,7 +1024,26 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 39. GET /api/stats/historical
|
||||
### 44. GET /api/logs
|
||||
- **Description**: Lists available split log channels written under `LOG_DIR` (default `./logs/`).
|
||||
- **Response**: `{ "channels": [ { "id": "core", "label": "Core", "file": "core.log" }, ... ] }`
|
||||
- **Status Codes**: `200`, `500`
|
||||
- **Example**:
|
||||
```bash
|
||||
curl -k https://p2ns.admin/api/logs
|
||||
```
|
||||
|
||||
### 45. GET /api/logs/:channel
|
||||
- **Description**: Returns the tail of a log file (in-memory buffer with file fallback).
|
||||
- **Path**: `channel` — `core`, `proxy`, `httpProxy`, `dns`, `plugins`, or `holesail`
|
||||
- **Query**: `lines` — max lines (default `500`, max `5000`)
|
||||
- **Response**: `{ "channel": "dns", "lines": ["..."] }`
|
||||
- **Example**:
|
||||
```bash
|
||||
curl -k "https://p2ns.admin/api/logs/dns?lines=200"
|
||||
```
|
||||
|
||||
### 46. GET /api/stats/historical
|
||||
- **Description**: Retrieves historical metrics data for a specified time range.
|
||||
- **Query Parameters**:
|
||||
- `minutes`: Time range in minutes (1-1440, default: 60).
|
||||
@@ -1033,7 +1057,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
"https://p2ns.admin/api/stats/historical?minutes=1440"
|
||||
```
|
||||
|
||||
### 40. GET /api/backups
|
||||
### 47. GET /api/backups
|
||||
- **Description**: Lists all available backups with metadata including name, timestamp, size, and file count.
|
||||
- **Response**: JSON array of backup objects with `name`, `timestamp`, `size`, `sizeFormatted`, and `fileCount`.
|
||||
- **Status Codes**:
|
||||
@@ -1056,7 +1080,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
]
|
||||
```
|
||||
|
||||
### 41. POST /api/backups/create
|
||||
### 48. POST /api/backups/create
|
||||
- **Description**: Creates a manual backup of configuration files, certificates, and cache data. Automatic cleanup of old backups is performed before creation.
|
||||
- **Request Body**: None.
|
||||
- **Response**: JSON object with `success` (boolean) and `path` (string, backup file path).
|
||||
@@ -1075,7 +1099,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 42. POST /api/backups/restore
|
||||
### 49. POST /api/backups/restore
|
||||
- **Description**: Restores system configuration from a backup. Replaces current configuration files and certificates.
|
||||
- **Request Body**: JSON with `backupName` (string, backup name to restore).
|
||||
- **Response**: JSON object with `success` (boolean) and `message` (string).
|
||||
@@ -1097,7 +1121,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 43. DELETE /api/backups/:id
|
||||
### 50. DELETE /api/backups/:id
|
||||
- **Description**: Deletes a backup by name. Supports both directory and tar.gz formats.
|
||||
- **Path Parameters**:
|
||||
- `id`: Backup name (e.g., `backup-20240101-000000` or `backup-20240101-000000.tar.gz`).
|
||||
@@ -1112,7 +1136,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
https://p2ns.admin/api/backups/backup-20240101-000000
|
||||
```
|
||||
|
||||
### 44. GET /api/backups/:id/metadata
|
||||
### 51. GET /api/backups/:id/metadata
|
||||
- **Description**: Retrieves detailed metadata for a backup including file list, sizes, and timestamps.
|
||||
- **Path Parameters**:
|
||||
- `id`: Backup name.
|
||||
@@ -1127,7 +1151,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
https://p2ns.admin/api/backups/backup-20240101-000000/metadata
|
||||
```
|
||||
|
||||
### 45. POST /api/diagnostics/dns-lookup
|
||||
### 52. POST /api/diagnostics/dns-lookup
|
||||
- **Description**: Performs DNS lookup for a domain with specified record type.
|
||||
- **Request Body**: JSON with `domain` (string, required) and `type` (string, optional, default: `A`). Supported types: A, AAAA, MX, TXT, NS, CNAME, SRV, PTR, SOA.
|
||||
- **Response**: JSON object with `success` (boolean), `domain`, `type`, `results` (array), and `responseTime` (number).
|
||||
@@ -1152,7 +1176,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 46. POST /api/diagnostics/ping
|
||||
### 53. POST /api/diagnostics/ping
|
||||
- **Description**: Tests network connectivity using ping. Supports both streaming and non-streaming modes.
|
||||
- **Request Body**: JSON with `target` (string, required), `count` (number, optional, default: 4), and `stream` (boolean, optional, default: false).
|
||||
- **Response**:
|
||||
@@ -1177,7 +1201,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
https://p2ns.admin/api/diagnostics/ping
|
||||
```
|
||||
|
||||
### 47. POST /api/diagnostics/traceroute
|
||||
### 54. POST /api/diagnostics/traceroute
|
||||
- **Description**: Traces network path to a target. Supports both streaming and non-streaming modes.
|
||||
- **Request Body**: JSON with `target` (string, required) and `stream` (boolean, optional, default: false).
|
||||
- **Response**:
|
||||
@@ -1195,7 +1219,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
https://p2ns.admin/api/diagnostics/traceroute
|
||||
```
|
||||
|
||||
### 48. POST /api/diagnostics/connection-test
|
||||
### 55. POST /api/diagnostics/connection-test
|
||||
- **Description**: Tests TCP connectivity to a domain and port combination.
|
||||
- **Request Body**: JSON with `domain` (string, required) and `port` (number, required).
|
||||
- **Response**: JSON object with `success` (boolean), `domain`, `ip` (resolved IP), `port`, `latency` (if successful), `error` (if failed), and `responseTime`.
|
||||
@@ -1221,37 +1245,25 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 49. GET /api/diagnostics/bandwidth
|
||||
- **Description**: Retrieves network interface information and configuration. Note: Real-time bandwidth statistics require system-specific tools and are not available via Node.js.
|
||||
- **Response**: JSON object with `interfaces` (object mapping interface names to configuration), `note` (string), and `responseTime`.
|
||||
- **Status Codes**:
|
||||
- `200`: Success.
|
||||
- `500`: Server error.
|
||||
### 56. GET /api/diagnostics/bandwidth
|
||||
- **Description**: Network interface information and configuration. Real-time throughput stats are not available via Node.js; response is interface layout only.
|
||||
- **Response**: JSON with `interfaces`, optional `note`, `responseTime`.
|
||||
- **Status Codes**: `200`, `500`
|
||||
- **Example**:
|
||||
```bash
|
||||
curl -X GET \
|
||||
https://p2ns.admin/api/diagnostics/bandwidth
|
||||
```
|
||||
```json
|
||||
{
|
||||
"interfaces": {
|
||||
"eth0": {
|
||||
"name": "eth0",
|
||||
"addresses": [
|
||||
{
|
||||
"address": "192.168.1.100",
|
||||
"netmask": "255.255.255.0",
|
||||
"family": "IPv4"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"note": "Bandwidth statistics require system-specific tools. Interface information only.",
|
||||
"responseTime": 5
|
||||
}
|
||||
curl -k https://p2ns.admin/api/diagnostics/bandwidth
|
||||
```
|
||||
|
||||
### 50. GET /<tab>
|
||||
### 57. GET /api/diagnostics/invites
|
||||
- **Description**: Core invite / control-plane diagnostics over `p2ns.core-request-rpc` (`invite.request`, `invite.deliver`, `invite.ack`, `core.status`). Used by the Stats **Core** section and Invite Diagnostics UI.
|
||||
- **Response**: JSON with `summary` (dnsPass, rpcOpen, requestChannelOpen, failed peers, …), `peers`, `recommendations`, `connectionIssues`, etc.
|
||||
- **Status Codes**: `200`, `503` (still initializing), `500`
|
||||
- **Example**:
|
||||
```bash
|
||||
curl -k https://p2ns.admin/api/diagnostics/invites
|
||||
```
|
||||
|
||||
### 58. GET /<tab>
|
||||
- **Description**: Redirects to the admin panel with the specified tab (e.g., `/domains`, `/host`, `/local-dns`) open.
|
||||
- **Path Parameters**:
|
||||
- `tab`: One of `domains`, `host`, `local-dns`, `entries`, `peers`, `certs`, `interfaces`, `logs`, `settings`.
|
||||
@@ -1265,7 +1277,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
https://p2ns.admin/domains
|
||||
```
|
||||
|
||||
### 38. GET /favicon.ico
|
||||
### 59. GET /favicon.ico
|
||||
- **Description**: Returns a 404 response (favicon not implemented).
|
||||
- **Response**: Plain text `Not Found`.
|
||||
- **Status Codes**:
|
||||
@@ -1281,7 +1293,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
|
||||
## Consensus Endpoints
|
||||
|
||||
### 51. GET /api/consensus/:domain
|
||||
### 60. GET /api/consensus/:domain
|
||||
- **Description**: Retrieves the consensus state for a specific domain, including vote counts, quorum status, and resolution information.
|
||||
- **Path Parameters**:
|
||||
- `domain`: The domain name (e.g., `example.tld`).
|
||||
@@ -1320,7 +1332,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 52. GET /api/consensus/metrics
|
||||
### 61. GET /api/consensus/metrics
|
||||
- **Description**: Retrieves overall consensus metrics including resolution statistics, quorum failures, ties, and validation failures.
|
||||
- **Response**: JSON object with:
|
||||
- `resolutions` (number): Total number of successful domain resolutions.
|
||||
@@ -1361,7 +1373,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 53. POST /api/consensus/recalculate
|
||||
### 62. POST /api/consensus/recalculate
|
||||
- **Description**: Forces a consensus recalculation for all domains. Invalidates the consensus cache and triggers auto-voting checks.
|
||||
- **Request Body**: None.
|
||||
- **Response**: JSON object with `success` (boolean) and `message` (string).
|
||||
@@ -1381,7 +1393,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 54. POST /api/consensus/recalculate/:domain
|
||||
### 63. POST /api/consensus/recalculate/:domain
|
||||
- **Description**: Forces a consensus recalculation for a specific domain. Invalidates the consensus cache for that domain and triggers auto-voting.
|
||||
- **Path Parameters**:
|
||||
- `domain`: The domain name (e.g., `example.tld`).
|
||||
@@ -1405,7 +1417,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
|
||||
## Service Subscription Endpoints
|
||||
|
||||
### 55. GET /api/domain-services
|
||||
### 64. GET /api/domain-services
|
||||
- **Description**: Retrieves all services configured for a specific domain from its claim record.
|
||||
- **Query Parameters**:
|
||||
- `domain` (string, required): The domain name to query services for.
|
||||
@@ -1440,7 +1452,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
]
|
||||
```
|
||||
|
||||
### 56. GET /api/service-subscriptions
|
||||
### 65. GET /api/service-subscriptions
|
||||
- **Description**: Lists all service subscriptions configured on this node.
|
||||
- **Response**: JSON array of subscription objects, each containing:
|
||||
- `domain` (string): Domain name
|
||||
@@ -1468,7 +1480,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
]
|
||||
```
|
||||
|
||||
### 57. GET /api/subscribe-all-domains
|
||||
### 66. GET /api/subscribe-all-domains
|
||||
- **Description**: Lists all domains for which "subscribe all" is enabled. When enabled, the system automatically subscribes to all services for that domain, including newly added services.
|
||||
- **Response**: JSON array of domain names (strings).
|
||||
- **Status Codes**:
|
||||
@@ -1483,7 +1495,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
["example.tld", "another.tld"]
|
||||
```
|
||||
|
||||
### 58. POST /api/service-subscribe
|
||||
### 67. POST /api/service-subscribe
|
||||
- **Description**: Subscribes to a specific service from a domain. Creates a Holesail client automatically with ID `domain_servicename` and persists the subscription to `subscriptions.json`.
|
||||
- **Request Body**: JSON with:
|
||||
- `domain` (string, required): Domain name
|
||||
@@ -1509,7 +1521,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
{"success": true}
|
||||
```
|
||||
|
||||
### 59. POST /api/service-unsubscribe
|
||||
### 68. POST /api/service-unsubscribe
|
||||
- **Description**: Unsubscribes from a specific service. Deletes the associated Holesail client and removes the subscription from `subscriptions.json`.
|
||||
- **Request Body**: JSON with:
|
||||
- `domain` (string, required): Domain name
|
||||
@@ -1532,7 +1544,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
{"success": true}
|
||||
```
|
||||
|
||||
### 60. POST /api/subscribe-all
|
||||
### 69. POST /api/subscribe-all
|
||||
- **Description**: Enables "subscribe all" for a domain. This automatically subscribes to all current services for that domain and will automatically subscribe to any new services added in the future. Creates Holesail clients for all existing services.
|
||||
- **Request Body**: JSON with:
|
||||
- `domain` (string, required): Domain name
|
||||
@@ -1553,7 +1565,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
{"success": true}
|
||||
```
|
||||
|
||||
### 61. POST /api/unsubscribe-all
|
||||
### 70. POST /api/unsubscribe-all
|
||||
- **Description**: Disables "subscribe all" for a domain and unsubscribes from all services for that domain. Deletes all associated Holesail clients.
|
||||
- **Request Body**: JSON with:
|
||||
- `domain` (string, required): Domain name
|
||||
@@ -1578,7 +1590,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
|
||||
**Note:** For detailed information about the plugin system, see [plugins/README.md](plugins/README.md) and [plugins/PLUGIN_SDK.md](plugins/PLUGIN_SDK.md).
|
||||
|
||||
### 62. GET /api/plugins
|
||||
### 71. GET /api/plugins
|
||||
- **Description**: Lists all plugins with their information, status, actions, and settings. Includes both loaded and stopped plugins.
|
||||
- **Response**: JSON object with `plugins` (array of plugin objects). Each plugin object contains:
|
||||
- `domain` (string): Plugin domain name
|
||||
@@ -1639,7 +1651,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 63. GET /api/plugins/:domain
|
||||
### 72. GET /api/plugins/:domain
|
||||
- **Description**: Retrieves detailed information for a specific plugin.
|
||||
- **Path Parameters**:
|
||||
- `domain`: The plugin domain name (e.g., `example.plugin`).
|
||||
@@ -1654,7 +1666,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
https://p2ns.admin/api/plugins/example.plugin
|
||||
```
|
||||
|
||||
### 64. POST /api/plugins/:domain/start
|
||||
### 73. POST /api/plugins/:domain/start
|
||||
- **Description**: Starts a stopped plugin. Loads the plugin handler and initializes resources.
|
||||
- **Path Parameters**:
|
||||
- `domain`: The plugin domain name (e.g., `example.plugin`).
|
||||
@@ -1678,7 +1690,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 65. POST /api/plugins/:domain/stop
|
||||
### 74. POST /api/plugins/:domain/stop
|
||||
- **Description**: Stops a running plugin. Unloads the plugin handler and cleans up resources.
|
||||
- **Path Parameters**:
|
||||
- `domain`: The plugin domain name (e.g., `example.plugin`).
|
||||
@@ -1702,7 +1714,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 66. POST /api/plugins/:domain/reload
|
||||
### 75. POST /api/plugins/:domain/reload
|
||||
- **Description**: Reloads a plugin. Stops the plugin, clears the module cache, and starts it again. Useful for applying code changes without restarting P2NS.
|
||||
- **Path Parameters**:
|
||||
- `domain`: The plugin domain name (e.g., `example.plugin`).
|
||||
@@ -1726,7 +1738,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 67. POST /api/plugins/:domain/actions/:actionName
|
||||
### 76. POST /api/plugins/:domain/actions/:actionName
|
||||
- **Description**: Executes a registered plugin action. The action handler is called with the provided parameters.
|
||||
- **Path Parameters**:
|
||||
- `domain`: The plugin domain name (e.g., `example.plugin`).
|
||||
@@ -1756,7 +1768,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 68. POST /api/plugins/:domain/settings
|
||||
### 77. POST /api/plugins/:domain/settings
|
||||
- **Description**: Updates plugin settings. Saves settings to `cache/plugin-settings/{domain}.json` and persists them across plugin restarts.
|
||||
- **Path Parameters**:
|
||||
- `domain`: The plugin domain name (e.g., `example.plugin`).
|
||||
@@ -1781,7 +1793,7 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
|
||||
}
|
||||
```
|
||||
|
||||
### 69. GET /api/token
|
||||
### 78. GET /api/token
|
||||
- **Description**: Generates a signed Ed25519 authentication token for plugin authentication. Available to all plugins globally.
|
||||
- **Request Headers**: None required.
|
||||
- **Response**: JSON object with `token` (string), `expiresAt` (number), and `peerId` (string).
|
||||
@@ -1879,4 +1891,4 @@ See [plugins/PLUGIN_SDK.md](plugins/PLUGIN_SDK.md#authentication-and-authorizati
|
||||
- Use tools like `curl` or Postman to test endpoints.
|
||||
- Verify WebSocket updates using a WebSocket client (e.g., `wscat`).
|
||||
- Test DNS record creation with various types (e.g., SRV, SOA) and check `local_dns.json`.
|
||||
- Monitor logs via WebSocket or the admin interface for errors.
|
||||
- Monitor logs in the admin **Logs** tab (`subscribe-log` per channel) or `GET /api/logs/:channel`; plugin logs use `plugin-log` WebSocket messages.
|
||||
Reference in New Issue
Block a user