mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-07-07 09:51:33 +00:00
Compare commits
104 commits
75b7252c11
...
9d7b4157d6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d7b4157d6 | ||
|
|
0aac905859 | ||
|
|
90b1e03302 | ||
|
|
0d84272ee9 | ||
|
|
5a138ba18f | ||
|
|
09389ee857 | ||
|
|
8dd3a5ab84 | ||
|
|
1d46786a69 | ||
|
|
0360b0484d | ||
|
|
d79da00eca | ||
|
|
a4704e1369 | ||
|
|
b5527ef1a0 | ||
|
|
a15f0d89f6 | ||
|
|
bad16e3625 | ||
|
|
59d195254d | ||
|
|
ac7330ed96 | ||
|
|
c1b29e61e2 | ||
|
|
0c38242f9c | ||
|
|
a30fab1d1d | ||
|
|
36b8be7204 | ||
|
|
70596943e0 | ||
|
|
467c2dba95 | ||
|
|
b5538eba39 | ||
|
|
0c9533c4f4 | ||
|
|
ff6a0a301d | ||
|
|
e68a6e55ed | ||
|
|
4590790aa1 | ||
|
|
8bc9dd1fd6 | ||
|
|
43a09049d7 | ||
|
|
32f8c7f57a | ||
|
|
1eaf866f03 | ||
|
|
aadc06545d | ||
|
|
c0033d6969 | ||
|
|
d1e3bc8cbc | ||
|
|
f64aa260ce | ||
|
|
9911c8a0be | ||
|
|
71c0a8f288 | ||
|
|
93ebc2f6a9 | ||
|
|
d08f01c5d3 | ||
|
|
3e380a0d6a | ||
|
|
9df63ea966 | ||
|
|
9bc9238598 | ||
|
|
f00145405c | ||
|
|
8efef50b29 | ||
|
|
16223b7a03 | ||
|
|
624b91d317 | ||
|
|
024405c43d | ||
|
|
3823a4a444 | ||
|
|
ac28f5661a | ||
|
|
882bbb70f5 | ||
|
|
1c15667b7b | ||
|
|
bf6d987626 | ||
|
|
e1e98bee69 | ||
|
|
e93a9da3bb | ||
|
|
5fe68bc79c | ||
|
|
27c22de25f | ||
|
|
9010282a71 | ||
|
|
0bdf4edf8d | ||
|
|
304c936323 | ||
|
|
bc630d8cb8 | ||
|
|
643389672f | ||
|
|
b82ed851b9 | ||
|
|
f850e71c27 | ||
|
|
f5942a06e2 | ||
|
|
3bd101472d | ||
|
|
440a30c88f | ||
|
|
e002259ecb | ||
|
|
0391a50c85 | ||
|
|
dd39f8022b | ||
|
|
cbe47b6400 | ||
|
|
834f32e70b | ||
|
|
407f792157 | ||
|
|
85c26f26e6 | ||
|
|
f9e2dbc751 | ||
|
|
9dc23f80af | ||
|
|
fd791e9e0a | ||
|
|
0470f51e29 | ||
|
|
5ca09e23c0 | ||
|
|
52a8d19def | ||
|
|
600e94aada | ||
|
|
801f56377d | ||
|
|
cf2997dea3 | ||
|
|
0b860e46a6 | ||
|
|
8cf1bbdfed | ||
|
|
ff3e565991 | ||
|
|
4ae413c993 | ||
|
|
f30b560c1b | ||
|
|
f088493d02 | ||
|
|
88edc82b06 | ||
|
|
09da0debe0 | ||
|
|
b2db005f6f | ||
|
|
c0ba366c9e | ||
|
|
2589115f50 | ||
|
|
87ce3b8e5c | ||
|
|
602b331376 | ||
|
|
04181c8131 | ||
|
|
5d5dc2fc3e | ||
|
|
d0588231f6 | ||
|
|
2c5b708f88 | ||
|
|
3cdcd24428 | ||
|
|
ef3edd3b3d | ||
|
|
7dd3c86fe0 | ||
|
|
f380d0ae66 | ||
|
|
332b91e75d |
11 changed files with 42 additions and 51 deletions
|
|
@ -29,7 +29,6 @@
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
:global SendNotification2;
|
:global SendNotification2;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global UrlEncode;
|
|
||||||
:global WaitFullyConnected;
|
:global WaitFullyConnected;
|
||||||
|
|
||||||
:local CheckCertificatesDownloadImport do={
|
:local CheckCertificatesDownloadImport do={
|
||||||
|
|
@ -45,11 +44,10 @@
|
||||||
:global FetchUserAgentStr;
|
:global FetchUserAgentStr;
|
||||||
:global LogPrint;
|
:global LogPrint;
|
||||||
:global RmFile;
|
:global RmFile;
|
||||||
:global UrlEncode;
|
|
||||||
:global WaitForFile;
|
:global WaitForFile;
|
||||||
|
|
||||||
:foreach Type in={ "p12"; "pem" } do={
|
:foreach Type in={ "p12"; "pem" } do={
|
||||||
:local CertFileName ([ $UrlEncode $FetchName ] . "." . $Type);
|
:local CertFileName ([ :convert to=url $FetchName ] . "." . $Type);
|
||||||
$LogPrint debug $ScriptName ("Trying type '" . $Type . "' for '" . $CertName . \
|
$LogPrint debug $ScriptName ("Trying type '" . $Type . "' for '" . $CertName . \
|
||||||
"' (file '" . $CertFileName . "')...");
|
"' (file '" . $CertFileName . "')...");
|
||||||
|
|
||||||
|
|
@ -200,7 +198,7 @@
|
||||||
} else={
|
} else={
|
||||||
$LogPrint debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced.");
|
$LogPrint debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced.");
|
||||||
|
|
||||||
:local CertNew [ /certificate/find where name~("^" . [ $EscapeForRegEx [ $UrlEncode $FetchName ] ] . "\\.(p12|pem)_[0-9]+\$") \
|
:local CertNew [ /certificate/find where name~("^" . [ $EscapeForRegEx [ :convert to=url $FetchName ] ] . "\\.(p12|pem)_[0-9]+\$") \
|
||||||
(common-name=($CertVal->"common-name") or subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $LastName ] . "(\\W|\$)")) \
|
(common-name=($CertVal->"common-name") or subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $LastName ] . "(\\W|\$)")) \
|
||||||
fingerprint!=[ :tostr ($CertVal->"fingerprint") ] ];
|
fingerprint!=[ :tostr ($CertVal->"fingerprint") ] ];
|
||||||
:local CertNewVal [ /certificate/get $CertNew ];
|
:local CertNewVal [ /certificate/get $CertNew ];
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
:global SendNotification2;
|
:global SendNotification2;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global UrlEncode;
|
|
||||||
:global WaitForFile;
|
:global WaitForFile;
|
||||||
:global WaitFullyConnected;
|
:global WaitFullyConnected;
|
||||||
|
|
||||||
|
|
@ -76,7 +75,7 @@
|
||||||
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
|
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
|
||||||
} else={
|
} else={
|
||||||
:local Link ($DailyPskQrCodeUrl . \
|
:local Link ($DailyPskQrCodeUrl . \
|
||||||
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
|
"?scale=8&level=1&ssid=" . [ :convert to=url $Ssid ] . "&pass=" . [ :convert to=url $NewPsk ]);
|
||||||
$SendNotification2 ({ origin=$ScriptName; \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
|
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
|
||||||
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
|
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
:global SendNotification2;
|
:global SendNotification2;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global UrlEncode;
|
|
||||||
:global WaitForFile;
|
:global WaitForFile;
|
||||||
:global WaitFullyConnected;
|
:global WaitFullyConnected;
|
||||||
|
|
||||||
|
|
@ -75,7 +74,7 @@
|
||||||
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
|
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
|
||||||
} else={
|
} else={
|
||||||
:local Link ($DailyPskQrCodeUrl . \
|
:local Link ($DailyPskQrCodeUrl . \
|
||||||
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
|
"?scale=8&level=1&ssid=" . [ :convert to=url $Ssid ] . "&pass=" . [ :convert to=url $NewPsk ]);
|
||||||
$SendNotification2 ({ origin=$ScriptName; \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
|
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
|
||||||
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
|
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
:global SendNotification2;
|
:global SendNotification2;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global UrlEncode;
|
|
||||||
:global WaitForFile;
|
:global WaitForFile;
|
||||||
:global WaitFullyConnected;
|
:global WaitFullyConnected;
|
||||||
|
|
||||||
|
|
@ -91,7 +90,7 @@
|
||||||
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
|
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
|
||||||
} else={
|
} else={
|
||||||
:local Link ($DailyPskQrCodeUrl . \
|
:local Link ($DailyPskQrCodeUrl . \
|
||||||
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
|
"?scale=8&level=1&ssid=" . [ :convert to=url $Ssid ] . "&pass=" . [ :convert to=url $NewPsk ]);
|
||||||
$SendNotification2 ({ origin=$ScriptName; \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
|
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
|
||||||
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
|
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
:global SendNotification2;
|
:global SendNotification2;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global UrlEncode;
|
|
||||||
:global WaitForFile;
|
:global WaitForFile;
|
||||||
:global WaitFullyConnected;
|
:global WaitFullyConnected;
|
||||||
|
|
||||||
|
|
@ -76,7 +75,7 @@
|
||||||
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
|
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
|
||||||
} else={
|
} else={
|
||||||
:local Link ($DailyPskQrCodeUrl . \
|
:local Link ($DailyPskQrCodeUrl . \
|
||||||
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
|
"?scale=8&level=1&ssid=" . [ :convert to=url $Ssid ] . "&pass=" . [ :convert to=url $NewPsk ]);
|
||||||
$SendNotification2 ({ origin=$ScriptName; \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
|
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
|
||||||
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
|
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,10 @@ hr {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
img.notification {
|
img.notification {
|
||||||
box-shadow: 5px 5px 7px gray;
|
box-shadow: 3px 3px 7px rgba(100,100,100,0.7);
|
||||||
}
|
}
|
||||||
img.screenshot {
|
img.screenshot {
|
||||||
box-shadow: 5px 5px 7px gray;
|
box-shadow: 3px 3px 7px rgba(100,100,100,0.7);
|
||||||
}
|
}
|
||||||
img.logo {
|
img.logo {
|
||||||
float: left;
|
float: left;
|
||||||
|
|
@ -72,7 +72,7 @@ pre {
|
||||||
pre.code {
|
pre.code {
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
box-shadow: 5px 5px 7px gray;
|
box-shadow: 3px 3px 7px rgba(100,100,100,0.7);
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: 6px 10px;
|
padding: 6px 10px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
:global ExitError;
|
:global ExitError;
|
||||||
:global HexToNum;
|
:global HexToNum;
|
||||||
|
:global UrlEncode;
|
||||||
|
|
||||||
# wrapper for $ExitOnError with additional parameter
|
# wrapper for $ExitOnError with additional parameter
|
||||||
:set ExitError do={
|
:set ExitError do={
|
||||||
|
|
@ -36,3 +37,30 @@
|
||||||
|
|
||||||
:return [ :tonum ("0x" . $Input) ];
|
:return [ :tonum ("0x" . $Input) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# url encoding
|
||||||
|
:set UrlEncode do={
|
||||||
|
:local Input [ :tostr $1 ];
|
||||||
|
|
||||||
|
:if ([ :len $Input ] = 0) do={
|
||||||
|
:return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
:local Return "";
|
||||||
|
:local Chars ("\n\r !\"#\$%&'()*+,:;<=>?@[\\]^`{|}~");
|
||||||
|
:local Subs { "%0A"; "%0D"; "%20"; "%21"; "%22"; "%23"; "%24"; "%25"; "%26"; "%27";
|
||||||
|
"%28"; "%29"; "%2A"; "%2B"; "%2C"; "%3A"; "%3B"; "%3C"; "%3D"; "%3E"; "%3F";
|
||||||
|
"%40"; "%5B"; "%5C"; "%5D"; "%5E"; "%60"; "%7B"; "%7C"; "%7D"; "%7E" };
|
||||||
|
|
||||||
|
:for I from=0 to=([ :len $Input ] - 1) do={
|
||||||
|
:local Char [ :pick $Input $I ];
|
||||||
|
:local Replace [ :find $Chars $Char ];
|
||||||
|
|
||||||
|
:if ([ :typeof $Replace ] = "num") do={
|
||||||
|
:set Char ($Subs->$Replace);
|
||||||
|
}
|
||||||
|
:set Return ($Return . $Char);
|
||||||
|
}
|
||||||
|
|
||||||
|
:return $Return;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@
|
||||||
:global SymbolByUnicodeName;
|
:global SymbolByUnicodeName;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global Unix2Dos;
|
:global Unix2Dos;
|
||||||
:global UrlEncode;
|
|
||||||
:global ValidateSyntax;
|
:global ValidateSyntax;
|
||||||
:global VersionToNum;
|
:global VersionToNum;
|
||||||
:global WaitDefaultRouteReachable;
|
:global WaitDefaultRouteReachable;
|
||||||
|
|
@ -1737,33 +1736,6 @@
|
||||||
:return [ :tocrlf [ :tostr $1 ] ];
|
:return [ :tocrlf [ :tostr $1 ] ];
|
||||||
}
|
}
|
||||||
|
|
||||||
# url encoding
|
|
||||||
:set UrlEncode do={
|
|
||||||
:local Input [ :tostr $1 ];
|
|
||||||
|
|
||||||
:if ([ :len $Input ] = 0) do={
|
|
||||||
:return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
:local Return "";
|
|
||||||
:local Chars ("\n\r !\"#\$%&'()*+,:;<=>?@[\\]^`{|}~");
|
|
||||||
:local Subs { "%0A"; "%0D"; "%20"; "%21"; "%22"; "%23"; "%24"; "%25"; "%26"; "%27";
|
|
||||||
"%28"; "%29"; "%2A"; "%2B"; "%2C"; "%3A"; "%3B"; "%3C"; "%3D"; "%3E"; "%3F";
|
|
||||||
"%40"; "%5B"; "%5C"; "%5D"; "%5E"; "%60"; "%7B"; "%7C"; "%7D"; "%7E" };
|
|
||||||
|
|
||||||
:for I from=0 to=([ :len $Input ] - 1) do={
|
|
||||||
:local Char [ :pick $Input $I ];
|
|
||||||
:local Replace [ :find $Chars $Char ];
|
|
||||||
|
|
||||||
:if ([ :typeof $Replace ] = "num") do={
|
|
||||||
:set Char ($Subs->$Replace);
|
|
||||||
}
|
|
||||||
:set Return ($Return . $Char);
|
|
||||||
}
|
|
||||||
|
|
||||||
:return $Return;
|
|
||||||
}
|
|
||||||
|
|
||||||
# basic syntax validation
|
# basic syntax validation
|
||||||
:set ValidateSyntax do={
|
:set ValidateSyntax do={
|
||||||
:local Code [ :tostr $1 ];
|
:local Code [ :tostr $1 ];
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,6 @@
|
||||||
|
|
||||||
:global FetchUserAgentStr;
|
:global FetchUserAgentStr;
|
||||||
:global LogPrint;
|
:global LogPrint;
|
||||||
:global UrlEncode;
|
|
||||||
|
|
||||||
:global MatrixAccessToken;
|
:global MatrixAccessToken;
|
||||||
:global MatrixHomeServer;
|
:global MatrixHomeServer;
|
||||||
|
|
@ -251,8 +250,8 @@
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
/tool/fetch check-certificate=yes-without-crl output=none \
|
/tool/fetch check-certificate=yes-without-crl output=none \
|
||||||
http-header-field=({ [ $FetchUserAgentStr $0 ] }) http-method=post http-data="" \
|
http-header-field=({ [ $FetchUserAgentStr $0 ] }) http-method=post http-data="" \
|
||||||
("https://" . $MatrixHomeServer . "/_matrix/client/r0/rooms/" . [ $UrlEncode $MatrixRoom ] . \
|
("https://" . $MatrixHomeServer . "/_matrix/client/r0/rooms/" . [ :convert to=url $MatrixRoom ] . \
|
||||||
"/join?access_token=" . [ $UrlEncode $MatrixAccessToken ]) as-value;
|
"/join?access_token=" . [ :convert to=url $MatrixAccessToken ]) as-value;
|
||||||
$LogPrint debug $0 ("Joined the room.");
|
$LogPrint debug $0 ("Joined the room.");
|
||||||
} do={
|
} do={
|
||||||
$LogPrint error $0 ("Failed joining the room: " . $Err);
|
$LogPrint error $0 ("Failed joining the room: " . $Err);
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@
|
||||||
:global IfThenElse;
|
:global IfThenElse;
|
||||||
:global LogPrint;
|
:global LogPrint;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global UrlEncode;
|
|
||||||
|
|
||||||
:local Server [ $EitherOr ($NtfyServerOverride->($Notification->"origin")) $NtfyServer ];
|
:local Server [ $EitherOr ($NtfyServerOverride->($Notification->"origin")) $NtfyServer ];
|
||||||
:local User [ $EitherOr ($NtfyServerUserOverride->($Notification->"origin")) $NtfyServerUser ];
|
:local User [ $EitherOr ($NtfyServerUserOverride->($Notification->"origin")) $NtfyServerUser ];
|
||||||
|
|
@ -92,7 +91,7 @@
|
||||||
:return false;
|
:return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Url ("https://" . $Server . "/" . [ $UrlEncode $Topic ]);
|
:local Url ("https://" . $Server . "/" . [ :convert to=url $Topic ]);
|
||||||
:local Headers ({ [ $FetchUserAgentStr ($Notification->"origin") ]; \
|
:local Headers ({ [ $FetchUserAgentStr ($Notification->"origin") ]; \
|
||||||
("Priority: " . [ $IfThenElse ($Notification->"silent") "low" "default" ]); \
|
("Priority: " . [ $IfThenElse ($Notification->"silent") "low" "default" ]); \
|
||||||
("Title: " . "[" . $IdentityExtra . $Identity . "] " . ($Notification->"subject")) });
|
("Title: " . "[" . $IdentityExtra . $Identity . "] " . ($Notification->"subject")) });
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,6 @@
|
||||||
:global LogPrint;
|
:global LogPrint;
|
||||||
:global ProtocolStrip;
|
:global ProtocolStrip;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global UrlEncode;
|
|
||||||
|
|
||||||
:local EscapeMD do={
|
:local EscapeMD do={
|
||||||
:local Text [ :tostr $1 ];
|
:local Text [ :tostr $1 ];
|
||||||
|
|
@ -203,7 +202,7 @@
|
||||||
}
|
}
|
||||||
:local Data ([ /tool/fetch check-certificate=yes-without-crl output=user http-method=post \
|
:local Data ([ /tool/fetch check-certificate=yes-without-crl output=user http-method=post \
|
||||||
("https://api.telegram.org/bot" . $TokenId . "/sendMessage") \
|
("https://api.telegram.org/bot" . $TokenId . "/sendMessage") \
|
||||||
http-data=($HTTPData . "&text=" . [ $UrlEncode $Text ]) as-value ]->"data");
|
http-data=($HTTPData . "&text=" . [ :convert to=url $Text ]) as-value ]->"data");
|
||||||
:set ($TelegramMessageIDs->[ :tostr ([ :deserialize from=json value=$Data ]->"result"->"message_id") ]) 1;
|
:set ($TelegramMessageIDs->[ :tostr ([ :deserialize from=json value=$Data ]->"result"->"message_id") ]) 1;
|
||||||
} do={
|
} do={
|
||||||
$LogPrint info $0 ("Failed sending Telegram notification: " . $Err . " - Queuing...");
|
$LogPrint info $0 ("Failed sending Telegram notification: " . $Err . " - Queuing...");
|
||||||
|
|
@ -215,7 +214,7 @@
|
||||||
[ $EscapeMD ("This message was queued since _" . [ /system/clock/get date ] . \
|
[ $EscapeMD ("This message was queued since _" . [ /system/clock/get date ] . \
|
||||||
" " . [ /system/clock/get time ] . "_ and may be obsolete.") "plain" "_" ]);
|
" " . [ /system/clock/get time ] . "_ and may be obsolete.") "plain" "_" ]);
|
||||||
:set ($TelegramQueue->[ :len $TelegramQueue ]) { tokenid=$TokenId;
|
:set ($TelegramQueue->[ :len $TelegramQueue ]) { tokenid=$TokenId;
|
||||||
http-data=($HTTPData . "&text=" . [ $UrlEncode $Text ]) };
|
http-data=($HTTPData . "&text=" . [ :convert to=url $Text ]) };
|
||||||
:if ([ :len [ /system/scheduler/find where name="_FlushTelegramQueue" ] ] = 0) do={
|
:if ([ :len [ /system/scheduler/find where name="_FlushTelegramQueue" ] ] = 0) do={
|
||||||
/system/scheduler/add name="_FlushTelegramQueue" interval=1m start-time=startup \
|
/system/scheduler/add name="_FlushTelegramQueue" interval=1m start-time=startup \
|
||||||
on-event=(":global FlushTelegramQueue; \$FlushTelegramQueue;");
|
on-event=(":global FlushTelegramQueue; \$FlushTelegramQueue;");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue