Delete fallback url (#2283)
This commit is contained in:
parent
66a20e2275
commit
2b2bd66bb5
|
|
@ -76,9 +76,7 @@ public class RepoLoader {
|
||||||
private final Path repoFile = Paths.get(App.getInstance().getFilesDir().getAbsolutePath(), "repo.json");
|
private final Path repoFile = Paths.get(App.getInstance().getFilesDir().getAbsolutePath(), "repo.json");
|
||||||
private final Set<RepoListener> listeners = ConcurrentHashMap.newKeySet();
|
private final Set<RepoListener> listeners = ConcurrentHashMap.newKeySet();
|
||||||
private boolean repoLoaded = false;
|
private boolean repoLoaded = false;
|
||||||
private static final String originRepoUrl = "https://modules.lsposed.org/";
|
private static final String repoUrl = "https://modules.lsposed.org/";
|
||||||
private static final String backupRepoUrl = "https://cdn.jsdelivr.net/gh/Xposed-Modules-Repo/modules@gh-pages/";
|
|
||||||
private static String repoUrl = originRepoUrl;
|
|
||||||
private final Resources resources = App.getInstance().getResources();
|
private final Resources resources = App.getInstance().getResources();
|
||||||
private final String[] channels = resources.getStringArray(R.array.update_channel_values);
|
private final String[] channels = resources.getStringArray(R.array.update_channel_values);
|
||||||
|
|
||||||
|
|
@ -96,8 +94,8 @@ public class RepoLoader {
|
||||||
|
|
||||||
synchronized public void loadRemoteData() {
|
synchronized public void loadRemoteData() {
|
||||||
repoLoaded = false;
|
repoLoaded = false;
|
||||||
try {
|
var request = new Request.Builder().url(repoUrl + "modules.json").build();
|
||||||
var response = App.getOkHttpClient().newCall(new Request.Builder().url(repoUrl + "modules.json").build()).execute();
|
try (var response = App.getOkHttpClient().newCall(request).execute()) {
|
||||||
|
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
ResponseBody body = response.body();
|
ResponseBody body = response.body();
|
||||||
|
|
@ -119,10 +117,6 @@ public class RepoLoader {
|
||||||
for (RepoListener listener : listeners) {
|
for (RepoListener listener : listeners) {
|
||||||
listener.onThrowable(e);
|
listener.onThrowable(e);
|
||||||
}
|
}
|
||||||
if (!repoUrl.equals(backupRepoUrl)) {
|
|
||||||
repoUrl = backupRepoUrl;
|
|
||||||
loadRemoteData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -246,13 +240,8 @@ public class RepoLoader {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call call, @NonNull IOException e) {
|
public void onFailure(@NonNull Call call, @NonNull IOException e) {
|
||||||
Log.e(App.TAG, call.request().url() + e.getMessage());
|
Log.e(App.TAG, call.request().url() + e.getMessage());
|
||||||
if (!repoUrl.equals(backupRepoUrl)) {
|
for (RepoListener listener : listeners) {
|
||||||
repoUrl = backupRepoUrl;
|
listener.onThrowable(e);
|
||||||
loadRemoteReleases(packageName);
|
|
||||||
} else {
|
|
||||||
for (RepoListener listener : listeners) {
|
|
||||||
listener.onThrowable(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue