Skip to content

Commit

Permalink
Checks for updates on menu option
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchv2020 committed Jan 28, 2022
1 parent 277408e commit b6fe390
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 10 deletions.
10 changes: 4 additions & 6 deletions QuestToolbox.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:: Developed By:
:: mitchv2020 and LordNikonUK

set version=v1.5.0
set version=v1.5.1

:::::::::::::::::::::
:::: FILE CHECKS ::::
Expand Down Expand Up @@ -878,13 +878,11 @@ goto MainMenu

:update
cls
echo Opening GitHub page...
:: Opens a browser tab with the latest release
start https://www.github.com/mitchv2020/QuestToolbox/releases/latest
set update=yes
echo Checking for updates...
call checkforupdates.bat
goto MainMenu



:ADBMenu
cls
echo ADB Options
Expand Down
51 changes: 48 additions & 3 deletions Requirements/checkforupdates.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
@echo off

if "%update%"=="yes" goto updateOption

:startupCheck
curl.exe -s -o "sc.txt" https://api.github.com/repos/mitchv2020/questtoolbox/releases
findstr "tag_name" sc.txt > list_of_ver.txt
fc list_of_ver.txt list_of_ver_fromdate.txt > nul
if errorlevel 1 goto matchFail

:next
::delete temp files
del list_of_ver.txt
del sc.txt
goto continueSetup
Expand All @@ -13,16 +17,57 @@ pause
:matchFail
cls
echo There is a new version of QuestToolBox available.
echo Do you want to update? (This will be automatic in the future)[0m
echo Do you want to update? (This may be automatic in the future)[0m

::options
cmdMenuSel f870 "Yes (Opens default browser)" "No"
if "%errorlevel%"=="1" (
::delete temp files
del list_of_ver.txt
del sc.txt
start https://github.com/mitchv2020/QuestToolbox/releases
exit
)
if "%errorlevel%"=="2" (
::delete temp files
del list_of_ver.txt
del sc.txt
goto continueSetup
)
)

:updateOption
curl.exe -s -o "sc.txt" https://api.github.com/repos/mitchv2020/questtoolbox/releases
findstr "tag_name" sc.txt > list_of_ver.txt
fc list_of_ver.txt list_of_ver_fromdate.txt > nul
if errorlevel 1 goto updateAvailable

cls
echo You are using the latest version of QuestToolbox!
del list_of_ver.txt
del sc.txt
pause
exit /b

:updateAvailable
cls
echo There is a new version of QuestToolBox available.
echo Do you want to update? (This may be automatic in the future)

::options
cmdMenuSel f870 "Yes (Opens default browser)" "No"
if "%errorlevel%"=="1" (
::delete temp files
del list_of_ver.txt
del sc.txt
start https://github.com/mitchv2020/QuestToolbox/releases
exit
)

if "%errorlevel%"=="2" (
::delete temp files
del list_of_ver.txt
del sc.txt
goto MainMenu
)

set update = none
2 changes: 1 addition & 1 deletion Requirements/list_of_ver_fromdate.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"tag_name": "v1.5.1",
"tag_name": "v1.5.0",
"tag_name": "v1.4.9",
"tag_name": "v1.4.8",
Expand Down Expand Up @@ -27,4 +28,3 @@
"tag_name": "v1.2.5",
"tag_name": "v1.2.4",
"tag_name": "v1.2.3",
"tag_name": "v1.2.2",

0 comments on commit b6fe390

Please sign in to comment.