Compare commits

..

8 commits

Author SHA1 Message Date
Christian Hesse
31a4e95383 global-functions: $NetMask6: use shift operator...
... and drop the workaround. This requires RouterOS 7.22beta3.
2026-01-22 07:07:06 +01:00
Christian Hesse
f4ac5792d2 Merge branch 'continue-in-loop' into next 2026-01-22 07:07:06 +01:00
Christian Hesse
a1694a972e check-certificates: use :continue in loop 2026-01-22 07:07:06 +01:00
Christian Hesse
c1ce74bddf global-functions: $ScriptInstallUpdate: fix indention 2026-01-22 07:07:06 +01:00
Christian Hesse
ee7b59c8fb global-functions: $ScriptInstallUpdate: use :continue in loop 2026-01-22 07:07:06 +01:00
Christian Hesse
8503752957 fw-addr-lists: fix indention 2026-01-22 07:07:06 +01:00
Christian Hesse
259933dbf9 fw-addr-lists: use :continue in loop 2026-01-22 07:07:06 +01:00
Christian Hesse
69a4aab891 telegram-chat: use :continue in loop 2026-01-22 07:07:06 +01:00
3 changed files with 27 additions and 34 deletions

View file

@ -54,17 +54,9 @@
"' (file '" . $CertFileName . "')...");
:do {
:onerror Err {
/tool/fetch check-certificate=yes-without-crl \
http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) \
($CertRenewUrl . $CertFileName) dst-path=$CertFileName as-value;
} do={
:if ($Err != "Fetch failed with status 404") do={
$LogPrint warning $0 ("Failed fetching certificate: " . $Err);
}
:error false;
}
$WaitForFile $CertFileName;
/tool/fetch check-certificate=yes-without-crl http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) \
($CertRenewUrl . $CertFileName) dst-path=$CertFileName as-value;
$WaitForFile $CertFileName;
:local DecryptionFailed true;
:foreach I,PassPhrase in=$CertRenewPass do={

View file

@ -121,22 +121,22 @@
} do={
$LogPrint warning $ScriptName ("Request to DoH server " . ($DohServer->"doh-url") . \
" failed: " . $Err);
:continue;
}
:if ([ :typeof [ :find $Data "doh-check-OK" ] ] != "num") do={
$LogPrint warning $ScriptName ("Received unexpected response from DoH server: " . \
:if ($Data != false) do={
:if ([ :typeof [ :find $Data "doh-check-OK" ] ] = "num") do={
/ip/dns/set use-doh-server=($DohServer->"doh-url") verify-doh-cert=yes;
:if ([ /certificate/settings/get crl-use ] = true) do={
$LogPrintOnce warning $ScriptName ("Configured to use CRL, that can cause severe issue!");
}
/ip/dns/cache/flush;
$LogPrint info $ScriptName ("Setting DoH server: " . ($DohServer->"doh-url"));
:exit;
} else={
$LogPrint warning $ScriptName ("Received unexpected response from DoH server: " . \
($DohServer->"doh-url"));
:continue;
}
}
/ip/dns/set use-doh-server=($DohServer->"doh-url") verify-doh-cert=yes;
:if ([ /certificate/settings/get crl-use ] = true) do={
$LogPrintOnce warning $ScriptName ("Configured to use CRL, that can cause severe issue!");
}
/ip/dns/cache/flush;
$LogPrint info $ScriptName ("Setting DoH server: " . ($DohServer->"doh-url"));
:exit;
}
} do={
:global ExitOnError; $ExitOnError [ :jobname ] $Err;

View file

@ -68,17 +68,18 @@
:local Data false;
:for I from=1 to=4 do={
:onerror Err {
:set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
("https://api.telegram.org/bot" . $TelegramTokenId . "/getUpdates?offset=" . \
$TelegramChatOffset->0 . "&allowed_updates=%5B%22message%22%5D") as-value ]->"data");
:set TelegramRandomDelay [ $MAX 0 ($TelegramRandomDelay - 1) ];
:break;
} do={
:if ($I < 4) do={
$LogPrint debug $ScriptName ("Fetch failed, " . $I . ". try: " . $Err);
:set TelegramRandomDelay [ $MIN 15 ($TelegramRandomDelay + 5) ];
:delay (($I * $I) . "s");
:if ($Data = false) do={
:onerror Err {
:set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
("https://api.telegram.org/bot" . $TelegramTokenId . "/getUpdates?offset=" . \
$TelegramChatOffset->0 . "&allowed_updates=%5B%22message%22%5D") as-value ]->"data");
:set TelegramRandomDelay [ $MAX 0 ($TelegramRandomDelay - 1) ];
} do={
:if ($I < 4) do={
$LogPrint debug $ScriptName ("Fetch failed, " . $I . ". try: " . $Err);
:set TelegramRandomDelay [ $MIN 15 ($TelegramRandomDelay + 5) ];
:delay (($I * $I) . "s");
}
}
}
}