remove port, add protocol, fix pathname

This commit is contained in:
Andrea Spacca 2021-11-17 16:02:29 +01:00
parent 613bd250fd
commit bcba7cd488

View file

@ -187,13 +187,11 @@ export default {
if (this.getPreferenceBoolean("proxyLBRY", false)) { if (this.getPreferenceBoolean("proxyLBRY", false)) {
const url = new URL(uri); const url = new URL(uri);
const proxyURL = new URL(this.video.proxyUrl); const proxyURL = new URL(this.video.proxyUrl);
const proxyPath = proxyURL.pathname === "/" ? "" : proxyURL.pathname;
url.searchParams.set("host", url.host); url.searchParams.set("host", url.host);
url.port = proxyURL.port; url.protocol = proxyURL.protocol;
url.host = proxyURL.host; url.host = proxyURL.host;
url.pathname = proxyURL.pathname + url.pathname; url.pathname = proxyPath + url.pathname;
console.log(proxyURL.host);
console.log(url.host);
console.log(proxyURL.pathname);
uri = url.toString(); uri = url.toString();
} }
const contentType = await fetch(uri, { const contentType = await fetch(uri, {
@ -214,6 +212,7 @@ export default {
const localPlayer = new this.shaka.Player(videoEl); const localPlayer = new this.shaka.Player(videoEl);
const proxyURL = new URL(component.video.proxyUrl); const proxyURL = new URL(component.video.proxyUrl);
const proxyPath = proxyURL.pathname === "/" ? "" : proxyURL.pathname;
localPlayer.getNetworkingEngine().registerRequestFilter((_type, request) => { localPlayer.getNetworkingEngine().registerRequestFilter((_type, request) => {
const uri = request.uris[0]; const uri = request.uris[0];
@ -225,12 +224,9 @@ export default {
(component.getPreferenceBoolean("proxyLBRY", false) || headers.Range)) (component.getPreferenceBoolean("proxyLBRY", false) || headers.Range))
) { ) {
url.searchParams.set("host", url.host); url.searchParams.set("host", url.host);
url.port = proxyURL.port; url.protocol = proxyURL.protocol;
url.host = proxyURL.host; url.host = proxyURL.host;
url.pathname = proxyURL.pathname + url.pathname; url.pathname = proxyPath + url.pathname;
console.log(proxyURL.host);
console.log(url.host);
console.log(proxyURL.pathname);
request.uris[0] = url.toString(); request.uris[0] = url.toString();
} }
if (url.pathname === proxyURL.pathname + "/videoplayback") { if (url.pathname === proxyURL.pathname + "/videoplayback") {