pull/210/head
FongMi 2 years ago
parent 5f25719078
commit 2a15654304
  1. BIN
      app/src/main/assets/favicon.ico
  2. 2
      app/src/main/assets/js/script.js
  3. 4
      app/src/main/java/com/fongmi/android/tv/api/LiveParser.java
  4. 4
      app/src/main/java/com/fongmi/android/tv/api/config/VodConfig.java
  5. 2
      app/src/main/java/com/fongmi/android/tv/server/process/Local.java
  6. 7
      app/src/main/java/com/fongmi/android/tv/utils/UrlUtil.java
  7. 2
      app/src/mobile/java/com/fongmi/android/tv/ui/dialog/CastDialog.java
  8. 2
      catvod/src/main/java/com/github/catvod/net/OkhttpInterceptor.java

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -90,7 +90,7 @@ function hideFileInfo() {
function listFile(path) {
$('#loadingToast').show();
$.get('/file/' + path, function (res) {
$.get('/file' + path, function (res) {
let info = JSON.parse(res);
let parent = info.parent;
let canDel = info.parent != '.';

@ -36,7 +36,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(UrlUtil.convert(live.getUrl())));
if (live.getType() == 2) proxy(live, getText(live.getUrl()));
}
public static void text(Live live, String text) {
@ -114,7 +114,7 @@ public class LiveParser {
private static String getText(String url) {
if (url.startsWith("file")) return Path.read(url);
if (url.startsWith("http")) return OkHttp.string(url);
if (url.startsWith("assets")) return getText(UrlUtil.convert(url));
if (url.startsWith("assets") || url.startsWith("proxy")) return getText(UrlUtil.convert(url));
if (url.length() > 0 && url.length() % 4 == 0) return getText(new String(Base64.decode(url, Base64.DEFAULT)));
return "";
}

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

@ -42,7 +42,7 @@ public class Local implements Process {
private NanoHTTPD.Response getFile(Map<String, String> headers, String path) {
try {
File file = Path.root(path.substring(6));
File file = Path.root(path.substring(5));
if (file.isDirectory()) return getFolder(file);
if (file.isFile()) return getFile(headers, file, NanoHTTPD.getMimeTypeForFile(path));
throw new FileNotFoundException();

@ -35,11 +35,10 @@ public class UrlUtil {
}
public static String convert(String url) {
String host = host(url);
String scheme = scheme(url);
if ("file".equals(scheme)) return Server.get().getAddress(url);
if ("local".equals(scheme)) return Server.get().getAddress(host);
if ("assets".equals(scheme)) return Server.get().getAddress(url.substring(9));
if ("local".equals(scheme)) return Server.get().getAddress(host(url));
if ("assets".equals(scheme)) return url.replace("assets://", Server.get().getAddress(""));
if ("file".equals(scheme)) return url.replace("file://", Server.get().getAddress("file/"));
if ("proxy".equals(scheme)) return url.replace("proxy://", Server.get().getAddress("proxy?"));
return url;
}

@ -76,7 +76,7 @@ public class CastDialog extends BaseDialog implements DeviceAdapter.OnClickListe
public CastDialog history(History history) {
String id = history.getVodId();
String fd = history.getVodId();
if (fd.startsWith("/")) fd = Server.get().getAddress() + "/file://" + fd.replace(Path.rootPath(), "");
if (fd.startsWith("/")) fd = Server.get().getAddress() + "/file/" + fd.replace(Path.rootPath(), "");
if (fd.startsWith("file")) fd = Server.get().getAddress() + "/" + fd.replace(Path.rootPath(), "");
if (fd.contains("127.0.0.1")) fd = fd.replace("127.0.0.1", Util.getIp());
body.add("history", history.toString().replace(id, fd));

@ -51,7 +51,7 @@ public class OkhttpInterceptor implements Interceptor {
Request request = chain.request();
String url = request.url().toString();
Request.Builder builder = request.newBuilder();
if (url.contains("/file://")) builder.url(url.replace("+", "%2B"));
if (url.contains("/file/")) builder.url(url.replace("+", "%2B"));
if (url.contains("gitcode.net")) builder.addHeader(HttpHeaders.USER_AGENT, Util.CHROME);
return builder.build();
}

Loading…
Cancel
Save