mkv fix
This commit is contained in:
parent
3a47f02a24
commit
f227137650
@ -859,7 +859,7 @@ public final class XtreamPlayerApplication {
|
|||||||
));
|
));
|
||||||
copyRequestHeaderIfPresent(exchange, requestBuilder, "Range");
|
copyRequestHeaderIfPresent(exchange, requestBuilder, "Range");
|
||||||
copyRequestHeaderIfPresent(exchange, requestBuilder, "If-Range");
|
copyRequestHeaderIfPresent(exchange, requestBuilder, "If-Range");
|
||||||
String referer = resolveRefererForCandidate(candidate, sourceUrl);
|
String referer = resolveRefererForCandidate(exchange, candidate, sourceUrl);
|
||||||
if (!referer.isBlank()) {
|
if (!referer.isBlank()) {
|
||||||
requestBuilder.header("Referer", referer);
|
requestBuilder.header("Referer", referer);
|
||||||
String origin = originFromUrl(referer);
|
String origin = originFromUrl(referer);
|
||||||
@ -871,8 +871,14 @@ public final class XtreamPlayerApplication {
|
|||||||
return HTTP_CLIENT.send(request, HttpResponse.BodyHandlers.ofByteArray());
|
return HTTP_CLIENT.send(request, HttpResponse.BodyHandlers.ofByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String resolveRefererForCandidate(URI candidate, String sourceUrl) {
|
private static String resolveRefererForCandidate(HttpExchange exchange, URI candidate, String sourceUrl) {
|
||||||
URI candidateDir = directoryUri(candidate);
|
URI candidateDir = directoryUri(candidate);
|
||||||
|
if (sourceUrl == null || sourceUrl.isBlank()) {
|
||||||
|
String appReferer = appRefererFromExchange(exchange);
|
||||||
|
if (!appReferer.isBlank()) {
|
||||||
|
return appReferer;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (candidateDir != null) {
|
if (candidateDir != null) {
|
||||||
String path = candidateDir.getPath() == null ? "" : candidateDir.getPath().toLowerCase(Locale.ROOT);
|
String path = candidateDir.getPath() == null ? "" : candidateDir.getPath().toLowerCase(Locale.ROOT);
|
||||||
if (path.contains("/hls/")) {
|
if (path.contains("/hls/")) {
|
||||||
@ -885,6 +891,18 @@ public final class XtreamPlayerApplication {
|
|||||||
return candidateDir == null ? "" : candidateDir.toString();
|
return candidateDir == null ? "" : candidateDir.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String appRefererFromExchange(HttpExchange exchange) {
|
||||||
|
String proto = exchange.getRequestHeaders().getFirst("X-Forwarded-Proto");
|
||||||
|
if (proto == null || proto.isBlank()) {
|
||||||
|
proto = "http";
|
||||||
|
}
|
||||||
|
String host = exchange.getRequestHeaders().getFirst("Host");
|
||||||
|
if (host == null || host.isBlank()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return proto + "://" + host + "/";
|
||||||
|
}
|
||||||
|
|
||||||
private static URI directoryUri(URI uri) {
|
private static URI directoryUri(URI uri) {
|
||||||
if (uri == null || uri.getScheme() == null || uri.getRawAuthority() == null) {
|
if (uri == null || uri.getScheme() == null || uri.getRawAuthority() == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user