underpost 2.8.851 → 2.8.852

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
@@ -48,12 +48,13 @@ template
48
48
 
49
49
 
50
50
 
51
+
51
52
 
52
53
 
53
54
  <!-- badges -->
54
55
 
55
56
 
56
- [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.8.851)](https://socket.dev/npm/package/underpost/overview/2.8.851) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
57
+ [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.8.852)](https://socket.dev/npm/package/underpost/overview/2.8.852) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
57
58
 
58
59
 
59
60
  <!-- end-badges -->
@@ -84,6 +85,7 @@ template
84
85
 
85
86
 
86
87
 
88
+
87
89
 
88
90
 
89
91
  </div>
@@ -130,43 +132,43 @@ Run dev client server
130
132
  npm run dev
131
133
  ```
132
134
  <!-- -->
133
- ## underpost ci/cd cli v2.8.851
135
+ ## underpost ci/cd cli v2.8.852
134
136
 
135
137
  ### Usage: `underpost [options] [command]`
136
-
137
- ```
138
- Options:
139
- -V, --version output the version number
140
- -h, --help display help for command
138
+ ```
139
+ Options:
140
+ -V, --version output the version number
141
+ -h, --help display help for command
141
142
 
142
143
  Commands:
143
- new <app-name> Initializes a new Underpost project with a predefined structure.
144
- start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
145
- clone [options] <uri> Clones a specified GitHub repository into the current directory.
146
- pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
147
- cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
148
- push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
149
- env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
150
- config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
151
- root Displays the root path of the npm installation.
152
- cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
153
- deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
154
- secret [options] <platform> Manages secrets for various platforms.
155
- dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
156
- dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
157
- install Quickly imports Underpost npm dependencies by copying them.
158
- db [options] <deploy-list> Manages database operations, including import, export, and collection management.
159
- script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
160
- cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
161
- fs [options] [path] Manages file storage, defaulting to file upload operations.
162
- test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
163
- monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
164
- ssh [options] Import and start ssh server and client based on current default deployment ID.
165
- run [options] <runner-id> [path] Runs a script from the specified path.
166
- lxd [options] Manages LXD containers and virtual machines.
167
- baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
168
- help [command] display help for command
169
-
144
+ new <app-name> Initializes a new Underpost project with a predefined structure.
145
+ start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
146
+ clone [options] <uri> Clones a specified GitHub repository into the current directory.
147
+ pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
148
+ cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
149
+ push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
150
+ env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
151
+ config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
152
+ root Displays the root path of the npm installation.
153
+ cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
154
+ deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
155
+ secret [options] <platform> Manages secrets for various platforms.
156
+ dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
157
+ dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
158
+ install Quickly imports Underpost npm dependencies by copying them.
159
+ db [options] <deploy-list> Manages database operations, including import, export, and collection management.
160
+ script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
161
+ cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
162
+ fs [options] [path] Manages file storage, defaulting to file upload operations.
163
+ test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
164
+ monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
165
+ ssh [options] Import and start ssh server and client based on current default deployment ID.
166
+ run [options] <runner-id> [path] Runs a script from the specified path.
167
+ lxd [options] Manages LXD containers and virtual machines.
168
+ baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
169
+ help [command] display help for command
170
+
170
171
  ```
171
-
172
+
172
173
  <a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
174
+
package/cli.md CHANGED
@@ -1,46 +1,45 @@
1
- ## underpost ci/cd cli v2.8.851
1
+ ## underpost ci/cd cli v2.8.852
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
-
5
- ```
6
- Options:
7
- -V, --version output the version number
8
- -h, --help display help for command
4
+ ```
5
+ Options:
6
+ -V, --version output the version number
7
+ -h, --help display help for command
9
8
 
10
9
  Commands:
11
- new <app-name> Initializes a new Underpost project with a predefined structure.
12
- start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
13
- clone [options] <uri> Clones a specified GitHub repository into the current directory.
14
- pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
15
- cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
16
- push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
17
- env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
18
- config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
19
- root Displays the root path of the npm installation.
20
- cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
21
- deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
22
- secret [options] <platform> Manages secrets for various platforms.
23
- dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
24
- dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
25
- install Quickly imports Underpost npm dependencies by copying them.
26
- db [options] <deploy-list> Manages database operations, including import, export, and collection management.
27
- script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
28
- cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
29
- fs [options] [path] Manages file storage, defaulting to file upload operations.
30
- test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
31
- monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
32
- ssh [options] Import and start ssh server and client based on current default deployment ID.
33
- run [options] <runner-id> [path] Runs a script from the specified path.
34
- lxd [options] Manages LXD containers and virtual machines.
35
- baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
36
- help [command] display help for command
37
-
10
+ new <app-name> Initializes a new Underpost project with a predefined structure.
11
+ start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
12
+ clone [options] <uri> Clones a specified GitHub repository into the current directory.
13
+ pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
14
+ cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
15
+ push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
16
+ env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
17
+ config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
18
+ root Displays the root path of the npm installation.
19
+ cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
20
+ deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
21
+ secret [options] <platform> Manages secrets for various platforms.
22
+ dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
23
+ dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
24
+ install Quickly imports Underpost npm dependencies by copying them.
25
+ db [options] <deploy-list> Manages database operations, including import, export, and collection management.
26
+ script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
27
+ cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
28
+ fs [options] [path] Manages file storage, defaulting to file upload operations.
29
+ test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
30
+ monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
31
+ ssh [options] Import and start ssh server and client based on current default deployment ID.
32
+ run [options] <runner-id> [path] Runs a script from the specified path.
33
+ lxd [options] Manages LXD containers and virtual machines.
34
+ baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
35
+ help [command] display help for command
36
+
38
37
  ```
39
38
 
40
39
  ## Commands:
40
+
41
41
 
42
42
  ### `new` :
43
-
44
43
  ```
45
44
  Usage: underpost new [options] <app-name>
46
45
 
@@ -51,11 +50,11 @@ Arguments:
51
50
 
52
51
  Options:
53
52
  -h, --help display help for command
54
-
53
+
55
54
  ```
55
+
56
56
 
57
57
  ### `start` :
58
-
59
58
  ```
60
59
  Usage: underpost start [options] <deploy-id> [env]
61
60
 
@@ -71,11 +70,11 @@ Options:
71
70
  --run Starts application servers and monitors their health.
72
71
  --build Triggers the client-side application build process.
73
72
  -h, --help display help for command
74
-
73
+
75
74
  ```
75
+
76
76
 
77
77
  ### `clone` :
78
-
79
78
  ```
80
79
  Usage: underpost clone [options] <uri>
81
80
 
@@ -88,11 +87,11 @@ Options:
88
87
  --bare Performs a bare clone, downloading only the .git files.
89
88
  -g8 Uses the g8 repository extension for cloning.
90
89
  -h, --help display help for command
91
-
90
+
92
91
  ```
92
+
93
93
 
94
94
  ### `pull` :
95
-
96
95
  ```
97
96
  Usage: underpost pull [options] <path> <uri>
98
97
 
@@ -106,11 +105,11 @@ Arguments:
106
105
  Options:
107
106
  -g8 Uses the g8 repository extension for pulling.
108
107
  -h, --help display help for command
109
-
108
+
110
109
  ```
110
+
111
111
 
112
112
  ### `cmt` :
113
-
114
113
  ```
115
114
  Usage: underpost cmt [options] <path> <commit-type> [module-tag] [message]
116
115
 
@@ -130,11 +129,11 @@ Options:
130
129
  --copy Copies the generated commit message to the clipboard.
131
130
  --info Displays information about available commit types.
132
131
  -h, --help display help for command
133
-
132
+
134
133
  ```
134
+
135
135
 
136
136
  ### `push` :
137
-
138
137
  ```
139
138
  Usage: underpost push [options] <path> <uri>
140
139
 
@@ -148,11 +147,11 @@ Options:
148
147
  -f Forces the push, overwriting the remote repository history.
149
148
  -g8 Uses the g8 repository extension for pushing.
150
149
  -h, --help display help for command
151
-
150
+
152
151
  ```
152
+
153
153
 
154
154
  ### `env` :
155
-
156
155
  ```
157
156
  Usage: underpost env [options] <deploy-id> [env]
158
157
 
@@ -167,11 +166,11 @@ Arguments:
167
166
 
168
167
  Options:
169
168
  -h, --help display help for command
170
-
169
+
171
170
  ```
171
+
172
172
 
173
173
  ### `config` :
174
-
175
174
  ```
176
175
  Usage: underpost config [options] <operator> [key] [value]
177
176
 
@@ -186,11 +185,11 @@ Arguments:
186
185
  Options:
187
186
  --plain Prints the configuration value in plain text.
188
187
  -h, --help display help for command
189
-
188
+
190
189
  ```
190
+
191
191
 
192
192
  ### `root` :
193
-
194
193
  ```
195
194
  Usage: underpost root [options]
196
195
 
@@ -198,11 +197,11 @@ Displays the root path of the npm installation.
198
197
 
199
198
  Options:
200
199
  -h, --help display help for command
201
-
200
+
202
201
  ```
202
+
203
203
 
204
204
  ### `cluster` :
205
-
206
205
  ```
207
206
  Usage: underpost cluster [options] [pod-name]
208
207
 
@@ -256,11 +255,11 @@ Options:
256
255
  --k3s Initializes the cluster using K3s (Lightweight
257
256
  Kubernetes).
258
257
  -h, --help display help for command
259
-
258
+
260
259
  ```
260
+
261
261
 
262
262
  ### `deploy` :
263
-
264
263
  ```
265
264
  Usage: underpost deploy [options] [deploy-list] [env]
266
265
 
@@ -307,11 +306,11 @@ Options:
307
306
  bundles (only static public or storage
308
307
  client files).
309
308
  -h, --help display help for command
310
-
309
+
311
310
  ```
311
+
312
312
 
313
313
  ### `secret` :
314
-
315
314
  ```
316
315
  Usage: underpost secret [options] <platform>
317
316
 
@@ -329,11 +328,11 @@ Options:
329
328
  --list Lists all available secrets for the
330
329
  platform.
331
330
  -h, --help display help for command
332
-
331
+
333
332
  ```
333
+
334
334
 
335
335
  ### `dockerfile-image-build` :
336
-
337
336
  ```
338
337
  Usage: underpost dockerfile-image-build [options]
339
338
 
@@ -360,11 +359,11 @@ Options:
360
359
  cache.
361
360
  --k3s-load Loads the image into a K3s cluster.
362
361
  -h, --help display help for command
363
-
362
+
364
363
  ```
364
+
365
365
 
366
366
  ### `dockerfile-pull-base-images` :
367
-
368
367
  ```
369
368
  Usage: underpost dockerfile-pull-base-images [options]
370
369
 
@@ -378,11 +377,11 @@ Options:
378
377
  --version Sets a custom version for the base images.
379
378
  --k3s-load Loads the image into a K3s cluster.
380
379
  -h, --help display help for command
381
-
380
+
382
381
  ```
382
+
383
383
 
384
384
  ### `install` :
385
-
386
385
  ```
387
386
  Usage: underpost install [options]
388
387
 
@@ -390,11 +389,11 @@ Quickly imports Underpost npm dependencies by copying them.
390
389
 
391
390
  Options:
392
391
  -h, --help display help for command
393
-
392
+
394
393
  ```
394
+
395
395
 
396
396
  ### `db` :
397
-
398
397
  ```
399
398
  Usage: underpost db [options] <deploy-list>
400
399
 
@@ -424,11 +423,11 @@ Options:
424
423
  --ns <ns-name> Optional: Specifies the namespace context for
425
424
  database operations.
426
425
  -h, --help display help for command
427
-
426
+
428
427
  ```
428
+
429
429
 
430
430
  ### `script` :
431
-
432
431
  ```
433
432
  Usage: underpost script [options] <operator> <script-name> [script-value]
434
433
 
@@ -450,11 +449,11 @@ Options:
450
449
  execution.
451
450
  --pod-name <pod-name> Optional: Specifies the pod name for script execution.
452
451
  -h, --help display help for command
453
-
452
+
454
453
  ```
454
+
455
455
 
456
456
  ### `cron` :
457
-
458
457
  ```
459
458
  Usage: underpost cron [options] [deploy-list] [job-list]
460
459
 
@@ -475,11 +474,11 @@ Options:
475
474
  --dashboard-update Updates dashboard cron data with the current job
476
475
  configurations.
477
476
  -h, --help display help for command
478
-
477
+
479
478
  ```
479
+
480
480
 
481
481
  ### `fs` :
482
-
483
482
  ```
484
483
  Usage: underpost fs [options] [path]
485
484
 
@@ -497,11 +496,11 @@ Options:
497
496
  --force Forces the action, overriding any warnings or conflicts.
498
497
  --storage-file-path <storage-file-path> Specifies a custom file storage path.
499
498
  -h, --help display help for command
500
-
499
+
501
500
  ```
501
+
502
502
 
503
503
  ### `test` :
504
-
505
504
  ```
506
505
  Usage: underpost test [options] [deploy-list]
507
506
 
@@ -523,11 +522,11 @@ Options:
523
522
  --kind-type <kind-type> Optional: Specifies the Kind cluster type for
524
523
  tests.
525
524
  -h, --help display help for command
526
-
525
+
527
526
  ```
527
+
528
528
 
529
529
  ### `monitor` :
530
-
531
530
  ```
532
531
  Usage: underpost monitor [options] <deploy-id> [env]
533
532
 
@@ -550,11 +549,11 @@ Options:
550
549
  --sync Synchronizes with current proxy deployments and
551
550
  traffic configurations.
552
551
  -h, --help display help for command
553
-
552
+
554
553
  ```
554
+
555
555
 
556
556
  ### `ssh` :
557
-
558
557
  ```
559
558
  Usage: underpost ssh [options]
560
559
 
@@ -564,11 +563,11 @@ Options:
564
563
  --generate Generates new ssh credential and stores it in current private
565
564
  keys file storage.
566
565
  -h, --help display help for command
567
-
566
+
568
567
  ```
568
+
569
569
 
570
570
  ### `run` :
571
-
572
571
  ```
573
572
  Usage: underpost run [options] <runner-id> [path]
574
573
 
@@ -590,11 +589,11 @@ Options:
590
589
  --container-name <container-name> Optional: Specifies the container name for test execution.
591
590
  --namespace <namespace> Optional: Specifies the namespace for test execution.
592
591
  -h, --help display help for command
593
-
592
+
594
593
  ```
594
+
595
595
 
596
596
  ### `lxd` :
597
-
598
597
  ```
599
598
  Usage: underpost lxd [options]
600
599
 
@@ -635,11 +634,11 @@ Options:
635
634
  --auto-expose-k8s-ports <vm-id> Automatically exposes common Kubernetes
636
635
  ports for the specified VM.
637
636
  -h, --help display help for command
638
-
637
+
639
638
  ```
639
+
640
640
 
641
641
  ### `baremetal` :
642
-
643
642
  ```
644
643
  Usage: underpost baremetal [options] [workflow-id] [hostname] [ip-address]
645
644
 
@@ -673,5 +672,6 @@ Options:
673
672
  baremetal operations.
674
673
  --ls Lists available boot resources and machines.
675
674
  -h, --help display help for command
676
-
675
+
677
676
  ```
677
+
@@ -58,7 +58,7 @@ services:
58
58
  cpus: '0.25'
59
59
  memory: 20M
60
60
  labels: # labels in Compose file instead of Dockerfile
61
- engine.version: '2.8.851'
61
+ engine.version: '2.8.852'
62
62
  networks:
63
63
  - load-balancer
64
64
 
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-template-development-blue
20
- image: localhost/rockylinux9-underpost:v2.8.851
20
+ image: localhost/rockylinux9-underpost:v2.8.852
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "124Ki"
@@ -100,7 +100,7 @@ spec:
100
100
  spec:
101
101
  containers:
102
102
  - name: dd-template-development-green
103
- image: localhost/rockylinux9-underpost:v2.8.851
103
+ image: localhost/rockylinux9-underpost:v2.8.852
104
104
  # resources:
105
105
  # requests:
106
106
  # memory: "124Ki"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.8.851",
5
+ "version": "2.8.852",
6
6
  "description": "pwa api rest template",
7
7
  "scripts": {
8
8
  "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
@@ -32,7 +32,7 @@ const UserService = {
32
32
  const payloadToken = hashJWT({ email: req.body.email }, '15m');
33
33
  const id = `${options.host}${options.path}`;
34
34
  const translate = MailerProvider.instance[id].translateTemplates.recoverEmail;
35
- const recoverUrl = `${process.env.NODE_ENV === 'development' ? 'http://' : 'https://'}${req.hostname}${
35
+ const recoverUrl = `${process.env.NODE_ENV === 'development' ? 'http://' : 'https://'}${req.body.hostname}${
36
36
  req.body.proxyPath
37
37
  }recover?payload=${payloadToken}`;
38
38
  const sendResult = await MailerProvider.send({
@@ -45,7 +45,7 @@ const UserService = {
45
45
  .replace('{{H1}}', translate.H1[req.lang])
46
46
  .replace('{{P1}}', translate.P1[req.lang])
47
47
  .replace('{{TOKEN}}', token)
48
- .replace(`{{COMPANY}}`, req.hostname) // html body
48
+ .replace(`{{COMPANY}}`, req.body.hostname) // html body
49
49
  .replace('{{RECOVER_WEB_URL}}', recoverUrl)
50
50
  .replace('{{RECOVER_BTN_LABEL}}', translate.BTN_LABEL[req.lang]),
51
51
 
@@ -94,7 +94,7 @@ const UserService = {
94
94
  .replace('{{H1}}', translate.H1[req.lang])
95
95
  .replace('{{P1}}', translate.P1[req.lang])
96
96
  .replace('{{TOKEN}}', token)
97
- .replace(`{{COMPANY}}`, req.hostname), // html body
97
+ .replace(`{{COMPANY}}`, req.body.hostname), // html body
98
98
  attachments: [
99
99
  // {
100
100
  // filename: 'logo.png',
@@ -103,7 +103,11 @@ const Account = {
103
103
  e.preventDefault();
104
104
  const result = await UserService.post({
105
105
  id: 'mailer/verify-email',
106
- body: { email: s(`.account-email`).value },
106
+ body: {
107
+ email: s(`.account-email`).value,
108
+ hostname: `${location.hostname}`,
109
+ proxyPath: getProxyPath(),
110
+ },
107
111
  });
108
112
  NotificationManager.Push({
109
113
  html: result.status === 'error' ? result.message : Translate.Render(`email send`),
@@ -81,6 +81,7 @@ const Recover = {
81
81
  switch (mode) {
82
82
  case 'recover-verify-email': {
83
83
  body.proxyPath = getProxyPath();
84
+ body.hostname = `${location.hostname}`;
84
85
  const result = await UserService.post({ id: 'recover-verify-email', body });
85
86
  NotificationManager.Push({
86
87
  html:
@@ -133,56 +133,54 @@ const copyData = (data) =>
133
133
  const pasteData = () => new Promise((resolve) => navigator.clipboard.readText().then((clipText) => resolve(clipText)));
134
134
 
135
135
  /**
136
- * Normalize a path/URL (ensure leading slash, collapse duplicate slashes,
137
- * keep query + hash, remove trailing slash except for root).
138
- * Examples:
139
- * - 'a/b' -> '/a/b'
140
- * - '/a//b/' -> '/a/b'
141
- * - 'https://example.com/a/b?q=1#top' -> '/a/b?q=1#top' (origin ignored)
142
- * - '#section' -> '/current/path#section' (resolved relative by new URL)
143
- */
144
- function normalizePath(input) {
145
- // ensure string and trim
146
- if (typeof input !== 'string') input = String(input ?? '');
147
- input = input.trim();
148
-
149
- // empty -> root
150
- if (input === '') return '/';
151
-
152
- // Use URL to parse relative or absolute paths relative to current origin
153
- let url;
154
- try {
155
- url = new URL(input, window.location.origin);
156
- } catch (e) {
157
- // fallback (very rare)
158
- input = input.replace(/\s+/g, ''); // remove problematic spaces
159
- input = input.replace(/\/+/g, '/'); // collapse multiple '/'
160
- if (!input.startsWith('/')) input = '/' + input;
161
- if (input.length > 1 && input.endsWith('/')) input = input.slice(0, -1);
162
- return input;
163
- }
164
-
165
- // Normalize pathname: collapse slashes, ensure leading slash, remove trailing except root
166
- let pathname = url.pathname.replace(/\/+/g, '/');
167
- if (!pathname.startsWith('/')) pathname = '/' + pathname;
168
- if (pathname.length > 1 && pathname.endsWith('/')) pathname = pathname.slice(0, -1);
169
-
170
- // Rebuild: pathname + search + hash
171
- return pathname + url.search + url.hash;
172
- }
173
-
174
- /**
175
- * Improved setPath: normalizes path and avoids pushState if nothing changes.
136
+ * The setPath function in JavaScript updates the browser's history with a new path, state, and title.
137
+ * @param path - The `path` parameter is a string that represents the URL path where you want to
138
+ * navigate or update in the browser history. It is the first parameter in the `setPath` function and
139
+ * has a default value of `'/'`.
140
+ * @param stateStorage - The `stateStorage` parameter in the `setPath` function is an object that
141
+ * represents the state object associated with the new history entry. It is used to store data related
142
+ * to the state of the application when navigating to a new path using `history.pushState()`. This data
143
+ * can be accessed later
144
+ * @param title - The `title` parameter in the `setPath` function is a string that represents the
145
+ * title of the new history entry. It is used as the title of the new history entry in the browser's
146
+ * history.
147
+ * @memberof VanillaJS
176
148
  */
177
149
  const setPath = (path = '/', stateStorage = {}, title = '') => {
178
- const normalized = normalizePath(path);
179
-
180
- // Compare the full form (pathname + search + hash) with current
181
- const currentFull = window.location.pathname + window.location.search + window.location.hash;
182
- if (currentFull === normalized) return; // nothing to do
183
-
184
- // pushState: third arg should be a path relative to same origin (we pass normalized)
185
- return history.pushState(stateStorage, title, normalized);
150
+ if (!path) path = '/';
151
+
152
+ const [inputPath, inputSearch] = `${path}`.split('?');
153
+
154
+ let sanitizedPath = (inputPath[0] !== '/' ? `/${inputPath}` : inputPath)
155
+ .trim()
156
+ .replaceAll('//', '/')
157
+ .replaceAll(`\\`, '/');
158
+
159
+ if (sanitizedPath.length > 1 && sanitizedPath[sanitizedPath.length - 1] === '/')
160
+ sanitizedPath = sanitizedPath.slice(0, -1);
161
+
162
+ if (window.location.pathname === sanitizedPath && (!inputSearch || inputSearch === location.search)) {
163
+ console.warn('Prevent overwriting same path', {
164
+ inputPath: inputPath,
165
+ inputSearch: inputSearch,
166
+ sanitizedPath: sanitizedPath,
167
+ currentLocationSearch: location.search,
168
+ currentLocationHash: location.hash,
169
+ });
170
+ return;
171
+ }
172
+ console.warn('Set path', {
173
+ inputPath: inputPath,
174
+ inputSearch: inputSearch,
175
+ sanitizedPath: sanitizedPath,
176
+ currentLocationSearch: location.search,
177
+ currentLocationHash: location.hash,
178
+ });
179
+ return history.pushState(
180
+ stateStorage,
181
+ title,
182
+ `${sanitizedPath}${inputSearch ? `?${inputSearch}` : ''}${location.hash ?? ''}`,
183
+ );
186
184
  };
187
185
 
188
186
  /**
package/src/index.js CHANGED
@@ -35,7 +35,7 @@ class Underpost {
35
35
  * @type {String}
36
36
  * @memberof Underpost
37
37
  */
38
- static version = 'v2.8.851';
38
+ static version = 'v2.8.852';
39
39
  /**
40
40
  * Repository cli API
41
41
  * @static