Danacus / node-factorio-api

Download and update mods from the Factorio Mod Portal
3 stars 2 forks source link

Allow for updating/downloading factorio #6

Open Danielv123 opened 6 years ago

Danielv123 commented 6 years ago

Currently there is no good automated way to update the GUI version on linux and windows servers without having to click the ingame button. Since this module already does authentication to the mod portal, how much of a stretch would it be to allow it to download the game as well?

Danacus commented 6 years ago

Oh, good idea. That should definitely be doable. I'll probably do that on Friday because I'm probably gonna be alone the whole day anyway. Thanks for giving me a little project to work on! If you have any other ideas, just tell me. I like working on this for some reason.

Danacus commented 6 years ago

I've successfully implemented the downloading of the game. It took way longer than expected, because I was trying to do a POST request by using a query string in the url. That was very stupid. But after a lot of dirty web scraping and tasty cookies, it seems to be working just fine. You will need to give your password though, unless you give it a session id, which you can find in the cookies of your browser. You can now also view the progress while downloading the game. You can find an example in the readme. I'm still looking for a good way to view the progress while downloading or updating multiple mods. Basically, there's request-progress, progress-promise and request-promise, but I actually need request-progress-promise, which doesn't exist (yet?). I will also look at the API for updating the game, because there actually is an API for that (updater.factorio.com).