Bump mediaquery

This commit is contained in:
Calvin Montgomery 2023-05-28 21:12:36 -07:00
parent 98bfb6736e
commit 6f47ed42db
2 changed files with 11 additions and 2 deletions

View File

@ -2,14 +2,14 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "3.85.1", "version": "3.86.0",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@calzoneman/jsli": "^2.0.1", "@calzoneman/jsli": "^2.0.1",
"@cytube/mediaquery": "github:CyTube/mediaquery#524bf009ab3d6527da89f0544d8dfd5afae99f9c", "@cytube/mediaquery": "github:CyTube/mediaquery#564d0c4615e80f72722b0f68ac81f837a4c5fc81",
"bcrypt": "^5.0.1", "bcrypt": "^5.0.1",
"bluebird": "^3.7.2", "bluebird": "^3.7.2",
"body-parser": "^1.20.1", "body-parser": "^1.20.1",

View File

@ -1287,6 +1287,11 @@ function playlistMove(from, after, cb) {
} }
} }
function checkYP(id) {
if (!/^(PL[a-zA-Z0-9_-]{32}|PL[A-F0-9]{16}|OLA[a-zA-Z0-9_-]{38})$/.test(id)) {
throw new Error('Invalid YouTube Playlist ID. Note that only regular user-created playlists are supported.');
}
}
function parseMediaLink(url) { function parseMediaLink(url) {
function parseShortCode(url){ function parseShortCode(url){
@ -1301,6 +1306,9 @@ function parseMediaLink(url) {
case 'fi': case 'fi':
case 'cm': case 'cm':
return { type, id }; return { type, id };
case 'yp':
checkYP(id);
return { type, id };
// Generic for the rest. // Generic for the rest.
default: default:
return { type, id: id.match(/([^\?&#]+)/)[1] }; return { type, id: id.match(/([^\?&#]+)/)[1] };
@ -1356,6 +1364,7 @@ function parseMediaLink(url) {
return { type: 'yt', id: data.pathname.slice(8,19) } return { type: 'yt', id: data.pathname.slice(8,19) }
} }
if(data.pathname == '/playlist'){ if(data.pathname == '/playlist'){
checkYP(data.searchParams.get('list'));
return { type: 'yp', id: data.searchParams.get('list') } return { type: 'yp', id: data.searchParams.get('list') }
} }
case 'youtu.be': case 'youtu.be':