mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Fixed LABEL_PRINTER_HOOK_JSON check was missing when running label printer WebHooks client side (fixes #1978)
This commit is contained in:
parent
c396c2a84c
commit
d883474f03
@ -57,6 +57,7 @@
|
|||||||
|
|
||||||
### General
|
### General
|
||||||
|
|
||||||
|
- Fixed that when running label printer WebHooks client side (so when `LABEL_PRINTER_RUN_SERVER` = `false`), the setting `LABEL_PRINTER_HOOK_JSON` was ignored (the WebHook data was always sent as form data)
|
||||||
- New translations: (thanks all the translators)
|
- New translations: (thanks all the translators)
|
||||||
- Lithuanian (demo available at <https://lt.demo.grocy.info>)
|
- Lithuanian (demo available at <https://lt.demo.grocy.info>)
|
||||||
|
|
||||||
|
@ -504,6 +504,19 @@ Grocy.FrontendHelpers.RunWebhook = function(webhook, data, repetitions = 1)
|
|||||||
var hasAlreadyFailed = false;
|
var hasAlreadyFailed = false;
|
||||||
|
|
||||||
for (i = 0; i < repetitions; i++)
|
for (i = 0; i < repetitions; i++)
|
||||||
|
{
|
||||||
|
if (webhook.json)
|
||||||
|
{
|
||||||
|
$.ajax(webhook.hook, { "data": JSON.stringify(data), "contentType": "application/json", "type": "POST" }).fail(function(req, status, errorThrown)
|
||||||
|
{
|
||||||
|
if (!hasAlreadyFailed)
|
||||||
|
{
|
||||||
|
hasAlreadyFailed = true;
|
||||||
|
Grocy.FrontendHelpers.ShowGenericError(__t("Error while executing WebHook", { "status": status, "errorThrown": errorThrown }));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$.post(webhook.hook, data).fail(function(req, status, errorThrown)
|
$.post(webhook.hook, data).fail(function(req, status, errorThrown)
|
||||||
{
|
{
|
||||||
@ -515,6 +528,7 @@ Grocy.FrontendHelpers.RunWebhook = function(webhook, data, repetitions = 1)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(document).on("keyup paste change", "input, textarea", function()
|
$(document).on("keyup paste change", "input, textarea", function()
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,8 @@
|
|||||||
@if(GROCY_FEATURE_FLAG_LABEL_PRINTER && !GROCY_LABEL_PRINTER_RUN_SERVER)
|
@if(GROCY_FEATURE_FLAG_LABEL_PRINTER && !GROCY_LABEL_PRINTER_RUN_SERVER)
|
||||||
"labelprinter" : {
|
"labelprinter" : {
|
||||||
"hook": "{{ GROCY_LABEL_PRINTER_WEBHOOK }}",
|
"hook": "{{ GROCY_LABEL_PRINTER_WEBHOOK }}",
|
||||||
"extra_data" : {!! json_encode(GROCY_LABEL_PRINTER_PARAMS) !!}
|
"extra_data": {!! json_encode(GROCY_LABEL_PRINTER_PARAMS) !!},
|
||||||
|
"json": {{ BoolToString(GROCY_LABEL_PRINTER_HOOK_JSON) }}
|
||||||
}
|
}
|
||||||
@endif
|
@endif
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user