@theotherwillembotha/node-red-plugincore 0.0.54 → 0.1.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 +9 -9
- package/build/GenerateNodes.js +0 -1
- package/build/Nodes.html +23 -162
- package/build/Nodes.js +0 -2
- package/build/Plugins.js +2 -3
- package/build/core/NodeConstructor.d.ts +1 -0
- package/build/core/NodeConstructor.d.ts.map +1 -1
- package/build/core/NodeConstructor.js +20 -62
- package/build/core/NodeGenerator.d.ts.map +1 -1
- package/build/core/NodeGenerator.js +8 -11
- package/build/core/logger/LoggerDecorator.d.ts.map +1 -1
- package/build/core/logger/LoggerDecorator.js +34 -38
- package/build/core/logger/node/ConsoleLoggerConfigNode.d.ts +11 -7
- package/build/core/logger/node/ConsoleLoggerConfigNode.d.ts.map +1 -1
- package/build/core/logger/node/ConsoleLoggerConfigNode.js +24 -10
- package/build/core/logger/node/RestLoggerConfigNode.d.ts +22 -6
- package/build/core/logger/node/RestLoggerConfigNode.d.ts.map +1 -1
- package/build/core/logger/node/RestLoggerConfigNode.js +93 -23
- package/build/core/logger/service/LoggerService.d.ts +59 -68
- package/build/core/logger/service/LoggerService.d.ts.map +1 -1
- package/build/core/logger/service/LoggerService.js +76 -165
- package/build/core/logger/template/LoggerTemplate.d.ts +9 -1
- package/build/core/logger/template/LoggerTemplate.d.ts.map +1 -1
- package/build/core/metrics/node/CounterMetricConfigNode.js +0 -2
- package/build/core/metrics/node/GaugeMetricConfigNode.js +0 -2
- package/build/core/metrics/node/MetricsConfigNode.js +0 -1
- package/build/core/metrics/node/TimerMetricConfigNode.js +0 -2
- package/build/core/metrics/service/MetricsService.js +10 -24
- package/build/core/other/service/SettingsService.js +0 -2
- package/build/core/tagging/service/NodeTypeService.js +1 -2
- package/build/core/webhook/WebhookDecorator.d.ts.map +1 -1
- package/build/core/webhook/WebhookDecorator.js +47 -10
- package/build/core/webhook/node/WebhookServerConfigNode.js +0 -1
- package/build/core/webhook/service/ReverseProxyTypeService.d.ts +1 -2
- package/build/core/webhook/service/ReverseProxyTypeService.d.ts.map +1 -1
- package/build/core/webhook/service/ReverseProxyTypeService.js +1 -6
- package/build/core/webhook/service/WebhookServerService.d.ts +1 -1
- package/build/core/webhook/service/WebhookServerService.d.ts.map +1 -1
- package/build/core/webhook/service/WebhookServerService.js +6 -14
- package/build/core/webhook/template/WebhookTemplate.d.ts +1 -1
- package/build/core/webhook/template/WebhookTemplate.d.ts.map +1 -1
- package/build/index.d.ts +1 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -2
- package/build/resources/editorLanguageExtension.js +1 -2
- package/package.json +6 -5
- package/resources/editorLanguageExtension.js +1 -2
- package/src/GenerateNodes.ts +2 -2
- package/src/core/NodeConstructor.ts +7 -14
- package/src/core/NodeGenerator.ts +2 -3
- package/src/core/logger/LoggerDecorator.ts +56 -53
- package/src/core/logger/node/ConsoleLoggerConfigNode.ts +39 -14
- package/src/core/logger/node/RestLoggerConfigNode.ts +128 -25
- package/src/core/logger/service/LoggerService.ts +103 -239
- package/src/core/logger/template/LoggerTemplate.html +2 -2
- package/src/core/logger/template/LoggerTemplate.ts +11 -1
- package/src/core/metrics/node/TimerMetricConfigNode.html +2 -2
- package/src/core/other/template/BasicTemplate.html +5 -2
- package/src/core/webhook/WebhookDecorator.ts +54 -13
- package/src/core/webhook/service/ReverseProxyTypeService.ts +1 -4
- package/src/core/webhook/service/WebhookServerService.ts +1 -6
- package/src/core/webhook/template/WebhookTemplate.html +1 -1
- package/src/core/webhook/template/WebhookTemplate.ts +1 -1
- package/src/index.ts +2 -2
- package/build/core/logger/node/ConsoleLoggerConfigNode.html +0 -90
- package/build/core/logger/node/LokiLoggerConfigNode.d.ts +0 -20
- package/build/core/logger/node/LokiLoggerConfigNode.d.ts.map +0 -1
- package/build/core/logger/node/LokiLoggerConfigNode.html +0 -117
- package/build/core/logger/node/LokiLoggerConfigNode.js +0 -53
- package/build/core/logger/node/RestLoggerConfigNode.html +0 -183
- package/build/core/logger/service/LoggerServiceTypes.d.ts +0 -24
- package/build/core/logger/service/LoggerServiceTypes.d.ts.map +0 -1
- package/build/core/logger/service/LoggerServiceTypes.js +0 -30
- package/build/core/logger/template/LoggerTemplate.html +0 -331
- package/build/core/metrics/node/CounterMetricConfigNode.html +0 -48
- package/build/core/metrics/node/GaugeMetricConfigNode.html +0 -48
- package/build/core/metrics/node/MetricsConfigNode.html +0 -21
- package/build/core/metrics/node/TimerMetricConfigNode.html +0 -190
- package/build/core/metrics/template/CounterMetricTemplate.html +0 -40
- package/build/core/metrics/template/GaugeMetricTemplate.html +0 -39
- package/build/core/metrics/template/MetricsTemplate.html +0 -54
- package/build/core/metrics/template/TimerMetricTemplate.html +0 -39
- package/build/core/other/node/DelegatedConfigReferenceNode.html +0 -1
- package/build/core/other/template/BasicTemplate.html +0 -76
- package/build/core/other/template/SettingsTemplate.html +0 -128
- package/build/core/ui/template/ScriptEditorTemplate.html +0 -50
- package/build/core/ui/template/UIHelperTemplate.html +0 -229
- package/build/core/webhook/node/WebhookServerConfigNode.html +0 -61
- package/build/core/webhook/template/WebhookTemplate.html +0 -442
- package/documentation/LokiLoggerConfigNode.png +0 -0
- package/src/core/logger/node/LokiLoggerConfigNode.html +0 -117
- package/src/core/logger/node/LokiLoggerConfigNode.ts +0 -58
- package/src/core/logger/service/LoggerServiceTypes.ts +0 -26
|
@@ -1,442 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<script type="text/javascript" template-section="onCompose">
|
|
4
|
-
node
|
|
5
|
-
.addDefault('webhook', {type:"WebhookServerConfigNode", required:true})
|
|
6
|
-
.addDefault('webhookPath', {value:"/example", required:true})
|
|
7
|
-
.addDefault('webhookAuth', { value:"none", required:true})
|
|
8
|
-
.addDefault('webhookAuth_basic_username', {value:"user", required:false})
|
|
9
|
-
.addDefault('webhookAuth_basic_password', {value:"pass", required:false})
|
|
10
|
-
.addDefault('webhookAuth_apikey_mechanism', {value:"header", required:false})
|
|
11
|
-
.addDefault('webhookAuth_apikey_key', {value:"x-api-key", required:false})
|
|
12
|
-
.addDefault('webhookAuth_apikey_value', {value:"testkey", required:false})
|
|
13
|
-
.addDefault('reverseProxies_enabled', {required:false})
|
|
14
|
-
.addDefault('reverseProxies_connections', { type:"ReverseProxyType[]", maxInstances:10})
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<div template-section="onIncludeOnce">
|
|
18
|
-
<script type="text/javascript">
|
|
19
|
-
|
|
20
|
-
// CSS
|
|
21
|
-
dropdownStyles = `
|
|
22
|
-
.proxy-dropdown {
|
|
23
|
-
position: absolute;
|
|
24
|
-
background: white;
|
|
25
|
-
border: 1px solid #ccc;
|
|
26
|
-
border-radius: 4px;
|
|
27
|
-
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
|
28
|
-
max-height: 150px;
|
|
29
|
-
overflow-y: auto;
|
|
30
|
-
z-index: 1000;
|
|
31
|
-
min-width: 150px;
|
|
32
|
-
}
|
|
33
|
-
.proxy-dropdown .dropdown-item {
|
|
34
|
-
padding: 6px 12px;
|
|
35
|
-
cursor: pointer;
|
|
36
|
-
}
|
|
37
|
-
.proxy-dropdown .dropdown-item:hover {
|
|
38
|
-
background: #f0f0f0;
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
$('<style>').text(dropdownStyles).appendTo('head');
|
|
42
|
-
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<script type="text/javascript" template-section="onIncludeEditPrepare">
|
|
48
|
-
{
|
|
49
|
-
let node = this;
|
|
50
|
-
|
|
51
|
-
let showSelectedAutnetication = function(value){
|
|
52
|
-
let webhookConfig = $("#section_webhookconfig");
|
|
53
|
-
webhookConfig.find(".webhookauth").each((i, t) => {
|
|
54
|
-
t = $(t);
|
|
55
|
-
if(t.hasClass(`webhookauth-${value}`)){ t.show(); }
|
|
56
|
-
else { t.hide(); }
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
webhookConfig.find(`.webhookauth-${value}`).find(`.webhookauth-${value}-input.required`).each((i, entry) => {
|
|
60
|
-
let id = entry.id.replace("node-{{#if config.isConfigNode}}config-{{/if}}input-", "");
|
|
61
|
-
if(node._def.defaults[id]){
|
|
62
|
-
node._def.defaults[id].required = true;
|
|
63
|
-
}
|
|
64
|
-
else{
|
|
65
|
-
console.log(`you forgot to define ${id} in the defaults for WebhookTemplate`);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
Object.entries(node._def.defaults)
|
|
70
|
-
.filter(([k, v]) => k.startsWith(`webhookAuth_`))
|
|
71
|
-
.filter(([k, v]) => !k.startsWith(`webhookAuth_${value}_`))
|
|
72
|
-
.forEach(([k, v]) => v.required = false );
|
|
73
|
-
|
|
74
|
-
node.webhookAuth = value;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let webhookAuthSelection = $("#{{defaults.webhookAuth}}");
|
|
78
|
-
webhookAuthSelection.typedInput({type:"authentication", types:[{
|
|
79
|
-
value: "authentication",
|
|
80
|
-
options: [
|
|
81
|
-
{ value: "none", label: "None"},
|
|
82
|
-
{ value: "basic", label: "BasicAuth"},
|
|
83
|
-
{ value: "apikey", label: "APIKey"}
|
|
84
|
-
]
|
|
85
|
-
}]});
|
|
86
|
-
webhookAuthSelection.on("change", () => showSelectedAutnetication(webhookAuthSelection.val()));
|
|
87
|
-
showSelectedAutnetication(webhookAuthSelection.val());
|
|
88
|
-
|
|
89
|
-
let webhookAPIKeyMechanism = $("#{{defaults.webhookAuth_apikey_mechanism}}");
|
|
90
|
-
webhookAPIKeyMechanism.typedInput({type:"apikeymechanism", types:[{
|
|
91
|
-
value: "apikeymechansim",
|
|
92
|
-
options: [
|
|
93
|
-
{ value: "header", label: "Header"},
|
|
94
|
-
{ value: "queryparam", label: "Query Param"},
|
|
95
|
-
{ value: "matrixparam", label: "Matrix Param"}
|
|
96
|
-
]
|
|
97
|
-
}]});
|
|
98
|
-
webhookAuthSelection.on("change", () => showSelectedAutnetication(webhookAuthSelection.val()));
|
|
99
|
-
showSelectedAutnetication(webhookAuthSelection.val());
|
|
100
|
-
|
|
101
|
-
let enableReverseProxy = $("#{{defaults.reverseProxies_enabled}}");
|
|
102
|
-
let reverseProxySection = $("#section_webhookconfig_reverseproxy");
|
|
103
|
-
enableReverseProxy.on("change", () => {
|
|
104
|
-
console.log("show / hide reverse proxy table");
|
|
105
|
-
if(enableReverseProxy.prop("checked")){
|
|
106
|
-
reverseProxySection.show();
|
|
107
|
-
}
|
|
108
|
-
else{
|
|
109
|
-
reverseProxySection.hide();
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
if(this.reverseProxies_enabled){
|
|
113
|
-
reverseProxySection.show();
|
|
114
|
-
}
|
|
115
|
-
else{
|
|
116
|
-
reverseProxySection.hide();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
let getProxyTypes = async () => {
|
|
120
|
-
let types = [];
|
|
121
|
-
await $.ajax({
|
|
122
|
-
url: "nodetypeservice/find?tag=ReverseProxyType",
|
|
123
|
-
type: "GET",
|
|
124
|
-
contentType: "application/json; charset=utf-8",
|
|
125
|
-
data:JSON.stringify({id:node.id}),
|
|
126
|
-
success: (response) => {
|
|
127
|
-
types = response;
|
|
128
|
-
},
|
|
129
|
-
error: (jqXHR, textStatus, errorThrown) => {
|
|
130
|
-
console.log(jqXHR, textStatus, errorThrown);
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
return types;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
getProxyTypes().then(types => {
|
|
137
|
-
if(types.length === 0){
|
|
138
|
-
$("#section_reverseproxy_feature").hide();
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
let getProxies = async () => {
|
|
143
|
-
let proxies = [];
|
|
144
|
-
|
|
145
|
-
// get the list of types again.
|
|
146
|
-
let proxyTypes = (await getProxyTypes()).map(type => type.id);
|
|
147
|
-
|
|
148
|
-
// add all of the known proxies.
|
|
149
|
-
RED.nodes.eachConfig(cfg => {
|
|
150
|
-
if(proxyTypes.includes(cfg.type)){
|
|
151
|
-
proxies.push({id:cfg.id, name:cfg.label(), type:cfg.type});
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
return proxies;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
let reverseProxyList = $("#reverseproxylist_table");
|
|
159
|
-
reverseProxyList.editableList({
|
|
160
|
-
sortable: true,
|
|
161
|
-
removable: true,
|
|
162
|
-
height: 'auto',
|
|
163
|
-
scrollOnAdd: true,
|
|
164
|
-
addButton: 'Add ProxyHost',
|
|
165
|
-
header: $('<div>').append($.parseHTML(`
|
|
166
|
-
<div style='width:30%; margin-left:5%; display:inline-grid;'>Proxy</div>
|
|
167
|
-
<div style='width:auto; margin-right:5%; display:inline-grid;'>Domain Name</div>
|
|
168
|
-
`)
|
|
169
|
-
),
|
|
170
|
-
buttons: [
|
|
171
|
-
{
|
|
172
|
-
label: "Add Reverse Proxy",
|
|
173
|
-
icon: "fa fa-star",
|
|
174
|
-
title: "Add a reverse proxy configuration",
|
|
175
|
-
click: () => {
|
|
176
|
-
event.stopPropagation();
|
|
177
|
-
let $btn = $(event.target);
|
|
178
|
-
|
|
179
|
-
// Remove any existing dropdown
|
|
180
|
-
$('.proxy-dropdown').remove();
|
|
181
|
-
|
|
182
|
-
// Fetch the list of reverseproxy types.
|
|
183
|
-
getProxyTypes().then(proxyTypes => {
|
|
184
|
-
let $dropdown = $('<div class="proxy-dropdown red-ui-editor"></div>');
|
|
185
|
-
|
|
186
|
-
proxyTypes.forEach(proxyType => {
|
|
187
|
-
$('<div class="dropdown-item"></div>')
|
|
188
|
-
.text(proxyType.name)
|
|
189
|
-
.data('value', proxyType.id)
|
|
190
|
-
.css({
|
|
191
|
-
padding: '4px 8px',
|
|
192
|
-
cursor: 'pointer'
|
|
193
|
-
})
|
|
194
|
-
.appendTo($dropdown);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
// Position it near the button
|
|
198
|
-
$dropdown.css({
|
|
199
|
-
top: $btn.offset().top + $btn.height(),
|
|
200
|
-
left: $btn.offset().left
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
$('body').append($dropdown);
|
|
204
|
-
|
|
205
|
-
// Handle item selection
|
|
206
|
-
$dropdown.on('click', '.dropdown-item', function(e) {
|
|
207
|
-
e.stopPropagation();
|
|
208
|
-
const selectedValue = $(this).data('value');
|
|
209
|
-
const selectedText = $(this).text();
|
|
210
|
-
|
|
211
|
-
// Do whatever you need with the selection
|
|
212
|
-
$dropdown.remove();
|
|
213
|
-
RED.editor.editConfig("reverseproxy", selectedValue, "_ADD_");
|
|
214
|
-
});
|
|
215
|
-
})
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
label: "Edit Reverse Proxy",
|
|
220
|
-
icon: "fa fa-edit",
|
|
221
|
-
title: "Edit a reverse proxy configuration",
|
|
222
|
-
click: async (event) => {
|
|
223
|
-
event.stopPropagation();
|
|
224
|
-
|
|
225
|
-
// Remove any existing dropdown
|
|
226
|
-
$('.proxy-dropdown').remove();
|
|
227
|
-
|
|
228
|
-
// Build the dropdown from the select's options
|
|
229
|
-
const $dropdown = $('<div class="proxy-dropdown red-ui-editor"></div>');
|
|
230
|
-
|
|
231
|
-
(await getProxies()).forEach(proxy => {
|
|
232
|
-
$('<div class="dropdown-item"></div>')
|
|
233
|
-
.text(proxy.name)
|
|
234
|
-
.data('value', proxy.id)
|
|
235
|
-
.data('type', proxy.type)
|
|
236
|
-
.css({
|
|
237
|
-
padding: '4px 8px',
|
|
238
|
-
cursor: 'pointer'
|
|
239
|
-
})
|
|
240
|
-
.appendTo($dropdown);
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
// Position it near the button
|
|
244
|
-
let $btn = $(event.target);
|
|
245
|
-
$dropdown.css({
|
|
246
|
-
top: $btn.offset().top + $btn.height(),
|
|
247
|
-
left: $btn.offset().left
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
$('body').append($dropdown);
|
|
251
|
-
|
|
252
|
-
// Handle item selection
|
|
253
|
-
$dropdown.on('click', '.dropdown-item', function(e) {
|
|
254
|
-
e.stopPropagation();
|
|
255
|
-
const selectedType = $(this).data('type');
|
|
256
|
-
const selectedValue = $(this).data('value');
|
|
257
|
-
const selectedText = $(this).text();
|
|
258
|
-
|
|
259
|
-
// Do whatever you need with the selection
|
|
260
|
-
$dropdown.remove();
|
|
261
|
-
RED.editor.editConfig("reverseproxy", selectedType, selectedValue);
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
}],
|
|
265
|
-
|
|
266
|
-
addItem: async function(container, i, proxy){
|
|
267
|
-
let row = $('<div/>', {
|
|
268
|
-
class: 'form-row',
|
|
269
|
-
style: 'display: flex; margin-bottom: 0;'
|
|
270
|
-
}).appendTo(container);
|
|
271
|
-
|
|
272
|
-
let proxyColumn = $('<select/>', {
|
|
273
|
-
type: 'text',
|
|
274
|
-
name: i,
|
|
275
|
-
required: true,
|
|
276
|
-
style: 'margin-left: 5px; margin-bottom: 0;',
|
|
277
|
-
class: 'proxy-proxy'
|
|
278
|
-
}).appendTo(row);
|
|
279
|
-
|
|
280
|
-
(await getProxies()).forEach(proxy => {
|
|
281
|
-
$('<option value="' + proxy.id + '">' + proxy.name + '</option>').appendTo(proxyColumn);
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
proxyColumn.on("focus", async () => {
|
|
285
|
-
proxyColumn.empty();
|
|
286
|
-
(await getProxies()).forEach(proxy => {
|
|
287
|
-
$('<option value="' + proxy.id + '">' + proxy.name + '</option>').appendTo(proxyColumn);
|
|
288
|
-
})
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
proxyColumn.val(proxy.proxy);
|
|
292
|
-
|
|
293
|
-
// Add the Domain Name column
|
|
294
|
-
let domainnameColumn = $('<input/>', {
|
|
295
|
-
type: 'text',
|
|
296
|
-
name: i,
|
|
297
|
-
required: true,
|
|
298
|
-
style: 'margin-left: 5px; margin-bottom: 0;',
|
|
299
|
-
class: 'proxy-domainname'
|
|
300
|
-
}).appendTo(row)
|
|
301
|
-
domainnameColumn.val(proxy.domainname);
|
|
302
|
-
},
|
|
303
|
-
removeItem :function(data){
|
|
304
|
-
// nothing to do here.
|
|
305
|
-
},
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
// Close dropdown when clicking anywhere else
|
|
309
|
-
$(document).on('click', function() {
|
|
310
|
-
$('.proxy-dropdown').remove();
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
this.reverseProxies_connections = (this.reverseProxies_connections) ? this.reverseProxies_connections : [];
|
|
314
|
-
reverseProxyList.editableList('addItems', this.reverseProxies_connections);
|
|
315
|
-
}
|
|
316
|
-
</script>
|
|
317
|
-
|
|
318
|
-
<script type="text/javascript" template-section="onIncludeEditSave">
|
|
319
|
-
{
|
|
320
|
-
let node = this;
|
|
321
|
-
|
|
322
|
-
// pulling the values from the reverseproxy table.
|
|
323
|
-
let connectionList = $("#reverseproxylist_table").editableList('items');
|
|
324
|
-
node.reverseProxies_connections = [];
|
|
325
|
-
connectionList.each(function(i) {
|
|
326
|
-
node.reverseProxies_connections.push({
|
|
327
|
-
proxy: $(this).find('.proxy-proxy').val(),
|
|
328
|
-
domainname: $(this).find('.proxy-domainname').val(),
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
console.log(node.reverseProxies_connections);
|
|
333
|
-
}
|
|
334
|
-
</script>
|
|
335
|
-
|
|
336
|
-
<script type="text/html" template-section="onIncludeEditForm">
|
|
337
|
-
<div id="section_webhookconfig">
|
|
338
|
-
<div class="form-row editorsectionheading">
|
|
339
|
-
<i class="w-16 fa fa-eye"></i> <span>Webhook</span>
|
|
340
|
-
</div>
|
|
341
|
-
|
|
342
|
-
<div class="editorgroupborder">
|
|
343
|
-
<div class="form-row nomargin">
|
|
344
|
-
<label class="towb_editorlabel" for="{{defaults.webhook}}"><i class="fa fa-server"></i> Server</label>
|
|
345
|
-
<input id="{{defaults.webhook}}" placeholder="webhook" />
|
|
346
|
-
</div>
|
|
347
|
-
|
|
348
|
-
<div class="form-row">
|
|
349
|
-
<label class="towb_editorlabel" for="{{defaults.webhookPath}}"><i class="fa fa-link"></i> Path</label>
|
|
350
|
-
<input type="text" id="{{defaults.webhookPath}}" placeholder="/example" />
|
|
351
|
-
</div>
|
|
352
|
-
|
|
353
|
-
<div class="form-row">
|
|
354
|
-
<label class="towb_editorlabel" for="{{defaults.webhookAuth}}"><i class="fa fa-lock"></i> Authentication</label>
|
|
355
|
-
<input type="text" id="{{defaults.webhookAuth}}" placeholder="none" />
|
|
356
|
-
</div>
|
|
357
|
-
|
|
358
|
-
<div class="webhookauth webhookauth-none">
|
|
359
|
-
</div>
|
|
360
|
-
|
|
361
|
-
<div class="webhookauth webhookauth-basic">
|
|
362
|
-
<div class="form-row">
|
|
363
|
-
<label class="towb_editorlabel" for="{{defaults.webhookAuth_basic_username}}"><i class="fa fa-user"></i> Username</label>
|
|
364
|
-
<input type="text" id="{{defaults.webhookAuth_basic_username}}" placeholder="testUser" />
|
|
365
|
-
</div>
|
|
366
|
-
|
|
367
|
-
<div class="form-row">
|
|
368
|
-
<label class="towb_editorlabel" for="{{defaults.webhookAuth_basic_password}}"><i class="fa fa-key"></i> Password</label>
|
|
369
|
-
<input type="password" id="{{defaults.webhookAuth_basic_password}}" placeholder="password" />
|
|
370
|
-
</div>
|
|
371
|
-
</div>
|
|
372
|
-
|
|
373
|
-
<div class="webhookauth webhookauth-apikey">
|
|
374
|
-
<div class="form-row">
|
|
375
|
-
<label class="towb_editorlabel" for="{{defaults.webhookAuth_apikey_mechanism}}"><i class="fa fa-exchange"></i> Mechanism</label>
|
|
376
|
-
<input type="text" id="{{defaults.webhookAuth_apikey_mechanism}}"/>
|
|
377
|
-
</div>
|
|
378
|
-
|
|
379
|
-
<div class="form-row">
|
|
380
|
-
<label class="towb_editorlabel" for="{{defaults.webhookAuth_apikey_key}}"><i class="fa fa-id-badge"></i> APIKey name</label>
|
|
381
|
-
<input type="text" id="{{defaults.webhookAuth_apikey_key}}" placeholder="x-api-key" />
|
|
382
|
-
</div>
|
|
383
|
-
|
|
384
|
-
<div class="form-row">
|
|
385
|
-
<label class="towb_editorlabel" for="{{defaults.webhookAuth_apikey_value}}"><i class="fa fa-lock"></i> APIKey value</label>
|
|
386
|
-
<input type="text" id="{{defaults.webhookAuth_apikey_value}}" placeholder="testvalue" />
|
|
387
|
-
</div>
|
|
388
|
-
</div>
|
|
389
|
-
|
|
390
|
-
<div id="section_reverseproxy_feature">
|
|
391
|
-
<div class="form-row">
|
|
392
|
-
<label>Reverse Proxy</label>
|
|
393
|
-
<input type="checkbox" id="{{defaults.reverseProxies_enabled}}" style="width:20px; margin-right:5px;" />
|
|
394
|
-
<label style="width:auto" for="{{defaults.reverseProxies_enabled}}"><span>Enable Reverse Proxy</span></label>
|
|
395
|
-
</div>
|
|
396
|
-
<div id="section_webhookconfig_reverseproxy" style="display:none">
|
|
397
|
-
<div class="form-row">
|
|
398
|
-
<label></label>
|
|
399
|
-
<ol id="reverseproxylist_table" class="theotherwillembotha-compact-table"></ol>
|
|
400
|
-
</div>
|
|
401
|
-
</div>
|
|
402
|
-
</div>
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
</div>
|
|
406
|
-
</div>
|
|
407
|
-
</script>
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
<script type="text/markdown" template-section="onIncludeDocumentation">
|
|
411
|
-
### Webhook
|
|
412
|
-
: *server* (webhookserverconfig) : the web server that this webhook will be bound to.
|
|
413
|
-
: *path* (string) : the url path eg '/service' that should be regeistered on the webserver for this webhook callback
|
|
414
|
-
: *authentication* (auth) : the authentication mechanism that should be used on this endpoint
|
|
415
|
-
: *enable reverse proxy* (boolean) : whether this webhook will be exposed using a reverse proxy or not.
|
|
416
|
-
: *reverse proxies* (reverse proxies) : the list of reverse proxies thie endpoint will be exposed on.
|
|
417
|
-
|
|
418
|
-
### Webhook Authentication
|
|
419
|
-
Three strategies are available for securing the webhook endpoint.
|
|
420
|
-
|
|
421
|
-
- None:
|
|
422
|
-
The endpoint accepts all incoming requests without any credential check.
|
|
423
|
-
|
|
424
|
-
- Basic Auth:
|
|
425
|
-
Validates the `Authorization` header on each incoming request against a username and password pair using HTTP Basic Authentication (RFC 7617).
|
|
426
|
-
: *username* (string) : the username expected in the `Authorization` header
|
|
427
|
-
: *password* (string) : the password expected in the `Authorization` header
|
|
428
|
-
|
|
429
|
-
- API Key:
|
|
430
|
-
Validates a key/value pair carried in the request. Only the `Header` mechanism is currently supported — the key is read from a named request header and compared against the configured value. Requests that do not supply the correct key receive a `401` response.
|
|
431
|
-
: *mechanism* (mechanism) : the transport mechanism for the key. Currently supported: `Header`
|
|
432
|
-
: *key name* (string) : the name of the request header carrying the key (e.g. `x-api-key`)
|
|
433
|
-
: *key value* (string) : the expected value — requests not matching this value are rejected
|
|
434
|
-
|
|
435
|
-
### Reverse Proxy
|
|
436
|
-
When *enable reverse proxy* is checked, the webhook endpoint is registered with one or more reverse proxy services installed in Node-RED. Reverse proxy types are discovered automatically from any plugin that registers a service tagged `ReverseProxyType` (e.g. an Nginx Proxy Manager integration). Each row in the list maps the internal webhook server to a public-facing domain.
|
|
437
|
-
|
|
438
|
-
: *proxy* (ReverseProxyType) : the reverse proxy service to register the endpoint with
|
|
439
|
-
: *domain name* (string) : the public domain name to expose the endpoint on
|
|
440
|
-
|
|
441
|
-
The *external host* and *external port* fields on the linked **Webhook Server** config node must be set correctly for the proxy registration to resolve to the right internal address.
|
|
442
|
-
</script>
|
|
Binary file
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<script type="text/javascript" template-section="onCompose">
|
|
3
|
-
node
|
|
4
|
-
.addDefault("name", {value:"Logger Example", required:true})
|
|
5
|
-
.addDefault("template", {value:`message:{{msg}}`, required:true})
|
|
6
|
-
.addDefault("level", {value:"info", required:true})
|
|
7
|
-
|
|
8
|
-
.addDefault("loki_host", {})
|
|
9
|
-
.addDefault("loki_tenantid", {})
|
|
10
|
-
.addDefault("loki_userid", {})
|
|
11
|
-
.addDefault("loki_authtoken", {})
|
|
12
|
-
|
|
13
|
-
.setPaletteLabel("Loki Logger Config Node")
|
|
14
|
-
.setLabel(function() {return this.name })
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<script type="text/javascript" template-section="onIncludeEditPrepare">
|
|
18
|
-
{
|
|
19
|
-
let node = this;
|
|
20
|
-
|
|
21
|
-
let levelSelection = $("#node-config-input-level");
|
|
22
|
-
levelSelection.typedInput({type:"level", types:[{
|
|
23
|
-
value: "level",
|
|
24
|
-
options: [
|
|
25
|
-
{ value: "DEBUG", label: "debug"},
|
|
26
|
-
{ value: "INFO", label: "info"},
|
|
27
|
-
{ value: "WARNING", label: "warning"},
|
|
28
|
-
{ value: "ERROR", label: "error"},
|
|
29
|
-
]
|
|
30
|
-
}]});
|
|
31
|
-
|
|
32
|
-
this.editor = RED.editor.createEditor({
|
|
33
|
-
id: 'node-config-input-templateEditor',
|
|
34
|
-
mode: 'ace/mode/handlebars',
|
|
35
|
-
value: this.template
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<script type="text/javascript" template-section="onIncludeEditSave">
|
|
41
|
-
{
|
|
42
|
-
let node = this;
|
|
43
|
-
|
|
44
|
-
this.template = this.editor.getValue();
|
|
45
|
-
this.editor.destroy();
|
|
46
|
-
delete this.editor;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
<script type="text/html" template-section="onIncludeEditForm">
|
|
52
|
-
<div id="LoggerConfig">
|
|
53
|
-
<div class="form-row">
|
|
54
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
55
|
-
<input type="text" id="node-config-input-name" />
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
<div class="form-row">
|
|
59
|
-
<label class="towb_editorlabel" for="node-config-input-level"><i class="fa fa-signal"></i> Level</label>
|
|
60
|
-
<input type="text" id="node-config-input-level" />
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<div class="form-row">
|
|
64
|
-
<label class="towb_editorlabel" for="node-config-input-loki_host"><i class="fa fa-server"></i> Host</label>
|
|
65
|
-
<input class="required" type="text" id="node-config-input-loki_host" />
|
|
66
|
-
</div>
|
|
67
|
-
<div class="form-row">
|
|
68
|
-
<label class="towb_editorlabel" for="node-config-input-loki_tenantid"><i class="fa fa-building-o"></i> Tenant ID</label>
|
|
69
|
-
<input class="" type="text" id="node-config-input-loki_tenantid" />
|
|
70
|
-
</div>
|
|
71
|
-
<div class="form-row">
|
|
72
|
-
<label class="towb_editorlabel" for="node-config-input-loki_userid"><i class="fa fa-user"></i> Username</label>
|
|
73
|
-
<input class="" type="text" id="node-config-input-loki_userid" />
|
|
74
|
-
</div>
|
|
75
|
-
<div class="form-row">
|
|
76
|
-
<label class="towb_editorlabel" for="node-config-input-loki_authtoken"><i class="fa fa-key"></i> Auth Token</label>
|
|
77
|
-
<input class="" type="password" id="node-config-input-loki_authtoken" />
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
<div class="form-row">
|
|
81
|
-
<label class="towb_editorlabel" for="node-config-input-templateEditor"><i class="fa fa-code"></i> Template</label>
|
|
82
|
-
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-config-input-templateEditor"></div>
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
</script>
|
|
86
|
-
|
|
87
|
-
<script type="text/markdown" template-section="onIncludeDocumentation">
|
|
88
|
-
Pushes log messages to a Grafana Loki instance using the Loki HTTP API.
|
|
89
|
-
|
|
90
|
-
### Properties
|
|
91
|
-
: *name* (string) : A descriptive name for this logger configuration.
|
|
92
|
-
: *level* (level) : The minimum log level. Messages below this threshold are suppressed. Options: DEBUG, INFO, WARNING, ERROR.
|
|
93
|
-
: *host* (string) : The base URL of the Loki instance, including port (e.g. `http://localhost:3100`).
|
|
94
|
-
: *tenant ID* (string) : The tenant identifier for multi-tenant Loki deployments (`X-Scope-OrgID` header). Leave blank for single-tenant deployments.
|
|
95
|
-
: *username* (string) : Username for Loki authentication.
|
|
96
|
-
: *auth token* (string) : Authentication token or password for Loki.
|
|
97
|
-
: *template* (mustache) : A Mustache/Handlebars template that formats the log message body.
|
|
98
|
-
|
|
99
|
-
### Mustache Templating
|
|
100
|
-
Mustache/Handlebars templates build the message string pushed to Loki.
|
|
101
|
-
|
|
102
|
-
#### Provided Properties
|
|
103
|
-
: *msg* (object) : The Node-RED message object passed through the node.
|
|
104
|
-
: *currentTime* (string) : The current time in ISO 8601 format.
|
|
105
|
-
|
|
106
|
-
#### Helpers
|
|
107
|
-
: *json* (helper) : Serialises an object to a JSON string using `JSON.stringify`.
|
|
108
|
-
|
|
109
|
-
#### Examples
|
|
110
|
-
- `{{{json msg}}}` — serialises the full message object as JSON.
|
|
111
|
-
|
|
112
|
-
#### References
|
|
113
|
-
- [Grafana Loki — HTTP API](https://grafana.com/docs/loki/latest/reference/loki-http-api/)
|
|
114
|
-
- [Mustache — Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
|
|
115
|
-
- [Mustache — Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
|
|
116
|
-
</script>
|
|
117
|
-
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Node } from "node-red";
|
|
3
|
-
import { ConfigNode, ConfigNodeConfig } from "../../NodeConstructor"
|
|
4
|
-
import { NewLogger, Log, LoggerRegistration, LoggerService } from "../service/LoggerService"
|
|
5
|
-
import { SourceUtility } from "../../NodeGenerator";
|
|
6
|
-
import { Level, PlatformType } from "../service/LoggerServiceTypes";
|
|
7
|
-
import { NodeDescription } from "../../tagging/NodeDescriptionDecorator";
|
|
8
|
-
|
|
9
|
-
interface LokiLoggerConfigNodeConfig extends ConfigNodeConfig {
|
|
10
|
-
|
|
11
|
-
id: string;
|
|
12
|
-
level:Level;
|
|
13
|
-
template:string;
|
|
14
|
-
|
|
15
|
-
loki_host:string,
|
|
16
|
-
loki_userid?:string,
|
|
17
|
-
loki_authtoken?:string,
|
|
18
|
-
loki_tenantid?:string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@NodeDescription({
|
|
22
|
-
id:"LokiLoggerConfigNode",
|
|
23
|
-
name:"Loki Logger",
|
|
24
|
-
group:"config",
|
|
25
|
-
sourceFile:SourceUtility.getSourcePath("/build/", "/src/") + "LokiLoggerConfigNode.html",
|
|
26
|
-
package: "@theotherwillembotha/node-red-plugincore",
|
|
27
|
-
dependencies:[ LoggerService ],
|
|
28
|
-
tags: [ "LoggerType" ]
|
|
29
|
-
})
|
|
30
|
-
export class LokiLoggerConfigNode extends ConfigNode<LokiLoggerConfigNodeConfig> {
|
|
31
|
-
|
|
32
|
-
private _logger!: NewLogger<any>;
|
|
33
|
-
|
|
34
|
-
constructor(node: Node, config: LokiLoggerConfigNodeConfig){
|
|
35
|
-
super(node, config);
|
|
36
|
-
let _this = this;
|
|
37
|
-
|
|
38
|
-
// instantiate the logger.
|
|
39
|
-
let loggerConfig:any;
|
|
40
|
-
|
|
41
|
-
loggerConfig = {
|
|
42
|
-
id:this.id(),
|
|
43
|
-
type:PlatformType.loki,
|
|
44
|
-
template:config.template,
|
|
45
|
-
level:config.level,
|
|
46
|
-
host:config.loki_host,
|
|
47
|
-
userid:config.loki_userid,
|
|
48
|
-
authtoken:config.loki_authtoken,
|
|
49
|
-
tenantID:config.loki_tenantid,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
this._logger = LoggerService.get(loggerConfig);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public registerLogger(registration:LoggerRegistration):Log {
|
|
56
|
-
return this._logger.register(registration)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export enum Level{
|
|
2
|
-
DEBUG = "DEBUG",
|
|
3
|
-
INFO = "INFO",
|
|
4
|
-
WARNING = "WARNING",
|
|
5
|
-
ERROR = "ERROR"
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export enum PlatformType {
|
|
9
|
-
console = 'console',
|
|
10
|
-
rest = 'rest',
|
|
11
|
-
loki = 'loki',
|
|
12
|
-
elasticsearch = 'elasticsearch',
|
|
13
|
-
datadog = 'datadog',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export enum RestAuthType {
|
|
17
|
-
none="none",
|
|
18
|
-
basic="basic",
|
|
19
|
-
apikey="apikey",
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export enum ApiKeyMechanismType {
|
|
23
|
-
header="header",
|
|
24
|
-
queryparam="queryparam",
|
|
25
|
-
matrixparam="matrixparam",
|
|
26
|
-
}
|