Update Github.java

pull/183/head
FongMi 3 years ago
parent 060726e5b5
commit 3f39c82dbf
  1. 7
      app/src/main/java/com/fongmi/android/tv/utils/Github.java

@ -13,8 +13,7 @@ import okhttp3.Response;
public class Github { public class Github {
public static final String A = "https://raw.githubusercontent.com/"; public static final String A = "https://raw.githubusercontent.com/";
public static final String B = "https://raw.iqiq.io/"; public static final String B = "https://ghproxy.com/";
public static final String C = "https://ghproxy.com/";
public static final String REPO = "FongMi/TV/"; public static final String REPO = "FongMi/TV/";
public static final String RELEASE = "release"; public static final String RELEASE = "release";
public static final String DEV = "dev"; public static final String DEV = "dev";
@ -34,7 +33,6 @@ public class Github {
client = OkHttp.client(Constant.TIMEOUT_GITHUB); client = OkHttp.client(Constant.TIMEOUT_GITHUB);
check(A); check(A);
check(B); check(B);
check(C);
} }
private void check(String url) { private void check(String url) {
@ -42,13 +40,12 @@ public class Github {
if (getProxy().length() > 0) return; if (getProxy().length() > 0) return;
Response response = OkHttp.newCall(client, url).execute(); Response response = OkHttp.newCall(client, url).execute();
if (response.code() == 200) setProxy(url); if (response.code() == 200) setProxy(url);
response.close();
} catch (IOException ignored) { } catch (IOException ignored) {
} }
} }
private void setProxy(String url) { private void setProxy(String url) {
this.proxy = url.equals(C) ? url + A + REPO : url + REPO; this.proxy = url.equals(B) ? url + A + REPO : url + REPO;
} }
private String getProxy() { private String getProxy() {

Loading…
Cancel
Save