Merge pull request #1512 from fridorin/main

This commit is contained in:
Flowseal 2025-03-08 15:03:17 +03:00 committed by GitHub
commit 99613c9423
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 122 additions and 153 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
version.txt

Binary file not shown.

View File

@ -2,87 +2,36 @@
setlocal EnableDelayedExpansion
chcp 437 > nul
set "CURRENT_VERSION=1.6.3"
set "GITHUB_URL=https://raw.githubusercontent.com/Flowseal/zapret-discord-youtube/refs/heads/main/.service/version.txt"
set "RELEASE_URL=https://github.com/Flowseal/zapret-discord-youtube/releases"
set "VERSION_FILE=version.txt"
set "SKIP_VERSION=null"
set "FILE_EXISTS=1"
:: Set current version and URLs
set "LOCAL_VERSION=1.6.3"
set "GITHUB_VERSION_URL=https://raw.githubusercontent.com/Flowseal/zapret-discord-youtube/main/.service/version.txt"
set "GITHUB_RELEASE_URL=https://github.com/Flowseal/zapret-discord-youtube/releases/tag/"
set "GITHUB_DOWNLOAD_URL=https://github.com/Flowseal/zapret-discord-youtube/releases/latest/download/zapret-discord-youtube-"
for /f "delims=" %%A in ('powershell -command "[datetime]::Now.ToString('yyyy-MM-dd HH:mm:ss')"') do set CURRENT_TIMESTAMP=%%A
:: Get the latest version from GitHub
for /f "delims=" %%A in ('powershell -command "(Invoke-WebRequest -Uri \"%GITHUB_VERSION_URL%\" -Headers @{\"Cache-Control\"=\"no-cache\"} -TimeoutSec 5).Content.Trim()" 2^>nul') do set "GITHUB_VERSION=%%A"
:: If file version.txt exists
if not exist %VERSION_FILE% (
set "FILE_EXISTS=0"
echo time: %CURRENT_TIMESTAMP%> %VERSION_FILE%
echo ver: %CURRENT_VERSION%>> %VERSION_FILE%
)
:: Reading data from local version.txt
for /f "tokens=1,* delims=: " %%A in (%VERSION_FILE%) do (
if "%%A"=="time" set "LAST_CHECK=%%B"
if "%%A"=="ver" set "INSTALLED_VERSION=%%B"
if "%%A"=="skip" set "SKIP_VERSION=%%B"
)
:: If file was called from thirdparty script (with 'soft' argument that blocks checking for 12 hours)
if "%~1"=="soft" (
:: Converting dates to parts for calculation
for /f "tokens=1-6 delims=-: " %%A in ("%CURRENT_TIMESTAMP%") do (
set "CURRENT_MONTH=%%B"
set "CURRENT_DAY=%%C"
set "CURRENT_HOUR=%%D"
)
for /f "tokens=1-6 delims=-: " %%A in ("%LAST_CHECK%") do (
set "LAST_MONTH=%%B"
set "LAST_DAY=%%C"
set "LAST_HOUR=%%D"
)
set /a "time_diff_in_minutes = (CURRENT_MONTH - LAST_MONTH) * 43200 + (CURRENT_DAY - LAST_DAY) * 1440 + (CURRENT_HOUR - LAST_HOUR) * 60"
if !time_diff_in_minutes! LEQ 360 if !FILE_EXISTS!==1 (
echo Skipping the update check because it hasnt been 6 hours
goto :EOF
)
)
:: Reading new version from github
set "NEW_VERSION="
for /f "delims=" %%A in ('powershell -command "(Invoke-WebRequest -Uri %GITHUB_URL% -Headers @{\"Cache-Control\"=\"no-cache\"} -TimeoutSec 5).Content" 2^>nul') do set "NEW_VERSION=%%A"
if not defined NEW_VERSION (
echo Error reading new version
:: Error handling
if not defined GITHUB_VERSION (
echo Error: Failed to fetch the latest version. Check your internet connection
goto :EOF
)
:: Rewrite file
echo time: %CURRENT_TIMESTAMP%> %VERSION_FILE%
echo ver: %INSTALLED_VERSION%>> %VERSION_FILE%
echo skip: %SKIP_VERSION%>> %VERSION_FILE%
:: Comparing versions
if "%NEW_VERSION%"=="%INSTALLED_VERSION%" (
echo You are using the latest version %NEW_VERSION%.
goto :EOF
:: Version comparison
if "%LOCAL_VERSION%"=="%GITHUB_VERSION%" (
echo Latest version installed: %LOCAL_VERSION%
) else (
:: Check if version skipped
if "%NEW_VERSION%"=="%SKIP_VERSION%" (
echo Newer version %NEW_VERSION% skipped by user.
goto :EOF
) else (
echo New version found: %NEW_VERSION%.
echo Visit %RELEASE_URL% to download a new version
echo New version available: %GITHUB_VERSION%
echo Release page: %GITHUB_RELEASE_URL%%GITHUB_VERSION%
set /p "CHOICE=Do you want to automatically download the new version? (y/n, default: y): "
if "!CHOICE!"=="" set "CHOICE=y"
if /i "!CHOICE!"=="y" (
echo Opening the download page...
start "" "%GITHUB_DOWNLOAD_URL%%GITHUB_VERSION%.zip"
)
)
:: Skip check
set /p "CHOICE=Skip this update? (y/n, default: n): " || set "CHOICE=n"
set "CHOICE=!CHOICE:~0,1!"
if /i "!CHOICE!"=="y" (
echo skip: %NEW_VERSION%>> %VERSION_FILE%
echo Update %NEW_VERSION% skipped.
) else (
start %RELEASE_URL%
)
if not "%1"=="soft" pause
endlocal

View File

@ -1,5 +1,5 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
cd /d "%~dp0"

View File

@ -1,5 +1,5 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
cd /d "%~dp0"

View File

@ -1,5 +1,5 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
cd /d "%~dp0"

View File

@ -1,5 +1,5 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
cd /d "%~dp0"

View File

@ -1,5 +1,5 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
cd /d "%~dp0"

View File

@ -1,5 +1,5 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
:: NOT RECOMMENDED

View File

@ -1,5 +1,5 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
cd /d "%~dp0"

View File

@ -1,5 +1,5 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
cd /d "%~dp0"

View File

@ -1,5 +1,5 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
cd /d "%~dp0"

View File

@ -1,19 +1,25 @@
discord.com
gateway.discord.gg
cdn.discordapp.com
discordapp.net
discordapp.com
discord.gg
media.discordapp.net
images-ext-1.discordapp.net
discord.app
discord.media
discordcdn.com
discord.dev
discord.new
discord.gift
discordstatus.com
cloudflare-ech.com
dis.gd
discord.co
discord-attachments-uploads-prd.storage.googleapis.com
cloudflare-ech.com
discord.app
discord.co
discord.com
discord.design
discord.dev
discord.gift
discord.gifts
discord.gg
discord.media
discord.new
discord.status
discord.store
discordapp.com
discordapp.net
discordcdn.com
discordmerch.com
discordpartygames.com
discordsays.com
discordsez.com
discord-activities.com
discordactivities.com
stable.dl2.discordapp.net

View File

@ -1,36 +1,42 @@
googlevideo.com
youtu.be
youtube.com
youtubei.googleapis.com
youtubeembeddedplayer.googleapis.com
ytimg.l.google.com
ytimg.com
jnn-pa.googleapis.com
youtube-nocookie.com
youtube-ui.l.google.com
yt-video-upload.l.google.com
wide-youtube.l.google.com
youtubekids.com
ggpht.com
discord.com
gateway.discord.gg
cdn.discordapp.com
discordapp.net
discordapp.com
discord.gg
media.discordapp.net
images-ext-1.discordapp.net
discord.app
discord.media
discordcdn.com
discord.dev
discord.new
discord.gift
discordstatus.com
dis.gd
discord.co
discord-attachments-uploads-prd.storage.googleapis.com
10tv.app
7tv.app
7tv.io
10tv.app
cloudflare-ech.com
cloudflare-ech.com
dis.gd
discord-attachments-uploads-prd.storage.googleapis.com
discord.app
discord.co
discord.com
discord.design
discord.dev
discord.gift
discord.gifts
discord.gg
discord.media
discord.new
discord.store
discord.status
discord-activities.com
discordactivities.com
discordapp.com
discordapp.net
discordcdn.com
discordmerch.com
discordpartygames.com
discordsays.com
discordsez.com
ggpht.com
googlevideo.com
jnn-pa.googleapis.com
stable.dl2.discordapp.net
wide-youtube.l.google.com
youtube-nocookie.com
youtube-ui.l.google.com
youtube.com
youtubeembeddedplayer.googleapis.com
youtubekids.com
youtubei.googleapis.com
youtu.be
yt-video-upload.l.google.com
ytimg.com
ytimg.l.google.com

View File

@ -1,23 +1,27 @@
@echo off
setlocal EnableDelayedExpansion
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
set "arg=%1"
if "%arg%" == "admin" (
echo Restarted with admin rights
:: Admin rights check
if "%1"=="admin" (
echo Started with admin rights
) else (
echo Requesting admin rights...
powershell -Command "Start-Process 'cmd.exe' -ArgumentList '/k \"\"%~f0\" admin\"' -Verb RunAs"
exit /b
)
:: Main
cd /d "%~dp0"
set BIN_PATH=%~dp0bin\
:: Checking for updates
call check_updates.bat soft
echo:
set BIN_PATH=%~dp0bin\
:: Searching for .bat files in current folder, except files that start with "service"
echo Pick one of the options:
set "count=0"
for %%f in (*.bat) do (
set "filename=%%~nxf"
@ -31,12 +35,11 @@ for %%f in (*.bat) do (
:: Choosing file
set "choice="
set /p "choice=Input file index (number): "
if "!choice!"=="" goto :eof
set "selectedFile=!file%choice%!"
if not defined selectedFile (
echo Wrong choice, exiting..
echo Wrong choice, exiting...
pause
goto :eof
)
@ -107,11 +110,13 @@ for /f "tokens=*" %%a in ('type "!selectedFile!"') do (
:: Creating service with parsed args
set ARGS=%args%
echo Final args: !ARGS!
set SRVCNAME=zapret
net stop %SRVCNAME%
sc delete %SRVCNAME%
net stop %SRVCNAME% >nul 2>&1
sc delete %SRVCNAME% >nul 2>&1
sc create %SRVCNAME% binPath= "\"%BIN_PATH%winws.exe\" %ARGS%" DisplayName= "zapret" start= auto
sc description %SRVCNAME% "zapret DPI bypass software"
sc description %SRVCNAME% "Zapret DPI bypass software"
sc start %SRVCNAME%
pause
endlocal

View File

@ -1,11 +1,11 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
set "arg=%1"
if "%arg%" == "admin" (
echo Restarted with admin rights
if "%1"=="admin" (
echo Started with admin rights
) else (
echo Requesting admin rights...
powershell -Command "Start-Process 'cmd.exe' -ArgumentList '/k \"\"%~f0\" admin\"' -Verb RunAs"
exit /b
)
@ -19,3 +19,6 @@ net stop "WinDivert"
sc delete "WinDivert"
net stop "WinDivert14"
sc delete "WinDivert14"
pause
endlocal

View File

@ -1,5 +1,6 @@
@echo off
chcp 65001 >nul
chcp 65001 > nul
:: 65001 - UTF-8
if "%~1"=="" (
call :test_service zapret