1414
1515import com .fox2code .mmm .BuildConfig ;
1616import com .fox2code .mmm .MainApplication ;
17+ import com .fox2code .mmm .androidacy .AndroidacyUtil ;
1718import com .fox2code .mmm .installer .InstallerInitializer ;
19+ import com .fox2code .mmm .repo .RepoManager ;
1820
1921import java .io .ByteArrayOutputStream ;
2022import java .io .File ;
@@ -193,7 +195,12 @@ public static OkHttpClient getHttpClientWithCache() {
193195 return doh ? httpClientWithCacheDoH : httpClientWithCache ;
194196 }
195197
198+ @ SuppressWarnings ("resource" )
196199 public static byte [] doHttpGet (String url ,boolean allowCache ) throws IOException {
200+ if (!RepoManager .isAndroidacyRepoEnabled () &&
201+ AndroidacyUtil .isAndroidacyLink (url )) {
202+ throw new IOException ("Androidacy repo is disabled, blocking url: " + url );
203+ }
197204 Response response = (allowCache ? getHttpClientWithCache () : getHttpClient ()).newCall (
198205 new Request .Builder ().url (url ).get ().build ()
199206 ).execute ();
@@ -220,8 +227,13 @@ public static String doHttpPostRedirect(String url, String data, boolean allowCa
220227 return (String ) doHttpPostRaw (url , data , allowCache , true );
221228 }
222229
230+ @ SuppressWarnings ("resource" )
223231 private static Object doHttpPostRaw (String url ,String data , boolean allowCache ,
224232 boolean isRedirect ) throws IOException {
233+ if (!RepoManager .isAndroidacyRepoEnabled () &&
234+ AndroidacyUtil .isAndroidacyLink (url )) {
235+ throw new IOException ("Androidacy repo is disabled, blocking url: " + url );
236+ }
225237 Response response = (isRedirect ? getHttpClientNoRedirect () :
226238 allowCache ? getHttpClientWithCache () : getHttpClient ()).newCall (
227239 new Request .Builder ().url (url ).post (JsonRequestBody .from (data ))
@@ -248,6 +260,10 @@ private static Object doHttpPostRaw(String url,String data, boolean allowCache,
248260
249261 public static byte [] doHttpGet (String url ,ProgressListener progressListener ) throws IOException {
250262 Log .d ("Http" , "Progress URL: " + url );
263+ if (!RepoManager .isAndroidacyRepoEnabled () &&
264+ AndroidacyUtil .isAndroidacyLink (url )) {
265+ throw new IOException ("Androidacy repo is disabled, blocking url: " + url );
266+ }
251267 Response response = getHttpClient ().newCall (
252268 new Request .Builder ().url (url ).get ().build ()).execute ();
253269 if (response .code () != 200 && response .code () != 204 ) {
0 commit comments