From 6f47ed42dbd56a5ed50d9d80a2f658b9b6dc17d3 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sun, 28 May 2023 21:12:36 -0700 Subject: [PATCH] Bump mediaquery --- package.json | 4 ++-- www/js/util.js | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9c06d548..fcf013ab 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,14 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.85.1", + "version": "3.86.0", "repository": { "url": "http://github.com/calzoneman/sync" }, "license": "MIT", "dependencies": { "@calzoneman/jsli": "^2.0.1", - "@cytube/mediaquery": "github:CyTube/mediaquery#524bf009ab3d6527da89f0544d8dfd5afae99f9c", + "@cytube/mediaquery": "github:CyTube/mediaquery#564d0c4615e80f72722b0f68ac81f837a4c5fc81", "bcrypt": "^5.0.1", "bluebird": "^3.7.2", "body-parser": "^1.20.1", diff --git a/www/js/util.js b/www/js/util.js index 6d26eeff..df1509ec 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -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 parseShortCode(url){ @@ -1301,6 +1306,9 @@ function parseMediaLink(url) { case 'fi': case 'cm': return { type, id }; + case 'yp': + checkYP(id); + return { type, id }; // Generic for the rest. default: return { type, id: id.match(/([^\?&#]+)/)[1] }; @@ -1356,6 +1364,7 @@ function parseMediaLink(url) { return { type: 'yt', id: data.pathname.slice(8,19) } } if(data.pathname == '/playlist'){ + checkYP(data.searchParams.get('list')); return { type: 'yp', id: data.searchParams.get('list') } } case 'youtu.be':