From: vados-dev <192440777+vados-dev@users.noreply.github.com> Date: Mon, 4 May 2026 08:10:03 +0000 (+0300) Subject: Autocommit in repo: ros.vados.ru, generated by owner: root, in 11:10:03 04.05.2026. X-Git-Url: https://git.vados.ru/gitweb.cgi?a=commitdiff_plain;h=9b892c49ede11202962cf7869c13b66d2b5b0e0f;p=Mikrotiks%2Fros.vados.ru.git Autocommit in repo: ros.vados.ru, generated by owner: root, in 11:10:03 04.05.2026. --- diff --git a/html/AM-GlobalFunc.rsc b/html/AM-GlobalFunc.rsc index 6dcf43e00..d72e4c1f0 100644 --- a/html/AM-GlobalFunc.rsc +++ b/html/AM-GlobalFunc.rsc @@ -17,9 +17,9 @@ :global GlobalFuncReady false; # Git commit id & info, expected configuration version -:global CommitId "main/545/3a63a0b7"; +:global CommitId "main/546/6df1efd6"; :global CommitTAG "unknown"; -:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 11:00:03 04.05.2026."; +:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 11:10:03 04.05.2026."; # The variables are received right here. :global GlobalConfVersion 140; @@ -1344,8 +1344,6 @@ :local CheckCert [:tostr $3]; :local fetchMode [:tostr $4]; :local fetchMethod [:tostr $5]; - :local FetchString "undefined"; - :global CleanName; :global FetchUserAgentStr; :global GetRandom20CharAlNum; @@ -1357,38 +1355,39 @@ :global WaitForFile; :set CheckCert [ $IfThenElse ($CheckCert = "false") "no" "yes-without-crl" ]; - #:set fetchMode [ $IfThenElse ($fetchMode != "false") [:tostr ("mode=" . $fetchMode)] ]; - #:set fetchMethod [$IfThenElse ($fetchMethod != "false") [:tostr ("http-method=\"" . $fetchMethod . "\"") ]]; - :local DirName ("tmpfs/" . [ $CleanName $FetchLargeScript ]); :if ([ $MkDir $DirName ] = false) do={ :log error ($FetchLargeScript . " Failed creating directory!"); :return false; } :local FileName ($DirName . "/" . [ $CleanName $fetchUrl ] . "-" . [ $GetRandom20CharAlNum ]); - #/tool/fetch check-certificate=$CheckCert $Url dst-path=$FileName http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) as-value; - #:log warning ("\$fUrl =" . $2 . ({[ $fMode ]})); - :onerror Err { - :set FetchString ("/tool/fetch " . \ - [$IfThenElse ([$fetchMethod] != "false") ("http-method=\"" . $fetchMethod . "\" ")] . \ - "check-certificate=" . $CheckCert . " url=(\"" . $fetchUrl . "\") " . \ - [$IfThenElse ([$fetchMode] != "false") ("mode=" . $fetchMode . " ")] . \ - http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) as-value); - :log warning ("\$FetchSring = " . $FetchString); - :put [$FetchString]; - #:put [/tool/fetch $fetchMode check-certificate=$CheckCert url=($fetchUrl) dst-path=($FileName) http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) as-value]; - } do={ - :if ([ $WaitForFile $FileName 500ms ] = true) do={ - $RmFile $FileName; + + :do { + :if ($fetchMethod = "false") do={ + :if ($fetchMode = "false") do={ + /tool/fetch url=($fetchUrl) dst-path=$FileName check-certificate=$CheckCert http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) as-value; + } else={ + /tool/fetch url=($fetchUrl) dst-path=$FileName check-certificate=$CheckCert http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) mode=$fetchMode as-value; + } + } else={ + :if ($fetchMode = "false") do={ + /tool/fetch url=($fetchUrl) dst-path=$FileName check-certificate=$CheckCert http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) http-method=$fetchMethod as-value; + } else={ + /tool/fetch url=($fetchUrl) dst-path=$FileName check-certificate=$CheckCert http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) http-method=$fetchMethod mode=$fetchMode as-value; + } } - $LogPrint debug $0 ("Failed downloading from " . $fetchUrl . " - " . $Err); + } on-error={ + $LogPrint error $0 ("Failed downloading from " . $fetchUrl . " - " . $Err); $RmDir $DirName; :return false; } + :if ([ $WaitForFile $FileName 5s ] = false) do={ - $LogPrint debug $0 ("The file downloaded from " . $fetchUrl . " did not show up."); + $LogPrint error $0 ("The file downloaded from " . $fetchUrl . " did not show up."); + $RmDir $DirName; :return false; } + :local FileSize [ /file/get $FileName size ]; :local Return ""; :local VarSize 0; @@ -1400,6 +1399,7 @@ :delay 100ms; } } + $RmFile $FileName; $RmDir $DirName; :return $Return; } @@ -1676,13 +1676,3 @@ # signal we are ready :set GlobalFuncReady true; - -:do { -:onerror Err { - :global GlobalConfReady; - :retry { :if ($GlobalConfReady != true) \ - do={ :error ("Global config not ready."); }; } delay=500ms max=50; - } do={ - :global ExitOnError; $ExitOnError $0 $Err; - } -}