mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-21 01:15:42 +02:00
mod/notification-ntfy: :do ... on-error=... -> :onerror ... do=...
This commit is contained in:
parent
5badafe109
commit
2a7fd7ea53
1 changed files with 6 additions and 6 deletions
|
@ -36,13 +36,13 @@
|
||||||
|
|
||||||
:foreach Id,Message in=$NtfyQueue do={
|
:foreach Id,Message in=$NtfyQueue do={
|
||||||
:if ([ :typeof $Message ] = "array" ) do={
|
:if ([ :typeof $Message ] = "array" ) do={
|
||||||
:do {
|
:onerror Err {
|
||||||
/tool/fetch check-certificate=yes-without-crl output=none http-method=post \
|
/tool/fetch check-certificate=yes-without-crl output=none http-method=post \
|
||||||
http-header-field=($Message->"headers") http-data=($Message->"text") \
|
http-header-field=($Message->"headers") http-data=($Message->"text") \
|
||||||
($Message->"url") as-value;
|
($Message->"url") as-value;
|
||||||
:set ($NtfyQueue->$Id);
|
:set ($NtfyQueue->$Id);
|
||||||
} on-error={
|
} do={
|
||||||
$LogPrint debug $0 ("Sending queued Ntfy message failed.");
|
$LogPrint debug $0 ("Sending queued Ntfy message failed: " . $Err);
|
||||||
:set AllDone false;
|
:set AllDone false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
:set Text ($Text . "\n" . [ $SymbolForNotification "link" ] . ($Notification->"link"));
|
:set Text ($Text . "\n" . [ $SymbolForNotification "link" ] . ($Notification->"link"));
|
||||||
}
|
}
|
||||||
|
|
||||||
:do {
|
:onerror Err {
|
||||||
:if ($Server = "ntfy.sh") do={
|
:if ($Server = "ntfy.sh") do={
|
||||||
:if ([ $CertificateAvailable "ISRG Root X1" ] = false) do={
|
:if ([ $CertificateAvailable "ISRG Root X1" ] = false) do={
|
||||||
$LogPrint warning $0 ("Downloading required certificate failed.");
|
$LogPrint warning $0 ("Downloading required certificate failed.");
|
||||||
|
@ -116,8 +116,8 @@
|
||||||
}
|
}
|
||||||
/tool/fetch check-certificate=yes-without-crl output=none http-method=post \
|
/tool/fetch check-certificate=yes-without-crl output=none http-method=post \
|
||||||
http-header-field=$Headers http-data=$Text $Url as-value;
|
http-header-field=$Headers http-data=$Text $Url as-value;
|
||||||
} on-error={
|
} do={
|
||||||
$LogPrint info $0 ("Failed sending ntfy notification! Queuing...");
|
$LogPrint info $0 ("Failed sending ntfy notification: " . $Err . " - Queuing...");
|
||||||
|
|
||||||
:if ([ :typeof $NtfyQueue ] = "nothing") do={
|
:if ([ :typeof $NtfyQueue ] = "nothing") do={
|
||||||
:set NtfyQueue ({});
|
:set NtfyQueue ({});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue