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

index 4e77a1dd38661adfbb80e9b1d25c8abdcbb1787e..d6b285d973dbac11a70d10bc2a3942aced4f1f64 100644 (file)
@@ -17,9 +17,9 @@
 :global GlobalFuncReady false;
 
 # Git commit id & info, expected configuration version
-:global CommitId "main/556/4817e0dc";
+:global CommitId "main/557/130a1a08";
 :global CommitTAG "unknown";
-:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 12:50:02 04.05.2026.";
+:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 13:20:03 04.05.2026.";
 
 # The variables are received right here.
 :global GlobalConfVersion 140;
 #      "background-and-keep-broken-and-no-redirects")
 # $5 - fetch method for /tool/fetch (optional, e.g. "get", "head", "post", "put", "patch", "delete")
 :set FetchLargeFiles do={
-  :local ScriptName [:tostr $1];
+  :local RunName [:tostr $1];
   :local fetchUrl [:tostr $2];
-  :local CheckCert [:tostr $3];
-  :local fetchMode [:tostr $4];
-  :local fetchMethod [:tostr $5];
+  :local fetchFile [:tostr $3];
+  :local CheckCert [:tostr $4];
+  :local fetchMode [:tostr $5];
+  :local fetchMethod [:tostr $6];
+  :local tmpName;
   :global CleanName;
   :global FetchUserAgentStr;
   :global GetRandom20CharAlNum;
   :global WaitForFile;
 
   :set CheckCert [ $IfThenElse ($CheckCert = "false") "no" "yes-without-crl" ];
-  
-  :local DirName ("tmpfs/" . [ $CleanName $ScriptName ]);
+
+  :set tmpName [ $CleanName "tmp-" . [ $GetRandom20CharAlNum 4 ] ];
+  :local DirName ("tmpfs/" . $tmpName);
   :if ([ $MkDir $DirName ] = false) do={
-    $LogPrint error $0 ("Failed creating directory!");
+    :log error ($RunName . " Failed creating directory: " . $DirName . "!");
     :return false;
   }
 
-  :local FileName ($DirName . "/" . [ $CleanName $0 ] . "-" . [ $GetRandom20CharAlNum ]);
+  :local FileName ($DirName . "/" . [ $CleanName $fetchFile ] . "-" . [ $GetRandom20CharAlNum 5 ]);
+  :local Url ($fetchUrl . $FileName);
   :onerror Err {
-    /tool/fetch check-certificate=$CheckCert $fetchUrl dst-path=$FileName \
-      http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) as-value;
+    /tool/fetch check-certificate=$CheckCert $Url dst-path=$FileName \
+      http-header-field=({ [ $FetchUserAgentStr $RunName ] }) as-value;
   } do={
     :if ([ $WaitForFile $FileName 500ms ] = true) do={
       $RmFile $FileName;
     }
-    :log error ($0 . " Failed downloading from " . $fetchUrl . " - " . $Err);
+    :log error ($RunName . " Failed downloading from '" . $Url . "' - " . $Err);
     $RmDir $DirName;
     :return false;
   }
 
   :if ([ $WaitForFile $FileName 5s ] = false) do={
-    :log error ($0 . "The file downloaded from " . $fetchUrl . " did not show up.");
+    :log error ($RunName . " The file downloaded from '" . $Url . "' did not show up.");
     :return false;
   }
   
   :global CommentsInScripts;
 
   :if ([ $CertificateAvailable "Root YE" "fetch" ] = false) do={
-    $LogPrint warning $0 ("Downloading certificate failed, trying without.");
+    :log warning ($0 . "Downloading certificate failed, trying without.");
   }
 
   :foreach Script in=$Scripts do={
     :if ([ :len [ /system/script/find where name=$Script ] ] = 0) do={
-      $LogPrint info $0 ("Adding new script: " . $Script);
+      :log info ($0 . " Adding new script: " . $Script);
       /system/script/add name=$Script owner=$Script source="#!rsc by Vados\n" comment=$NewComment;
     }
   }