Add support to Proxy LBRY and Disable LBRY.

Closes #403
Closes #402
This commit is contained in:
FireMasterK 2021-09-02 19:16:27 +05:30
parent a159ac30dd
commit 546dc6825a
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
3 changed files with 26 additions and 2 deletions

View File

@ -95,7 +95,9 @@ export default {
const MseSupport = window.MediaSource !== undefined;
const lbry = this.video.videoStreams.filter(stream => stream.quality === "LBRY")[0];
const lbry = this.getPreferenceBoolean("disableLBRY", false)
? null
: this.video.videoStreams.filter(stream => stream.quality === "LBRY")[0];
var uri;
@ -112,6 +114,12 @@ export default {
} else uri = this.video.dash;
} else if (lbry) {
uri = lbry.url;
if (this.getPreferenceBoolean("proxyLBRY", false)) {
const url = new URL(uri);
url.searchParams.set("host", url.host);
url.host = new URL(this.video.proxyUrl).host;
uri = url.toString();
}
} else {
uri = this.video.videoStreams.filter(stream => stream.codec == null).slice(-1)[0].url;
}

View File

@ -106,6 +106,14 @@
<option value="vp9">VP9</option>
<option value="avc">AVC (h.264)</option>
</select>
<br />
<b v-t="'actions.disable_lbry'" />
<br />
<input class="uk-checkbox" v-model="disableLBRY" @change="onChange($event)" type="checkbox" />
<br />
<b v-t="'actions.enable_lbry_proxy'" />
<br />
<input class="uk-checkbox" v-model="proxyLBRY" @change="onChange($event)" type="checkbox" />
<h2 v-t="'actions.instances_list'" />
<table class="uk-table">
<thead>
@ -181,6 +189,8 @@ export default {
{ code: "tr", name: "Turkish" },
],
enabledCodecs: ["av1", "vp9", "avc"],
disableLBRY: false,
proxyLBRY: false,
};
},
activated() {
@ -267,6 +277,8 @@ export default {
this.watchHistory = this.getPreferenceBoolean("watchHistory", false);
this.selectedLanguage = this.getPreferenceString("hl", "en");
this.enabledCodecs = this.getPreferenceString("enabledCodecs", "av1,vp9,avc").split(",");
this.disableLBRY = this.getPreferenceBoolean("disableLBRY", false);
this.proxyLBRY = this.getPreferenceBoolean("proxyLBRY", false);
}
},
methods: {
@ -307,6 +319,8 @@ export default {
localStorage.setItem("watchHistory", this.watchHistory);
localStorage.setItem("hl", this.selectedLanguage);
localStorage.setItem("enabledCodecs", this.enabledCodecs.join(","));
localStorage.setItem("disableLBRY", this.disableLBRY);
localStorage.setItem("proxyLBRY", this.proxyLBRY);
if (shouldReload) window.location.reload();
}

View File

@ -44,6 +44,8 @@
"store_watch_history": "Store Watch History",
"language_selection": "Language Selection",
"instances_list": "Instances List",
"enabled_codecs": "Enabled Codecs (Multiple)"
"enabled_codecs": "Enabled Codecs (Multiple)",
"disable_lbry": "Disable LBRY for Streaming",
"enable_lbry_proxy": "Enable Proxy for LBRY"
}
}