NicolasWebDev / reinstall-magisk-on-lineageos

Small bash script to reinstall magisk after each LineageOS update
72 stars 15 forks source link

fix: use API due to website renovation #30

Closed DMaxter closed 1 year ago

DMaxter commented 1 year ago

Lineage renewed the website and the old way of obtaining the ROM no longer works as the site only loads the needed links afterwards using JavaScript.

They now have an endpoint which outputs the ROMs in JSON format

Tested on my phone and worked right away

ArvindEXE commented 1 year ago

I get this error, using your solution: (28) Failed to connect to lineageos.mirror.karneval.cz port 443 after 131495 ms: Connection timed out

DMaxter commented 1 year ago

That might be a problem with the mirror you are using. I have a Poco F1 (beryllium) and it worked with this solution

ArvindEXE commented 1 year ago

The link downloads when I open it directly through a browser (firefox), maybe curl doesn't work for my link. When I copy the direct download link in the browser it also times out. I have a s10e (beyond0lte).

DMaxter commented 1 year ago

Looks like it might be an issue with the link. But aren't all downloads coming directly from https://download.lineageos.org ?

ArvindEXE commented 1 year ago

In my case, it comes from the following page: https://download.lineageos.org/devices/beyond0lte/builds

However the direct download link points to a different address, in my case: https://mirrorbits.lineageos.org/full/beyond0lte/20230316/lineage-19.1-20230316-nightly-beyond0lte-signed.zip

The above link does appear to be working, but in the script it times out. So that is why I thought it doesn't work with curl.

NicolasWebDev commented 1 year ago

Hi guys. Thanks @DMaxter for the pull request. Getting the download url from a JSON is a much cleaner solution than scraping the web page (with grep!!!).

@ArvindEXE , I think that the timeout was because of your particular mirror being down at that time. Mirrorbits seem to send you to a mirror located close to you automatically.

I've made a curl right now with the url found from the json and it downloaded fine.

The following command should work directly in your terminal: curl --location https://mirrorbits.lineageos.org/full/vayu/20230331/lineage-19.1-20230331-nightly-vayu-signed.zip --output /tmp/lineageos.zip. Naturally you have to replace the url for your particular build.

NicolasWebDev commented 1 year ago

I've fixed the unit tests correspondingly @DMaxter . Thanks for the help on the fix!