mirror of
https://github.com/Flowseal/zapret-discord-youtube.git
synced 2026-08-05 07:35:53 +03:00
fixes #15952
This commit is contained in:
@@ -928,18 +928,20 @@ set "hostsUrl=https://raw.githubusercontent.com/Flowseal/zapret-discord-youtube/
|
|||||||
set "tempFile=%TEMP%\zapret_hosts.txt"
|
set "tempFile=%TEMP%\zapret_hosts.txt"
|
||||||
set "needsUpdate=0"
|
set "needsUpdate=0"
|
||||||
|
|
||||||
|
set "cacheBuster=%RANDOM%%RANDOM%%RANDOM%"
|
||||||
|
set "requestUrl=%hostsUrl%?t=%cacheBuster%"
|
||||||
|
|
||||||
echo Checking hosts file...
|
echo Checking hosts file...
|
||||||
|
|
||||||
if exist "%SystemRoot%\System32\curl.exe" (
|
if exist "%SystemRoot%\System32\curl.exe" (
|
||||||
curl -L -s -o "%tempFile%" "%hostsUrl%"
|
curl -L -s --fail -o "%tempFile%" "%requestUrl%"
|
||||||
) else (
|
) else (
|
||||||
powershell -NoProfile -Command ^
|
powershell -NoProfile -Command ^
|
||||||
"$url = '%hostsUrl%';" ^
|
"$url = '%requestUrl%';" ^
|
||||||
"$out = '%tempFile%';" ^
|
"$out = '%tempFile%';" ^
|
||||||
"$res = Invoke-WebRequest -Uri $url -TimeoutSec 10 -UseBasicParsing;" ^
|
"$res = Invoke-WebRequest -Uri $url -TimeoutSec 10 -UseBasicParsing;" ^
|
||||||
"if ($res.StatusCode -eq 200) { $res.Content | Out-File -FilePath $out -Encoding UTF8 } else { exit 1 }"
|
"if ($res.StatusCode -eq 200) { $res.Content | Out-File -FilePath $out -Encoding UTF8 } else { exit 1 }"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not exist "%tempFile%" (
|
if not exist "%tempFile%" (
|
||||||
call :PrintRed "Failed to download hosts file from repository"
|
call :PrintRed "Failed to download hosts file from repository"
|
||||||
call :PrintYellow "Copy hosts file manually from %hostsUrl%"
|
call :PrintYellow "Copy hosts file manually from %hostsUrl%"
|
||||||
|
|||||||
Reference in New Issue
Block a user