R0rt1z2 / realme-ota

Request and download OTA packages from BBK server(s)
GNU General Public License v3.0
150 stars 49 forks source link

Code refactor, bug fixes, new options #34

Closed rapperskull closed 1 year ago

rapperskull commented 1 year ago

Sorry for the mess this PR is. I was working on multiple things at once and I wasn't able to untangle it. I just split it in two for reasons I'll explain shortly.

The bulk of the PR is in the first commit. It includes some bug fixes ('romPrefix' not being properly split, missing strings for Android 13), some additions (default nv_id for EU region) and some code refactoring to uniform the two different paths for Realme UI 1 and 2/3/4. There's also the introduction of a verbosity level setting. It was not strictly necessary, but since I was going to add an option to dump the headers, I decided it was worth adding. And, as I said, now the headers and the unencrypted body are dumped, if the verbosity level is set sufficiently high. Finally, there's the reorganization of the options. Two subgroups are added to separate request and output options from the positional arguments and the general options. This makes the help a lot clearer, especially if the other commit is going to be merged.

The second commit is experimental, because I was not able to test it. It is based on a speculation, because I noticed that changing the 'mode' from 0 to 1 gave me an error message about the IMEI not being in the test set. I managed to contact a user in the beta program, and setting one or both the IMEIs gave the same error. What I've not tested is to:

I think that at least one of the methods should work, but honesty I have no idea on how to test. Users are not willing to share their IMEIs for obvious reasons, and I got the stable Android 13 update on my phone (plus I'm from Europe, so no beta for me). In any case, maybe the ability to set the IMEI is worth keeping anyway.

If you have any question about the PR, feel free to ask.

EDIT: Just want to point out that the README needs to be changed if you're going to merge this.

R0rt1z2 commented 1 year ago

Thanks for the contribution, it's highly appreciated!

Don't worry about it being a bulk commit, as if this was a professional repo.

The changes all look good, definitely a great improvement for the tool.

As you pointed out, I will (later) update the README.md as well.

Thanks, again!