mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-23 14:07:24 +00:00
use regex
This commit is contained in:
parent
6c3eb2304d
commit
c92eb10a86
@ -62,9 +62,10 @@ export default {
|
|||||||
getRssUrl: _this => {
|
getRssUrl: _this => {
|
||||||
return _this.authApiUrl() + "/rss/playlists/" + _this.$route.query.list;
|
return _this.authApiUrl() + "/rss/playlists/" + _this.$route.query.list;
|
||||||
},
|
},
|
||||||
isPipedPlaylist() {
|
isPipedPlaylist: _this => {
|
||||||
// FIXME: this checks whether it's a YouTube or a Piped playlist
|
// regex to determine whether it's a Piped plalylist
|
||||||
return this.$route.query.list.includes("-");
|
const regex = new RegExp("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}");
|
||||||
|
return regex.test(_this.$route.query.list);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -117,14 +118,13 @@ export default {
|
|||||||
this.playlist.relatedStreams.splice(index, 1);
|
this.playlist.relatedStreams.splice(index, 1);
|
||||||
},
|
},
|
||||||
async clonePlaylist() {
|
async clonePlaylist() {
|
||||||
const playlistId = this.$route.query.list;
|
|
||||||
this.fetchJson(this.authApiUrl() + "/import/playlist", null, {
|
this.fetchJson(this.authApiUrl() + "/import/playlist", null, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: this.getAuthToken(),
|
Authorization: this.getAuthToken(),
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
playlistId: playlistId,
|
playlistId: this.$route.query.list,
|
||||||
}),
|
}),
|
||||||
}).then(resp => {
|
}).then(resp => {
|
||||||
if (!resp.error) {
|
if (!resp.error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user