@@ -74,7 +74,7 @@ protected boolean prepare() {
7474 if (this .androidacyBlockade > time ) return false ;
7575 this .androidacyBlockade = time + 30_000L ;
7676 String cookies = AndroidacyRepoData .getCookies ();
77- int start = cookies == null ? -1 : cookies .indexOf ("USER=" );
77+ int start = cookies == null ? -1 : cookies .indexOf ("USER=" ) + 5 ;
7878 String token = null ;
7979 if (start != -1 ) {
8080 int end = cookies .indexOf (";" , start );
@@ -184,6 +184,8 @@ protected List<RepoModule> populate(JSONObject jsonObject) throws JSONException
184184 repoModule .notesUrl = // Fallback url in case the API doesn't have notesUrl
185185 "https://api.androidacy.com/magisk/readme/?module=" + moduleId ;
186186 }
187+ repoModule .zipUrl = this .injectToken (repoModule .zipUrl );
188+ repoModule .notesUrl = this .injectToken (repoModule .notesUrl );
187189 repoModule .qualityText = R .string .module_downloads ;
188190 repoModule .qualityValue = jsonObject .optInt ("downloads" , 0 );
189191 String checksum = jsonObject .optString ("checksum" , "" );
@@ -211,6 +213,7 @@ protected List<RepoModule> populate(JSONObject jsonObject) throws JSONException
211213 moduleInfo .minMagisk = 0 ;
212214 }
213215 moduleInfo .needRamdisk = jsonObject .optBoolean ("needRamdisk" , false );
216+ moduleInfo .changeBoot = jsonObject .optBoolean ("changeBoot" , false );
214217 moduleInfo .support = filterURL (jsonObject .optString ("support" ));
215218 moduleInfo .donate = filterURL (jsonObject .optString ("donate" ));
216219 String config = jsonObject .optString ("config" , "" );
@@ -258,4 +261,19 @@ public String getUrl() {
258261 return this .token == null ? this .url :
259262 this .url + "?token=" + this .token ;
260263 }
264+
265+ private String injectToken (String url ) {
266+ // Do not inject token for non Androidacy urls
267+ if (!AndroidacyUtil .isAndroidacyLink (url ))
268+ return url ;
269+ String token = "token=" + this .token ;
270+ if (!url .contains (token )) {
271+ if (url .lastIndexOf ('/' ) < url .lastIndexOf ('?' )) {
272+ return url + '&' + token ;
273+ } else {
274+ return url + '?' + token ;
275+ }
276+ }
277+ return url ;
278+ }
261279}
0 commit comments