support clan://localhost/

pull/344/head
okjack 2 years ago
parent e70f56fde0
commit 7895837795
  1. 2
      app/src/main/java/com/fongmi/android/tv/api/LiveParser.java
  2. 4
      app/src/main/java/com/fongmi/android/tv/api/config/VodConfig.java
  3. 2
      app/src/main/java/com/fongmi/android/tv/api/loader/JarLoader.java
  4. 3
      app/src/main/java/com/fongmi/android/tv/bean/Depot.java
  5. 7
      app/src/main/java/com/fongmi/android/tv/utils/UrlUtil.java

@ -35,7 +35,7 @@ public class LiveParser {
if (live.getGroups().size() > 0) return;
if (live.getType() == 0) text(live, getText(live.getUrl()));
if (live.getType() == 1) json(live, getText(live.getUrl()));
if (live.getType() == 2) proxy(live, getText(live.getUrl()));
if (live.getType() == 2) proxy(live, getText(UrlUtil.convert(live.getUrl())));
}
public static void text(Live live, String text) {

@ -219,12 +219,12 @@ public class VodConfig {
}
private String parseApi(String api) {
if (api.startsWith("file") || api.startsWith("assets")) return UrlUtil.convert(api);
if (api.startsWith("file") || api.startsWith("clan") || api.startsWith("assets")) return UrlUtil.convert(api);
return api;
}
private String parseExt(String ext) {
if (ext.startsWith("file") || ext.startsWith("assets")) return UrlUtil.convert(ext);
if (ext.startsWith("file") || ext.startsWith("clan") || ext.startsWith("assets")) return UrlUtil.convert(ext);
if (ext.startsWith("img+")) return Decoder.getExt(ext);
return ext;
}

@ -95,6 +95,8 @@ public class JarLoader {
load(key, Path.local(jar));
} else if (jar.startsWith("assets")) {
parseJar(key, UrlUtil.convert(jar));
} else if (!jar.isEmpty()) {
parseJar(key, UrlUtil.convert(jar));
}
}

@ -3,6 +3,7 @@ package com.fongmi.android.tv.bean;
import android.text.TextUtils;
import com.fongmi.android.tv.App;
import com.fongmi.android.tv.utils.UrlUtil;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
@ -24,7 +25,7 @@ public class Depot {
}
public String getUrl() {
return TextUtils.isEmpty(url) ? "" : url;
return TextUtils.isEmpty(url) ? "" : UrlUtil.fixUrl(url);
}
public String getName() {

@ -36,6 +36,7 @@ public class UrlUtil {
public static String convert(String url) {
String scheme = scheme(url);
if ("clan".equals(scheme)) fixUrl(url);
if ("local".equals(scheme)) return url.replace("local://", Server.get().getAddress(""));
if ("assets".equals(scheme)) return url.replace("assets://", Server.get().getAddress(""));
if ("file".equals(scheme)) return url.replace("file://", Server.get().getAddress("file/"));
@ -43,6 +44,12 @@ public class UrlUtil {
return url;
}
public static String fixUrl(String url) {
if (url.contains("/localhost/")) url = url.replace("/localhost/", "/");
if (url.startsWith("clan")) url = url.replace("clan", "file");
return url;
}
public static String fixHeader(String key) {
if (key.equalsIgnoreCase(HttpHeaders.USER_AGENT)) return HttpHeaders.USER_AGENT;
if (key.equalsIgnoreCase(HttpHeaders.REFERER)) return HttpHeaders.REFERER;

Loading…
Cancel
Save