mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-23 05:57:21 +00:00
Merge branch 'master' into playlist
This commit is contained in:
commit
33c88a766e
@ -49,7 +49,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
channel: null,
|
channel: null,
|
||||||
subscribed: this.authenticated ? false : this.isSubscribedLocally(this.channelId),
|
subscribed: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -68,7 +68,11 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fetchSubscribedStatus() {
|
async fetchSubscribedStatus() {
|
||||||
if (!this.channelId || !this.authenticated) return;
|
if (!this.channel.id) return;
|
||||||
|
if (!this.authenticated) {
|
||||||
|
this.subscribed = this.isSubscribedLocally(this.channel.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.fetchJson(
|
this.fetchJson(
|
||||||
this.authApiUrl() + "/subscribed",
|
this.authApiUrl() + "/subscribed",
|
||||||
@ -94,7 +98,7 @@ export default {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
if (!this.channel.error) {
|
if (!this.channel.error) {
|
||||||
document.title = this.channel.name + " - Piped";
|
document.title = this.channel.name + " - Piped";
|
||||||
if (this.authenticated) this.fetchSubscribedStatus();
|
this.fetchSubscribedStatus();
|
||||||
this.updateWatched(this.channel.relatedStreams);
|
this.updateWatched(this.channel.relatedStreams);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -155,7 +155,7 @@ export default {
|
|||||||
importSubscriptionsLocally(newChannels) {
|
importSubscriptionsLocally(newChannels) {
|
||||||
const subscriptions = this.override
|
const subscriptions = this.override
|
||||||
? [...new Set(newChannels)]
|
? [...new Set(newChannels)]
|
||||||
: [...new Set(this.getLocalSubscriptions().concat(newChannels))];
|
: [...new Set((this.getLocalSubscriptions() ?? []).concat(newChannels))];
|
||||||
// Sort for better cache hits
|
// Sort for better cache hits
|
||||||
subscriptions.sort();
|
subscriptions.sort();
|
||||||
localStorage.setItem("localSubscriptions", JSON.stringify(subscriptions));
|
localStorage.setItem("localSubscriptions", JSON.stringify(subscriptions));
|
||||||
|
@ -85,7 +85,7 @@ export default {
|
|||||||
this.hotkeysPromise.then(() => {
|
this.hotkeysPromise.then(() => {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.$hotkeys(
|
this.$hotkeys(
|
||||||
"f,m,j,k,l,c,space,up,down,left,right,0,1,2,3,4,5,6,7,8,9,shift+,,shift+.",
|
"f,m,j,k,l,c,space,up,down,left,right,0,1,2,3,4,5,6,7,8,9,shift+n,shift+,,shift+.",
|
||||||
function (e, handler) {
|
function (e, handler) {
|
||||||
const videoEl = self.$refs.videoEl;
|
const videoEl = self.$refs.videoEl;
|
||||||
switch (handler.key) {
|
switch (handler.key) {
|
||||||
@ -171,6 +171,10 @@ export default {
|
|||||||
videoEl.currentTime = videoEl.duration * 0.9;
|
videoEl.currentTime = videoEl.duration * 0.9;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
break;
|
break;
|
||||||
|
case "shift+n":
|
||||||
|
self.navigateNext();
|
||||||
|
e.preventDefault();
|
||||||
|
break;
|
||||||
case "shift+,":
|
case "shift+,":
|
||||||
self.$player.trickPlay(Math.max(videoEl.playbackRate - 0.25, 0.25));
|
self.$player.trickPlay(Math.max(videoEl.playbackRate - 0.25, 0.25));
|
||||||
break;
|
break;
|
||||||
@ -225,8 +229,11 @@ export default {
|
|||||||
var request = store.get(this.video.id);
|
var request = store.get(this.video.id);
|
||||||
request.onsuccess = function (event) {
|
request.onsuccess = function (event) {
|
||||||
var video = event.target.result;
|
var video = event.target.result;
|
||||||
if (video?.currentTime) {
|
const currentTime = video?.currentTime;
|
||||||
videoEl.currentTime = video.currentTime;
|
if (currentTime) {
|
||||||
|
if (currentTime < component.video.duration * 0.9) {
|
||||||
|
videoEl.currentTime = currentTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -372,30 +379,12 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
videoEl.addEventListener("ended", () => {
|
videoEl.addEventListener("ended", () => {
|
||||||
if (!this.selectedAutoLoop && this.selectedAutoPlay && this.video.relatedStreams.length > 0) {
|
if (
|
||||||
const params = this.$route.query;
|
!this.selectedAutoLoop &&
|
||||||
let url = this.playlist?.relatedStreams?.[this.index]?.url ?? this.video.relatedStreams[0].url;
|
this.selectedAutoPlay &&
|
||||||
const searchParams = new URLSearchParams();
|
(this.playlist?.relatedStreams?.length > 0 || this.video.relatedStreams.length > 0)
|
||||||
for (var param in params)
|
) {
|
||||||
switch (param) {
|
this.navigateNext();
|
||||||
case "v":
|
|
||||||
case "t":
|
|
||||||
break;
|
|
||||||
case "index":
|
|
||||||
if (this.index < this.playlist.relatedStreams.length)
|
|
||||||
searchParams.set("index", this.index + 1);
|
|
||||||
break;
|
|
||||||
case "list":
|
|
||||||
if (this.index < this.playlist.relatedStreams.length)
|
|
||||||
searchParams.set("list", params.list);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
searchParams.set(param, params[param]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
const paramStr = searchParams.toString();
|
|
||||||
if (paramStr.length > 0) url += "&" + paramStr;
|
|
||||||
this.$router.push(url);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -558,6 +547,29 @@ export default {
|
|||||||
this.$refs.videoEl.currentTime = time;
|
this.$refs.videoEl.currentTime = time;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
navigateNext() {
|
||||||
|
const params = this.$route.query;
|
||||||
|
let url = this.playlist?.relatedStreams?.[this.index]?.url ?? this.video.relatedStreams[0].url;
|
||||||
|
const searchParams = new URLSearchParams();
|
||||||
|
for (var param in params)
|
||||||
|
switch (param) {
|
||||||
|
case "v":
|
||||||
|
case "t":
|
||||||
|
break;
|
||||||
|
case "index":
|
||||||
|
if (this.index < this.playlist.relatedStreams.length) searchParams.set("index", this.index + 1);
|
||||||
|
break;
|
||||||
|
case "list":
|
||||||
|
if (this.index < this.playlist.relatedStreams.length) searchParams.set("list", params.list);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
searchParams.set(param, params[param]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const paramStr = searchParams.toString();
|
||||||
|
if (paramStr.length > 0) url += "&" + paramStr;
|
||||||
|
this.$router.push(url);
|
||||||
|
},
|
||||||
updateMarkers() {
|
updateMarkers() {
|
||||||
const markers = this.$refs.container.querySelector(".shaka-ad-markers");
|
const markers = this.$refs.container.querySelector(".shaka-ad-markers");
|
||||||
const array = ["to right"];
|
const array = ["to right"];
|
||||||
|
@ -427,7 +427,10 @@ export default {
|
|||||||
},
|
},
|
||||||
async fetchSubscribedStatus() {
|
async fetchSubscribedStatus() {
|
||||||
if (!this.channelId) return;
|
if (!this.channelId) return;
|
||||||
if (!this.authenticated) this.subscribed = this.isSubscribedLocally(this.channelId);
|
if (!this.authenticated) {
|
||||||
|
this.subscribed = this.isSubscribedLocally(this.channelId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.fetchJson(
|
this.fetchJson(
|
||||||
this.authApiUrl() + "/subscribed",
|
this.authApiUrl() + "/subscribed",
|
||||||
|
@ -217,8 +217,8 @@ const mixin = {
|
|||||||
localStorage.setItem("localSubscriptions", JSON.stringify(localSubscriptions));
|
localStorage.setItem("localSubscriptions", JSON.stringify(localSubscriptions));
|
||||||
},
|
},
|
||||||
getUnauthenticatedChannels() {
|
getUnauthenticatedChannels() {
|
||||||
const localSubscriptions = this.getLocalSubscriptions();
|
const localSubscriptions = this.getLocalSubscriptions() ?? [];
|
||||||
return localSubscriptions != null ? localSubscriptions.join(",") : "";
|
return localSubscriptions.join(",");
|
||||||
},
|
},
|
||||||
/* generate a temporary file and ask the user to download it */
|
/* generate a temporary file and ask the user to download it */
|
||||||
download(text, filename, type) {
|
download(text, filename, type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user