]> Git [git.vados.ru] :: Repos - Mikrotiks/ros.vados.ru.git/commitdiff
Autocommit in repo: ros.vados.ru, generated by owner: root, in 18:35:02 04.05.2026.
authorvados-dev <192440777+vados-dev@users.noreply.github.com>
Mon, 4 May 2026 15:35:03 +0000 (18:35 +0300)
committervados-dev <192440777+vados-dev@users.noreply.github.com>
Mon, 4 May 2026 15:35:03 +0000 (18:35 +0300)
html/AM-FwAddrLists.rsc
html/AM-GlobalFunc.rsc

index bcdf6946ac22341a83a8fcb37df6ad46b3eff2ce..532c92a14b4bb70684e17ac3b7d6e7ff0e78a203 100644 (file)
   :local ScriptName [ :jobname ];
 
   :global GlobalScriptsUrl;
-  :local FwAddrListsDirName ("fw-addr-lists.d/" . [ /system identity get name ] . "/");
-  :local FwAddrListsUrl ($GlobalScriptsUrl . $FwAddrListsDirName);
-  :local Index "index.lst";
-  :local FwAddrListTimeOut 1d;
+  :local ListsDirName ("fw-addr-lists.d/" . [ /system identity get name ] . "/");
+  :local ListsUrl ($GlobalScriptsUrl . $ListsDirName);
+  :local ListsIndex "index.lst";
+  :local AddrListsTimeOut 1d;
   :local CheckCerts false;
 
   :global CertificateAvailable;
     :error false;
   }
 
-
   :local ListComment ("managed by " . $ScriptName);
   :local tmpIndex false;
 
-  :for I from=1 to=5 do={
-    :if ($tmpIndex = false) do={
-      :set tmpIndex [ :tolf [ $FetchHugeFiles $ScriptName $FwAddrListsUrl $Index $CheckCerts ] ];
-      :if ($tmpIndex = false && $I < 5) do={
-        :log warning ($ScriptName . " Failed downloading address-list index, " . $I . ". try from: " . $FwAddrListsUrl . $Index);
-        :delay (($I * $I) . "s");
+  :onerror Err {
+        :local Url ($ListsUrl . $ListsIndex);
+        :log info ($0 " Fetching script '" . $ScriptName . "' from url: " . $Url);
+        :set tmpIndex [ /tool/fetch check-certificate=yes-without-crl \
+          http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) $Url output=user as-value ];
+        :if ($tmpIndex->"status" = "finished") do={
+          :set arrLists [ :tolf ($tmpIndex->"Lists") ];
+        }
+      } do={
+        :log warning ($ScriptName . " Failed downloading address-lists index from: '" . $Url . "' Error: " . $Err);
+        :if ($Err != "Fetch failed with status 404") do={
+          :error false;
+        }
+      :set tmpIndex false;
+      :set arrLists false;
+      :error true;
       }
-    }
-  }
-  :if ($tmpIndex = false) do={
-    :log warning ($ScriptName . " Failed downloading address-list index from: " . $FwAddrListsUrl . $Index);
-    :set tmpIndex "";
-  }
+
+#  :for I from=1 to=5 do={
+#    :if ($tmpIndex = false) do={
+#      :set tmpIndex [ :tolf [ $FetchHugeFiles $ScriptName $FwAddrListsUrl $Index $CheckCerts ] ];
+#      :if ($tmpIndex = false && $I < 5) do={
+#        :log warning ($ScriptName . " Failed downloading address-list index, " . $I . ". try from: " . $FwAddrListsUrl . $Index);
+#        :delay (($I * $I) . "s");
+#      }
+#    }
+#  }
+#  :if ($tmpIndex = false) do={
+#    :log warning ($ScriptName . " Failed downloading address-list index from: " . $FwAddrListsUrl . $Index);
+#    :set tmpIndex "";
+#  }
 
   :foreach FwList in=[ :deserialize $tmpIndex delimiter="\n" from=dsv options=dsv.plain ] do={
     :set FwList ($FwList->0);
index fab2a46ee5797363658bc248eec10de9914588a0..59e90311433c080ea5e0024be61077980197d987 100644 (file)
@@ -17,9 +17,9 @@
 :global GlobalFuncReady false;
 
 # Git commit id & info, expected configuration version
-:global CommitId "main/580/082ed3d4";
+:global CommitId "main/581/3de1f6c0";
 :global CommitTAG "unknown";
-:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 18:05:03 04.05.2026.";
+:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 18:35:02 04.05.2026.";
 
 # The variables are received right here.
 :global GlobalConfVersion 140;