aboutsummaryrefslogtreecommitdiffstats
path: root/src/assets/javascripts/peertube.js
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2022-06-23 08:34:57 +0300
committerManeraKai <manerakai@protonmail.com>2022-06-23 08:34:57 +0300
commit1d0111201b285918583eb5e95b68c5dfd17644c0 (patch)
treeb0fdb7a08386da1092d60f22626d50c274c9c5a5 /src/assets/javascripts/peertube.js
parentMerge branch 'master' of https://github.com/libredirect/libredirect (diff)
downloadlibredirect-1d0111201b285918583eb5e95b68c5dfd17644c0.zip
Made frontend icon appear if the current site is surpports it
Diffstat (limited to 'src/assets/javascripts/peertube.js')
-rw-r--r--src/assets/javascripts/peertube.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/assets/javascripts/peertube.js b/src/assets/javascripts/peertube.js
index 900048f7..8b7414e8 100644
--- a/src/assets/javascripts/peertube.js
+++ b/src/assets/javascripts/peertube.js
@@ -82,8 +82,8 @@ function all() {
];
}
-function redirect(url, type, initiator) {
- if (disablePeertubeTargets) return;
+function redirect(url, type, initiator, disableOverride) {
+ if (disablePeertubeTargets && !disableOverride) return;
if (initiator && (all().includes(initiator.origin) || peerTubeTargets.includes(initiator.host))) return;
let protocolHost = utils.protocolHost(url);
if (!peerTubeTargets.includes(protocolHost)) return;
@@ -99,9 +99,10 @@ function redirect(url, type, initiator) {
return `${randomInstance}/${url.host}${url.pathname}${url.search}`;
}
-function switchInstance(url) {
+function switchInstance(url, disableOverride) {
return new Promise(async resolve => {
await init();
+ if (disablePeertubeTargets && !disableOverride) { resolve(); return; }
const protocolHost = utils.protocolHost(url);
if (!all().includes(protocolHost)) { resolve(); return; }