@pdkkid/n8n-nodes-nginx-proxy-manager 1.0.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 +225 -0
- package/dist/credentials.d.ts +36 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +51 -0
- package/dist/credentials.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/nginxProxyManager.d.ts +14 -0
- package/dist/nginxProxyManager.d.ts.map +1 -0
- package/dist/nginxProxyManager.js +968 -0
- package/dist/nginxProxyManager.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,968 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NginxProxyManager = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class NginxProxyManager {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'Nginx Proxy Manager',
|
|
9
|
+
name: 'nginxProxyManager',
|
|
10
|
+
icon: 'file:nginxProxyManager.svg',
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
14
|
+
description: 'Interact with Nginx Proxy Manager API',
|
|
15
|
+
defaults: {
|
|
16
|
+
name: 'Nginx Proxy Manager',
|
|
17
|
+
},
|
|
18
|
+
inputs: ['main'],
|
|
19
|
+
outputs: ['main'],
|
|
20
|
+
credentials: [
|
|
21
|
+
{
|
|
22
|
+
name: 'nginxProxyManagerApi',
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
properties: [
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Resource',
|
|
29
|
+
name: 'resource',
|
|
30
|
+
type: 'options',
|
|
31
|
+
noDataExpression: true,
|
|
32
|
+
options: [
|
|
33
|
+
{
|
|
34
|
+
name: 'Health',
|
|
35
|
+
value: 'health',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Proxy Host',
|
|
39
|
+
value: 'proxyHost',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Token',
|
|
43
|
+
value: 'token',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'User',
|
|
47
|
+
value: 'user',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Setting',
|
|
51
|
+
value: 'setting',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Report',
|
|
55
|
+
value: 'report',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
default: 'health',
|
|
59
|
+
},
|
|
60
|
+
// HEALTH OPERATIONS
|
|
61
|
+
{
|
|
62
|
+
displayName: 'Operation',
|
|
63
|
+
name: 'operation',
|
|
64
|
+
type: 'options',
|
|
65
|
+
noDataExpression: true,
|
|
66
|
+
displayOptions: {
|
|
67
|
+
show: {
|
|
68
|
+
resource: ['health'],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
options: [
|
|
72
|
+
{
|
|
73
|
+
name: 'Get Status',
|
|
74
|
+
value: 'getStatus',
|
|
75
|
+
description: 'Check the health status of the API',
|
|
76
|
+
action: 'Get health status',
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
default: 'getStatus',
|
|
80
|
+
},
|
|
81
|
+
// PROXY HOST OPERATIONS
|
|
82
|
+
{
|
|
83
|
+
displayName: 'Operation',
|
|
84
|
+
name: 'operation',
|
|
85
|
+
type: 'options',
|
|
86
|
+
noDataExpression: true,
|
|
87
|
+
displayOptions: {
|
|
88
|
+
show: {
|
|
89
|
+
resource: ['proxyHost'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
options: [
|
|
93
|
+
{
|
|
94
|
+
name: 'Create',
|
|
95
|
+
value: 'create',
|
|
96
|
+
description: 'Create a new proxy host',
|
|
97
|
+
action: 'Create a proxy host',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'Delete',
|
|
101
|
+
value: 'delete',
|
|
102
|
+
description: 'Delete a proxy host',
|
|
103
|
+
action: 'Delete a proxy host',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'Get',
|
|
107
|
+
value: 'get',
|
|
108
|
+
description: 'Get a proxy host by ID',
|
|
109
|
+
action: 'Get a proxy host',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'Get All',
|
|
113
|
+
value: 'getAll',
|
|
114
|
+
description: 'Get all proxy hosts',
|
|
115
|
+
action: 'Get all proxy hosts',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'Update',
|
|
119
|
+
value: 'update',
|
|
120
|
+
description: 'Update a proxy host',
|
|
121
|
+
action: 'Update a proxy host',
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
default: 'getAll',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
displayName: 'Proxy Host ID',
|
|
128
|
+
name: 'proxyHostId',
|
|
129
|
+
type: 'number',
|
|
130
|
+
required: true,
|
|
131
|
+
displayOptions: {
|
|
132
|
+
show: {
|
|
133
|
+
resource: ['proxyHost'],
|
|
134
|
+
operation: ['get', 'update', 'delete'],
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
default: 0,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
displayName: 'Expand',
|
|
141
|
+
name: 'expand',
|
|
142
|
+
type: 'options',
|
|
143
|
+
displayOptions: {
|
|
144
|
+
show: {
|
|
145
|
+
resource: ['proxyHost'],
|
|
146
|
+
operation: ['getAll', 'get'],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
options: [
|
|
150
|
+
{
|
|
151
|
+
name: 'Access List',
|
|
152
|
+
value: 'access_list',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'Owner',
|
|
156
|
+
value: 'owner',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'Certificate',
|
|
160
|
+
value: 'certificate',
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
default: 'owner',
|
|
164
|
+
description: 'Expand related resources',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
displayName: 'Domain Names',
|
|
168
|
+
name: 'domainNames',
|
|
169
|
+
type: 'string',
|
|
170
|
+
required: true,
|
|
171
|
+
displayOptions: {
|
|
172
|
+
show: {
|
|
173
|
+
resource: ['proxyHost'],
|
|
174
|
+
operation: ['create', 'update'],
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
default: '',
|
|
178
|
+
description: 'Comma-separated list of domain names',
|
|
179
|
+
placeholder: 'example.com,www.example.com',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
displayName: 'Forward Host',
|
|
183
|
+
name: 'forwardHost',
|
|
184
|
+
type: 'string',
|
|
185
|
+
required: true,
|
|
186
|
+
displayOptions: {
|
|
187
|
+
show: {
|
|
188
|
+
resource: ['proxyHost'],
|
|
189
|
+
operation: ['create', 'update'],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
default: '',
|
|
193
|
+
description: 'The hostname or IP to forward requests to',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
displayName: 'Forward Port',
|
|
197
|
+
name: 'forwardPort',
|
|
198
|
+
type: 'number',
|
|
199
|
+
required: true,
|
|
200
|
+
displayOptions: {
|
|
201
|
+
show: {
|
|
202
|
+
resource: ['proxyHost'],
|
|
203
|
+
operation: ['create', 'update'],
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
default: 80,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
displayName: 'Forward Scheme',
|
|
210
|
+
name: 'forwardScheme',
|
|
211
|
+
type: 'options',
|
|
212
|
+
displayOptions: {
|
|
213
|
+
show: {
|
|
214
|
+
resource: ['proxyHost'],
|
|
215
|
+
operation: ['create', 'update'],
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
options: [
|
|
219
|
+
{
|
|
220
|
+
name: 'HTTP',
|
|
221
|
+
value: 'http',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'HTTPS',
|
|
225
|
+
value: 'https',
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
default: 'http',
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
displayName: 'Enabled',
|
|
232
|
+
name: 'enabled',
|
|
233
|
+
type: 'boolean',
|
|
234
|
+
displayOptions: {
|
|
235
|
+
show: {
|
|
236
|
+
resource: ['proxyHost'],
|
|
237
|
+
operation: ['create', 'update'],
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
default: true,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
displayName: 'SSL Forced',
|
|
244
|
+
name: 'sslForced',
|
|
245
|
+
type: 'boolean',
|
|
246
|
+
displayOptions: {
|
|
247
|
+
show: {
|
|
248
|
+
resource: ['proxyHost'],
|
|
249
|
+
operation: ['create', 'update'],
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
default: false,
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
displayName: 'Caching Enabled',
|
|
256
|
+
name: 'cachingEnabled',
|
|
257
|
+
type: 'boolean',
|
|
258
|
+
displayOptions: {
|
|
259
|
+
show: {
|
|
260
|
+
resource: ['proxyHost'],
|
|
261
|
+
operation: ['create', 'update'],
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
default: false,
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
displayName: 'Block Exploits',
|
|
268
|
+
name: 'blockExploits',
|
|
269
|
+
type: 'boolean',
|
|
270
|
+
displayOptions: {
|
|
271
|
+
show: {
|
|
272
|
+
resource: ['proxyHost'],
|
|
273
|
+
operation: ['create', 'update'],
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
default: false,
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
displayName: 'Allow Websocket Upgrade',
|
|
280
|
+
name: 'allowWebsocketUpgrade',
|
|
281
|
+
type: 'boolean',
|
|
282
|
+
displayOptions: {
|
|
283
|
+
show: {
|
|
284
|
+
resource: ['proxyHost'],
|
|
285
|
+
operation: ['create', 'update'],
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
default: false,
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
displayName: 'HTTP/2 Support',
|
|
292
|
+
name: 'http2Support',
|
|
293
|
+
type: 'boolean',
|
|
294
|
+
displayOptions: {
|
|
295
|
+
show: {
|
|
296
|
+
resource: ['proxyHost'],
|
|
297
|
+
operation: ['create', 'update'],
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
default: false,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
displayName: 'HSTS Enabled',
|
|
304
|
+
name: 'hstsEnabled',
|
|
305
|
+
type: 'boolean',
|
|
306
|
+
displayOptions: {
|
|
307
|
+
show: {
|
|
308
|
+
resource: ['proxyHost'],
|
|
309
|
+
operation: ['create', 'update'],
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
default: false,
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
displayName: 'HSTS Subdomains',
|
|
316
|
+
name: 'hstsSubdomains',
|
|
317
|
+
type: 'boolean',
|
|
318
|
+
displayOptions: {
|
|
319
|
+
show: {
|
|
320
|
+
resource: ['proxyHost'],
|
|
321
|
+
operation: ['create', 'update'],
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
default: false,
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
displayName: 'Advanced Config',
|
|
328
|
+
name: 'advancedConfig',
|
|
329
|
+
type: 'string',
|
|
330
|
+
typeOptions: {
|
|
331
|
+
rows: 4,
|
|
332
|
+
},
|
|
333
|
+
displayOptions: {
|
|
334
|
+
show: {
|
|
335
|
+
resource: ['proxyHost'],
|
|
336
|
+
operation: ['create', 'update'],
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
default: '',
|
|
340
|
+
description: 'Advanced Nginx configuration',
|
|
341
|
+
},
|
|
342
|
+
// TOKEN OPERATIONS
|
|
343
|
+
{
|
|
344
|
+
displayName: 'Operation',
|
|
345
|
+
name: 'operation',
|
|
346
|
+
type: 'options',
|
|
347
|
+
noDataExpression: true,
|
|
348
|
+
displayOptions: {
|
|
349
|
+
show: {
|
|
350
|
+
resource: ['token'],
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
options: [
|
|
354
|
+
{
|
|
355
|
+
name: 'Get New Token',
|
|
356
|
+
value: 'getToken',
|
|
357
|
+
description: 'Request a new access token',
|
|
358
|
+
action: 'Get a new token',
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
name: 'Refresh Token',
|
|
362
|
+
value: 'refreshToken',
|
|
363
|
+
description: 'Refresh current access token',
|
|
364
|
+
action: 'Refresh token',
|
|
365
|
+
},
|
|
366
|
+
],
|
|
367
|
+
default: 'getToken',
|
|
368
|
+
},
|
|
369
|
+
// USER OPERATIONS
|
|
370
|
+
{
|
|
371
|
+
displayName: 'Operation',
|
|
372
|
+
name: 'operation',
|
|
373
|
+
type: 'options',
|
|
374
|
+
noDataExpression: true,
|
|
375
|
+
displayOptions: {
|
|
376
|
+
show: {
|
|
377
|
+
resource: ['user'],
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
options: [
|
|
381
|
+
{
|
|
382
|
+
name: 'Create',
|
|
383
|
+
value: 'create',
|
|
384
|
+
description: 'Create a new user',
|
|
385
|
+
action: 'Create a user',
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
name: 'Delete',
|
|
389
|
+
value: 'delete',
|
|
390
|
+
description: 'Delete a user',
|
|
391
|
+
action: 'Delete a user',
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
name: 'Get',
|
|
395
|
+
value: 'get',
|
|
396
|
+
description: 'Get a user by ID',
|
|
397
|
+
action: 'Get a user',
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
name: 'Get All',
|
|
401
|
+
value: 'getAll',
|
|
402
|
+
description: 'Get all users',
|
|
403
|
+
action: 'Get all users',
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
name: 'Update',
|
|
407
|
+
value: 'update',
|
|
408
|
+
description: 'Update a user',
|
|
409
|
+
action: 'Update a user',
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
name: 'Update Auth',
|
|
413
|
+
value: 'updateAuth',
|
|
414
|
+
description: 'Update user authentication',
|
|
415
|
+
action: 'Update user auth',
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: 'Update Permissions',
|
|
419
|
+
value: 'updatePermissions',
|
|
420
|
+
description: 'Update user permissions',
|
|
421
|
+
action: 'Update user permissions',
|
|
422
|
+
},
|
|
423
|
+
],
|
|
424
|
+
default: 'getAll',
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
displayName: 'User ID',
|
|
428
|
+
name: 'userId',
|
|
429
|
+
type: 'number',
|
|
430
|
+
required: true,
|
|
431
|
+
displayOptions: {
|
|
432
|
+
show: {
|
|
433
|
+
resource: ['user'],
|
|
434
|
+
operation: ['get', 'update', 'delete', 'updateAuth', 'updatePermissions'],
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
default: 0,
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
displayName: 'Email',
|
|
441
|
+
name: 'email',
|
|
442
|
+
type: 'string',
|
|
443
|
+
required: true,
|
|
444
|
+
displayOptions: {
|
|
445
|
+
show: {
|
|
446
|
+
resource: ['user'],
|
|
447
|
+
operation: ['create', 'update'],
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
default: '',
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
displayName: 'Name',
|
|
454
|
+
name: 'name',
|
|
455
|
+
type: 'string',
|
|
456
|
+
required: true,
|
|
457
|
+
displayOptions: {
|
|
458
|
+
show: {
|
|
459
|
+
resource: ['user'],
|
|
460
|
+
operation: ['create', 'update'],
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
default: '',
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
displayName: 'Nickname',
|
|
467
|
+
name: 'nickname',
|
|
468
|
+
type: 'string',
|
|
469
|
+
displayOptions: {
|
|
470
|
+
show: {
|
|
471
|
+
resource: ['user'],
|
|
472
|
+
operation: ['create', 'update'],
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
default: '',
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
displayName: 'Password',
|
|
479
|
+
name: 'userPassword',
|
|
480
|
+
type: 'string',
|
|
481
|
+
typeOptions: {
|
|
482
|
+
password: true,
|
|
483
|
+
},
|
|
484
|
+
required: true,
|
|
485
|
+
displayOptions: {
|
|
486
|
+
show: {
|
|
487
|
+
resource: ['user'],
|
|
488
|
+
operation: ['create', 'updateAuth'],
|
|
489
|
+
},
|
|
490
|
+
},
|
|
491
|
+
default: '',
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
displayName: 'Current Password',
|
|
495
|
+
name: 'currentPassword',
|
|
496
|
+
type: 'string',
|
|
497
|
+
typeOptions: {
|
|
498
|
+
password: true,
|
|
499
|
+
},
|
|
500
|
+
displayOptions: {
|
|
501
|
+
show: {
|
|
502
|
+
resource: ['user'],
|
|
503
|
+
operation: ['updateAuth'],
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
default: '',
|
|
507
|
+
description: 'Required when updating password',
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
displayName: 'Roles',
|
|
511
|
+
name: 'roles',
|
|
512
|
+
type: 'multiOptions',
|
|
513
|
+
displayOptions: {
|
|
514
|
+
show: {
|
|
515
|
+
resource: ['user'],
|
|
516
|
+
operation: ['create', 'update'],
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
options: [
|
|
520
|
+
{
|
|
521
|
+
name: 'Admin',
|
|
522
|
+
value: 'admin',
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
name: 'User',
|
|
526
|
+
value: 'user',
|
|
527
|
+
},
|
|
528
|
+
],
|
|
529
|
+
default: ['user'],
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
displayName: 'Is Disabled',
|
|
533
|
+
name: 'isDisabled',
|
|
534
|
+
type: 'boolean',
|
|
535
|
+
displayOptions: {
|
|
536
|
+
show: {
|
|
537
|
+
resource: ['user'],
|
|
538
|
+
operation: ['create', 'update'],
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
default: false,
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
displayName: 'Expand',
|
|
545
|
+
name: 'expandUser',
|
|
546
|
+
type: 'options',
|
|
547
|
+
displayOptions: {
|
|
548
|
+
show: {
|
|
549
|
+
resource: ['user'],
|
|
550
|
+
operation: ['getAll', 'get'],
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
options: [
|
|
554
|
+
{
|
|
555
|
+
name: 'Permissions',
|
|
556
|
+
value: 'permissions',
|
|
557
|
+
},
|
|
558
|
+
],
|
|
559
|
+
default: 'permissions',
|
|
560
|
+
},
|
|
561
|
+
// PERMISSIONS
|
|
562
|
+
{
|
|
563
|
+
displayName: 'Visibility',
|
|
564
|
+
name: 'visibility',
|
|
565
|
+
type: 'options',
|
|
566
|
+
displayOptions: {
|
|
567
|
+
show: {
|
|
568
|
+
resource: ['user'],
|
|
569
|
+
operation: ['updatePermissions'],
|
|
570
|
+
},
|
|
571
|
+
},
|
|
572
|
+
options: [
|
|
573
|
+
{
|
|
574
|
+
name: 'All',
|
|
575
|
+
value: 'all',
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
name: 'User',
|
|
579
|
+
value: 'user',
|
|
580
|
+
},
|
|
581
|
+
],
|
|
582
|
+
default: 'all',
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
displayName: 'Proxy Hosts Permission',
|
|
586
|
+
name: 'proxyHostsPermission',
|
|
587
|
+
type: 'options',
|
|
588
|
+
displayOptions: {
|
|
589
|
+
show: {
|
|
590
|
+
resource: ['user'],
|
|
591
|
+
operation: ['updatePermissions'],
|
|
592
|
+
},
|
|
593
|
+
},
|
|
594
|
+
options: [
|
|
595
|
+
{
|
|
596
|
+
name: 'Hidden',
|
|
597
|
+
value: 'hidden',
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: 'View',
|
|
601
|
+
value: 'view',
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
name: 'Manage',
|
|
605
|
+
value: 'manage',
|
|
606
|
+
},
|
|
607
|
+
],
|
|
608
|
+
default: 'manage',
|
|
609
|
+
},
|
|
610
|
+
// SETTING OPERATIONS
|
|
611
|
+
{
|
|
612
|
+
displayName: 'Operation',
|
|
613
|
+
name: 'operation',
|
|
614
|
+
type: 'options',
|
|
615
|
+
noDataExpression: true,
|
|
616
|
+
displayOptions: {
|
|
617
|
+
show: {
|
|
618
|
+
resource: ['setting'],
|
|
619
|
+
},
|
|
620
|
+
},
|
|
621
|
+
options: [
|
|
622
|
+
{
|
|
623
|
+
name: 'Get',
|
|
624
|
+
value: 'get',
|
|
625
|
+
description: 'Get a setting',
|
|
626
|
+
action: 'Get a setting',
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
name: 'Get All',
|
|
630
|
+
value: 'getAll',
|
|
631
|
+
description: 'Get all settings',
|
|
632
|
+
action: 'Get all settings',
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
name: 'Update',
|
|
636
|
+
value: 'update',
|
|
637
|
+
description: 'Update a setting',
|
|
638
|
+
action: 'Update a setting',
|
|
639
|
+
},
|
|
640
|
+
],
|
|
641
|
+
default: 'getAll',
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
displayName: 'Setting ID',
|
|
645
|
+
name: 'settingId',
|
|
646
|
+
type: 'string',
|
|
647
|
+
required: true,
|
|
648
|
+
displayOptions: {
|
|
649
|
+
show: {
|
|
650
|
+
resource: ['setting'],
|
|
651
|
+
operation: ['get', 'update'],
|
|
652
|
+
},
|
|
653
|
+
},
|
|
654
|
+
default: '',
|
|
655
|
+
description: 'Setting ID (e.g., default-site)',
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
displayName: 'Value',
|
|
659
|
+
name: 'value',
|
|
660
|
+
type: 'string',
|
|
661
|
+
required: true,
|
|
662
|
+
displayOptions: {
|
|
663
|
+
show: {
|
|
664
|
+
resource: ['setting'],
|
|
665
|
+
operation: ['update'],
|
|
666
|
+
},
|
|
667
|
+
},
|
|
668
|
+
default: '',
|
|
669
|
+
description: 'Setting value',
|
|
670
|
+
},
|
|
671
|
+
// REPORT OPERATIONS
|
|
672
|
+
{
|
|
673
|
+
displayName: 'Operation',
|
|
674
|
+
name: 'operation',
|
|
675
|
+
type: 'options',
|
|
676
|
+
noDataExpression: true,
|
|
677
|
+
displayOptions: {
|
|
678
|
+
show: {
|
|
679
|
+
resource: ['report'],
|
|
680
|
+
},
|
|
681
|
+
},
|
|
682
|
+
options: [
|
|
683
|
+
{
|
|
684
|
+
name: 'Get Hosts Report',
|
|
685
|
+
value: 'getHostsReport',
|
|
686
|
+
description: 'Get host statistics report',
|
|
687
|
+
action: 'Get hosts report',
|
|
688
|
+
},
|
|
689
|
+
],
|
|
690
|
+
default: 'getHostsReport',
|
|
691
|
+
},
|
|
692
|
+
],
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
async execute() {
|
|
696
|
+
const credentials = await this.getCredentials('nginxProxyManagerApi');
|
|
697
|
+
if (!credentials) {
|
|
698
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No credentials provided');
|
|
699
|
+
}
|
|
700
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
701
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
702
|
+
let response;
|
|
703
|
+
try {
|
|
704
|
+
if (resource === 'health' && operation === 'getStatus') {
|
|
705
|
+
response = await this.helpers.request({
|
|
706
|
+
method: 'GET',
|
|
707
|
+
url: `${credentials.apiUrl}/`,
|
|
708
|
+
json: true,
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
else if (resource === 'proxyHost') {
|
|
712
|
+
response = await this.handleProxyHost(credentials, operation);
|
|
713
|
+
}
|
|
714
|
+
else if (resource === 'token') {
|
|
715
|
+
response = await this.handleToken(credentials, operation);
|
|
716
|
+
}
|
|
717
|
+
else if (resource === 'user') {
|
|
718
|
+
response = await this.handleUser(credentials, operation);
|
|
719
|
+
}
|
|
720
|
+
else if (resource === 'setting') {
|
|
721
|
+
response = await this.handleSetting(credentials, operation);
|
|
722
|
+
}
|
|
723
|
+
else if (resource === 'report') {
|
|
724
|
+
response = await this.handleReport(credentials, operation);
|
|
725
|
+
}
|
|
726
|
+
return [[{ json: response }]];
|
|
727
|
+
}
|
|
728
|
+
catch (error) {
|
|
729
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Error: ${error.message}`);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
async handleProxyHost(credentials, operation) {
|
|
733
|
+
const baseUrl = credentials.apiUrl;
|
|
734
|
+
let method = 'GET';
|
|
735
|
+
let url = `${baseUrl}/nginx/proxy-hosts`;
|
|
736
|
+
let body = {};
|
|
737
|
+
if (operation === 'getAll') {
|
|
738
|
+
const expand = this.getNodeParameter('expand', 0);
|
|
739
|
+
url += expand ? `?expand=${expand}` : '';
|
|
740
|
+
}
|
|
741
|
+
else if (operation === 'get') {
|
|
742
|
+
const proxyHostId = this.getNodeParameter('proxyHostId', 0);
|
|
743
|
+
url += `/${proxyHostId}`;
|
|
744
|
+
}
|
|
745
|
+
else if (operation === 'create') {
|
|
746
|
+
method = 'POST';
|
|
747
|
+
body = this.buildProxyHostPayload('create');
|
|
748
|
+
}
|
|
749
|
+
else if (operation === 'update') {
|
|
750
|
+
method = 'PUT';
|
|
751
|
+
const proxyHostId = this.getNodeParameter('proxyHostId', 0);
|
|
752
|
+
url += `/${proxyHostId}`;
|
|
753
|
+
body = this.buildProxyHostPayload('update');
|
|
754
|
+
}
|
|
755
|
+
else if (operation === 'delete') {
|
|
756
|
+
method = 'DELETE';
|
|
757
|
+
const proxyHostId = this.getNodeParameter('proxyHostId', 0);
|
|
758
|
+
url += `/${proxyHostId}`;
|
|
759
|
+
}
|
|
760
|
+
const token = await this.getToken(credentials);
|
|
761
|
+
return this.helpers.request({
|
|
762
|
+
method,
|
|
763
|
+
url,
|
|
764
|
+
headers: {
|
|
765
|
+
Authorization: `Bearer ${token}`,
|
|
766
|
+
},
|
|
767
|
+
body: Object.keys(body).length ? body : undefined,
|
|
768
|
+
json: true,
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
buildProxyHostPayload(operation) {
|
|
772
|
+
const domainNames = this.getNodeParameter('domainNames', 0)
|
|
773
|
+
.split(',')
|
|
774
|
+
.map((d) => d.trim());
|
|
775
|
+
const forwardHost = this.getNodeParameter('forwardHost', 0);
|
|
776
|
+
const forwardPort = this.getNodeParameter('forwardPort', 0);
|
|
777
|
+
const forwardScheme = this.getNodeParameter('forwardScheme', 0);
|
|
778
|
+
const enabled = this.getNodeParameter('enabled', 0);
|
|
779
|
+
const sslForced = this.getNodeParameter('sslForced', 0);
|
|
780
|
+
const cachingEnabled = this.getNodeParameter('cachingEnabled', 0);
|
|
781
|
+
const blockExploits = this.getNodeParameter('blockExploits', 0);
|
|
782
|
+
const allowWebsocketUpgrade = this.getNodeParameter('allowWebsocketUpgrade', 0);
|
|
783
|
+
const http2Support = this.getNodeParameter('http2Support', 0);
|
|
784
|
+
const hstsEnabled = this.getNodeParameter('hstsEnabled', 0);
|
|
785
|
+
const hstsSubdomains = this.getNodeParameter('hstsSubdomains', 0);
|
|
786
|
+
const advancedConfig = this.getNodeParameter('advancedConfig', 0);
|
|
787
|
+
return {
|
|
788
|
+
domain_names: domainNames,
|
|
789
|
+
forward_host: forwardHost,
|
|
790
|
+
forward_port: forwardPort,
|
|
791
|
+
forward_scheme: forwardScheme,
|
|
792
|
+
enabled: enabled ? 1 : 0,
|
|
793
|
+
ssl_forced: sslForced ? 1 : 0,
|
|
794
|
+
caching_enabled: cachingEnabled ? 1 : 0,
|
|
795
|
+
block_exploits: blockExploits ? 1 : 0,
|
|
796
|
+
allow_websocket_upgrade: allowWebsocketUpgrade ? 1 : 0,
|
|
797
|
+
http2_support: http2Support ? 1 : 0,
|
|
798
|
+
hsts_enabled: hstsEnabled ? 1 : 0,
|
|
799
|
+
hsts_subdomains: hstsSubdomains ? 1 : 0,
|
|
800
|
+
advanced_config: advancedConfig,
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
async handleToken(credentials, operation) {
|
|
804
|
+
const baseUrl = credentials.apiUrl;
|
|
805
|
+
if (operation === 'getToken') {
|
|
806
|
+
return this.helpers.request({
|
|
807
|
+
method: 'POST',
|
|
808
|
+
url: `${baseUrl}/tokens`,
|
|
809
|
+
body: {
|
|
810
|
+
identity: credentials.email,
|
|
811
|
+
secret: credentials.password,
|
|
812
|
+
scope: 'user',
|
|
813
|
+
},
|
|
814
|
+
json: true,
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
else if (operation === 'refreshToken') {
|
|
818
|
+
const token = await this.getToken(credentials);
|
|
819
|
+
return this.helpers.request({
|
|
820
|
+
method: 'GET',
|
|
821
|
+
url: `${baseUrl}/tokens`,
|
|
822
|
+
headers: {
|
|
823
|
+
Authorization: `Bearer ${token}`,
|
|
824
|
+
},
|
|
825
|
+
json: true,
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
async handleUser(credentials, operation) {
|
|
830
|
+
const baseUrl = credentials.apiUrl;
|
|
831
|
+
const token = await this.getToken(credentials);
|
|
832
|
+
let method = 'GET';
|
|
833
|
+
let url = `${baseUrl}/users`;
|
|
834
|
+
let body = {};
|
|
835
|
+
if (operation === 'getAll') {
|
|
836
|
+
const expand = this.getNodeParameter('expandUser', 0);
|
|
837
|
+
url += expand ? `?expand=${expand}` : '';
|
|
838
|
+
}
|
|
839
|
+
else if (operation === 'get') {
|
|
840
|
+
const userId = this.getNodeParameter('userId', 0);
|
|
841
|
+
url += `/${userId}`;
|
|
842
|
+
}
|
|
843
|
+
else if (operation === 'create') {
|
|
844
|
+
method = 'POST';
|
|
845
|
+
body = this.buildUserPayload();
|
|
846
|
+
}
|
|
847
|
+
else if (operation === 'update') {
|
|
848
|
+
method = 'PUT';
|
|
849
|
+
const userId = this.getNodeParameter('userId', 0);
|
|
850
|
+
url += `/${userId}`;
|
|
851
|
+
body = this.buildUserPayload();
|
|
852
|
+
}
|
|
853
|
+
else if (operation === 'delete') {
|
|
854
|
+
method = 'DELETE';
|
|
855
|
+
const userId = this.getNodeParameter('userId', 0);
|
|
856
|
+
url += `/${userId}`;
|
|
857
|
+
}
|
|
858
|
+
else if (operation === 'updateAuth') {
|
|
859
|
+
method = 'PUT';
|
|
860
|
+
const userId = this.getNodeParameter('userId', 0);
|
|
861
|
+
url += `/${userId}/auth`;
|
|
862
|
+
const userPassword = this.getNodeParameter('userPassword', 0);
|
|
863
|
+
const currentPassword = this.getNodeParameter('currentPassword', 0);
|
|
864
|
+
body = {
|
|
865
|
+
type: 'password',
|
|
866
|
+
secret: userPassword,
|
|
867
|
+
current: currentPassword || undefined,
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
else if (operation === 'updatePermissions') {
|
|
871
|
+
method = 'PUT';
|
|
872
|
+
const userId = this.getNodeParameter('userId', 0);
|
|
873
|
+
url += `/${userId}/permissions`;
|
|
874
|
+
const visibility = this.getNodeParameter('visibility', 0);
|
|
875
|
+
const proxyHostsPermission = this.getNodeParameter('proxyHostsPermission', 0);
|
|
876
|
+
body = {
|
|
877
|
+
visibility,
|
|
878
|
+
proxy_hosts: proxyHostsPermission,
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
return this.helpers.request({
|
|
882
|
+
method,
|
|
883
|
+
url,
|
|
884
|
+
headers: {
|
|
885
|
+
Authorization: `Bearer ${token}`,
|
|
886
|
+
},
|
|
887
|
+
body: Object.keys(body).length ? body : undefined,
|
|
888
|
+
json: true,
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
buildUserPayload() {
|
|
892
|
+
const email = this.getNodeParameter('email', 0);
|
|
893
|
+
const name = this.getNodeParameter('name', 0);
|
|
894
|
+
const nickname = this.getNodeParameter('nickname', 0);
|
|
895
|
+
const roles = this.getNodeParameter('roles', 0);
|
|
896
|
+
const isDisabled = this.getNodeParameter('isDisabled', 0);
|
|
897
|
+
return {
|
|
898
|
+
email,
|
|
899
|
+
name,
|
|
900
|
+
nickname,
|
|
901
|
+
roles,
|
|
902
|
+
is_disabled: isDisabled ? 1 : 0,
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
async handleSetting(credentials, operation) {
|
|
906
|
+
const baseUrl = credentials.apiUrl;
|
|
907
|
+
const token = await this.getToken(credentials);
|
|
908
|
+
let method = 'GET';
|
|
909
|
+
let url = `${baseUrl}/settings`;
|
|
910
|
+
let body = {};
|
|
911
|
+
if (operation === 'get') {
|
|
912
|
+
const settingId = this.getNodeParameter('settingId', 0);
|
|
913
|
+
url += `/${settingId}`;
|
|
914
|
+
}
|
|
915
|
+
else if (operation === 'update') {
|
|
916
|
+
method = 'PUT';
|
|
917
|
+
const settingId = this.getNodeParameter('settingId', 0);
|
|
918
|
+
url += `/${settingId}`;
|
|
919
|
+
const value = this.getNodeParameter('value', 0);
|
|
920
|
+
body = {
|
|
921
|
+
id: settingId,
|
|
922
|
+
value,
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
return this.helpers.request({
|
|
926
|
+
method,
|
|
927
|
+
url,
|
|
928
|
+
headers: {
|
|
929
|
+
Authorization: `Bearer ${token}`,
|
|
930
|
+
},
|
|
931
|
+
body: Object.keys(body).length ? body : undefined,
|
|
932
|
+
json: true,
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
async handleReport(credentials, operation) {
|
|
936
|
+
const baseUrl = credentials.apiUrl;
|
|
937
|
+
const token = await this.getToken(credentials);
|
|
938
|
+
let url = `${baseUrl}/reports/hosts`;
|
|
939
|
+
if (operation === 'getHostsReport') {
|
|
940
|
+
return this.helpers.request({
|
|
941
|
+
method: 'GET',
|
|
942
|
+
url,
|
|
943
|
+
headers: {
|
|
944
|
+
Authorization: `Bearer ${token}`,
|
|
945
|
+
},
|
|
946
|
+
json: true,
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
async getToken(credentials) {
|
|
951
|
+
if (credentials.accessToken) {
|
|
952
|
+
return credentials.accessToken;
|
|
953
|
+
}
|
|
954
|
+
const response = await this.helpers.request({
|
|
955
|
+
method: 'POST',
|
|
956
|
+
url: `${credentials.apiUrl}/tokens`,
|
|
957
|
+
body: {
|
|
958
|
+
identity: credentials.email,
|
|
959
|
+
secret: credentials.password,
|
|
960
|
+
scope: 'user',
|
|
961
|
+
},
|
|
962
|
+
json: true,
|
|
963
|
+
});
|
|
964
|
+
return response.result?.token || response.token;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
exports.NginxProxyManager = NginxProxyManager;
|
|
968
|
+
//# sourceMappingURL=nginxProxyManager.js.map
|