-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds auto updater #31
Conversation
+ Added auto updater - Downloads and extracts latest release when checkupdate.exe is ran - Uses startup.exe to install which is started by checkupdate.exe. When that ends then continue startRPC.bat
+ Created arguments to further automate setup.exe + Gave sys.exit in checkUpdate.exe an exit code + Added print statements to better communicate to the user what's happening + Removed the use of request.session in downloadupdate.py as it might not be needed
update fork
Nice, bump the version to 1.2.0 and I will test it. |
Should the auto-updater value be true in version.json? And if yes, I should probably add in an if statement checking it. |
Yes |
Bumped version.json to 1.2.0 Changed auto-update to true by default Added a check in checkupdate.py to see if version.json's auto-update flag is true Changed the version compare expression into a variable for readability to prevent an if statement being a little too long
Just noticed security concerns, if it bothers you I'll try my best to look into it. I'm not too keen on code security yet as I'm self-taught, but I'll see what I can do. |
Yeah, this is indeed a security issue just to import suprocess due greatly to command injection attacks. But we don't need to solve it for now. A good aproach to solve it is just avoiding use or using preconditions and postconditions (A good code quality). But this issue is an especial case, the only main problem I see is when you call subprocess.Popen([installerPath, "-update"], start_new_session=True) But I think that installerPath came from the other module and is treated there. No worries, I will merge bypassing and we can treat/refactor this later.
Don't worry, the best programmers are self-taught. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay.
I fixed some minimum things in the PR. I tested here and it was working. Looks good to me.
For issue #11
Implemented an auto updater.
Each time
hoi4-presence
starts it will check for an update like normal, if an update is found, download in user's%TEMP%
and runsetup.exe
to install. There is a new argument to pass intosetup.exe
to signal that there is an update. When this new argument is passed,setup.exe
will re-openhoi4-presence
when it's finished installing.I did some testing everything should work. If you don't want the
requests
module being used I can replace it withurllib.request