@jxa13/pm2ui 1.17.1 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,7 @@ Node WebUI provides a clean browser-based interface for viewing running services
37
37
  - Node.js 18+
38
38
  - One or more PM2-managed processes
39
39
 
40
- Install PM2 globally if you want to use the `pm2` command directly:
40
+ The package includes PM2 as a runtime dependency for the dashboard. Install PM2 globally only if you want to use the `pm2` command directly from your terminal:
41
41
 
42
42
  ```bash
43
43
  npm install -g pm2
@@ -114,6 +114,8 @@ Install dependencies:
114
114
  npm install
115
115
  ```
116
116
 
117
+ This installs runtime and development dependencies so the React frontend can be rebuilt from source. Global npm installs use the prebuilt frontend bundle shipped in the package.
118
+
117
119
  Start the app:
118
120
 
119
121
  ```bash
@@ -134,6 +136,8 @@ npm run react:smoke
134
136
  npm pack --dry-run
135
137
  ```
136
138
 
139
+ The package metadata includes public npm access. Publish from a supported CI environment with `npm publish --provenance` when you want npm provenance attached to the release.
140
+
137
141
  Bump the package version:
138
142
 
139
143
  ```bash
@@ -150,7 +154,7 @@ npm version major
150
154
  Publish the release:
151
155
 
152
156
  ```bash
153
- npm publish --access public
157
+ npm publish
154
158
  ```
155
159
 
156
160
  After publishing, users can upgrade with:
@@ -219,6 +223,8 @@ The logs viewer supports:
219
223
  - Download logs
220
224
  - Toggle line wrapping
221
225
 
226
+ Recent log history is read from the selected PM2 process log files. Live updates use PM2's Node API event bus instead of shelling out to `pm2 logs`.
227
+
222
228
  ---
223
229
 
224
230
  ## Security
@@ -231,18 +237,19 @@ Recommended:
231
237
  - Do not expose it directly to the internet
232
238
  - If remote access is needed, place it behind authentication and a reverse proxy
233
239
 
240
+ Unsafe local API methods such as process actions, PM2 save, log clearing, create, delete, and Finder reveal require a same-origin browser session token. This helps block drive-by POST or DELETE requests from unrelated websites, but it is not a substitute for authentication if the app is exposed beyond localhost.
241
+
234
242
  ---
235
243
 
236
244
  ## Future Ideas
237
245
 
238
246
  Potential future improvements:
239
247
 
240
- - Real-time log streaming with WebSockets
241
- - Process details modal
242
- - Create new PM2 processes from the UI
243
- - Historical CPU and RAM charts
244
248
  - Authentication for LAN access
245
- - Saved dashboard layouts
249
+ - Automated backend route coverage
250
+ - Split backend routes and frontend modules
251
+ - Import/export for operator preference profiles
252
+ - Process grouping and tags
246
253
 
247
254
  ---
248
255
 
@@ -31,60 +31,85 @@ async function withPm2(callback) {
31
31
  }
32
32
  }
33
33
 
34
- async function listProcesses() {
35
- return withPm2(() => new Promise((resolve, reject) => {
36
- pm2.list((error, list) => {
34
+ function pm2Callback(method, ...args) {
35
+ return new Promise((resolve, reject) => {
36
+ pm2[method](...args, (error, result) => {
37
37
  if (error) {
38
38
  reject(error);
39
39
  return;
40
40
  }
41
41
 
42
- resolve(list);
42
+ resolve(result);
43
43
  });
44
- }));
44
+ });
45
45
  }
46
46
 
47
- async function startProcess(target) {
48
- return withPm2(() => new Promise((resolve, reject) => {
49
- pm2.start(target, (error, result) => {
50
- if (error) {
51
- reject(error);
52
- return;
53
- }
47
+ async function listProcesses() {
48
+ return withPm2(() => pm2Callback('list'));
49
+ }
54
50
 
55
- resolve(result);
56
- });
57
- }));
51
+ async function startProcess(target) {
52
+ return withPm2(() => pm2Callback('start', target));
58
53
  }
59
54
 
60
55
  async function stopProcess(target) {
61
- return withPm2(() => new Promise((resolve, reject) => {
62
- pm2.stop(target, (error, result) => {
63
- if (error) {
64
- reject(error);
65
- return;
66
- }
67
-
68
- resolve(result);
69
- });
70
- }));
56
+ return withPm2(() => pm2Callback('stop', target));
71
57
  }
72
58
 
73
59
  async function restartProcess(target) {
74
- return withPm2(() => new Promise((resolve, reject) => {
75
- pm2.restart(target, (error, result) => {
60
+ return withPm2(() => pm2Callback('restart', target));
61
+ }
62
+
63
+ async function deleteProcess(target) {
64
+ return withPm2(() => pm2Callback('delete', target));
65
+ }
66
+
67
+ async function createProcess(options) {
68
+ return withPm2(() => pm2Callback('start', options));
69
+ }
70
+
71
+ async function savePm2State() {
72
+ return withPm2(() => pm2Callback('dump'));
73
+ }
74
+
75
+ async function flushProcessLogs(target) {
76
+ return withPm2(() => pm2Callback('flush', target));
77
+ }
78
+
79
+ async function connectLogBus() {
80
+ await connectPm2();
81
+
82
+ return new Promise((resolve, reject) => {
83
+ pm2.launchBus((error, bus, socket) => {
76
84
  if (error) {
85
+ disconnectPm2();
77
86
  reject(error);
78
87
  return;
79
88
  }
80
89
 
81
- resolve(result);
90
+ resolve({
91
+ bus,
92
+ close: () => {
93
+ try {
94
+ socket?.close?.();
95
+ } catch (socketError) {
96
+ console.error('PM2 log socket close error:', socketError);
97
+ }
98
+
99
+ disconnectPm2();
100
+ }
101
+ });
82
102
  });
83
- }));
103
+ });
84
104
  }
85
105
 
86
106
  module.exports = {
107
+ connectLogBus,
108
+ createProcess,
109
+ deleteProcess,
110
+ flushProcessLogs,
87
111
  listProcesses,
112
+ savePm2State,
88
113
  startProcess,
89
114
  stopProcess,
90
115
  restartProcess
package/changelog.md CHANGED
@@ -8,6 +8,26 @@ Version numbers should be updated with each commit that changes app behavior, us
8
8
  - Minor versions, such as `1.1.0`, for user-visible improvements that do not break existing behavior.
9
9
  - Major versions, such as `2.0.0`, for breaking changes.
10
10
 
11
+ ## 1.18.0 - 2026-06-08
12
+
13
+ ### Added
14
+
15
+ - Added npm package trust metadata, including repository, issue tracker, homepage, author, keywords, and public access settings.
16
+ - Added a same-origin API session token for unsafe local API methods such as PM2 process actions, create, delete, save, log clearing, and Finder reveal.
17
+
18
+ ### Changed
19
+
20
+ - Moved React, Vite, and icon packages from runtime dependencies to development dependencies because the published package serves the prebuilt frontend.
21
+ - Moved PM2 save, create, delete, flush, process actions, and live log streaming from PM2 CLI subprocesses to PM2's Node API.
22
+ - Changed recent log history loading to read the selected PM2 process stdout and stderr log files directly.
23
+ - Updated compatible transitive dependency versions in the lockfile through non-breaking audit fixes.
24
+ - Updated documentation for PM2 CLI requirements, optional npm provenance publishing, local API hardening, and current PM2 log behavior.
25
+
26
+ ### Security
27
+
28
+ - Reduced drive-by localhost request risk by requiring a server-generated token on unsafe API requests from the React UI.
29
+ - Resolved non-breaking runtime audit advisories while leaving the PM2 major-version advisory for a future breaking-change review.
30
+
11
31
  ## 1.17.1 - 2026-06-07
12
32
 
13
33
  ### Changed