From 394f03ee1c6ddea2d24f14dd23b89124bc1deefb Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Thu, 19 Aug 2021 20:44:57 -0700 Subject: [PATCH] Remove some legacy cruft --- package.json | 2 +- player/embed.coffee | 19 +------------------ player/livestream.com.coffee | 21 +++++++-------------- src/channel/playlist.js | 6 +++++- src/get-info.js | 17 ----------------- src/utilities.js | 12 +----------- www/js/util.js | 28 ---------------------------- 7 files changed, 15 insertions(+), 90 deletions(-) diff --git a/package.json b/package.json index fb3858d6..cf0ec84b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.81.0", + "version": "3.82.0", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/player/embed.coffee b/player/embed.coffee index 8ff6c48a..e3542986 100644 --- a/player/embed.coffee +++ b/player/embed.coffee @@ -24,27 +24,10 @@ window.EmbedPlayer = class EmbedPlayer extends Player console.error('EmbedPlayer::load(): missing meta.embed') return - if embed.tag == 'object' - @player = @loadObject(embed) - else - @player = @loadIframe(embed) + @player = @loadIframe(embed) removeOld(@player) - loadObject: (embed) -> - object = $('').attr( - type: 'application/x-shockwave-flash' - data: embed.src - wmode: 'opaque' - ) - genParam('allowfullscreen', 'true').appendTo(object) - genParam('allowscriptaccess', 'always').appendTo(object) - - for key, value of embed.params - genParam(key, value).appendTo(object) - - return object - loadIframe: (embed) -> if embed.src.indexOf('http:') == 0 and location.protocol == 'https:' if @__proto__.mixedContentError? diff --git a/player/livestream.com.coffee b/player/livestream.com.coffee index 3dbad45e..8d121f96 100644 --- a/player/livestream.com.coffee +++ b/player/livestream.com.coffee @@ -6,18 +6,11 @@ window.LivestreamPlayer = class LivestreamPlayer extends EmbedPlayer @load(data) load: (data) -> - if LIVESTREAM_CHROMELESS - data.meta.embed = - src: 'https://cdn.livestream.com/chromelessPlayer/v20/playerapi.swf' - tag: 'object' - params: - flashvars: "channel=#{data.id}" - else - data.meta.embed = - src: "https://cdn.livestream.com/embed/#{data.id}?\ - layout=4&\ - color=0x000000&\ - iconColorOver=0xe7e7e7&\ - iconColor=0xcccccc" - tag: 'iframe' + data.meta.embed = + src: "https://cdn.livestream.com/embed/#{data.id}?\ + layout=4&\ + color=0x000000&\ + iconColorOver=0xe7e7e7&\ + iconColor=0xcccccc" + tag: 'iframe' super(data) diff --git a/src/channel/playlist.js b/src/channel/playlist.js index 7cc0146c..649e4912 100644 --- a/src/channel/playlist.js +++ b/src/channel/playlist.js @@ -158,15 +158,19 @@ PlaylistModule.prototype.load = function (data) { } } else if (item.media.type === "gd") { delete item.media.meta.gpdirect; - } else if (["vm", "jw", "mx"].includes(item.media.type)) { + } else if (["vm", "jw", "mx", "im"].includes(item.media.type)) { // JW has been deprecated for a long time // VM shut down in December 2017 // Mixer shut down in July 2020 + // Dunno when imgur album embeds stopped working but they don't work either LOGGER.warn( "Dropping playlist item with deprecated type %s", item.media.type ); return; + } else if (item.media.meta.embed && item.media.meta.embed.tag !== 'iframe') { + LOGGER.warn("Dropping playlist item with flash embed"); + return; } var m = new Media(item.media.id, item.media.title, item.media.seconds, diff --git a/src/get-info.js b/src/get-info.js index 967d4f56..be79ddfb 100644 --- a/src/get-info.js +++ b/src/get-info.js @@ -340,23 +340,6 @@ var Getters = { callback(false, media); }, - /* imgur.com albums */ - im: function (id, callback) { - /** - * TODO: Consider deprecating this in favor of custom embeds - */ - var m = id.match(/([\w-]+)/); - if (m) { - id = m[1]; - } else { - callback("Invalid ID", null); - return; - } - var title = "Imgur Album - " + id; - var media = new Media(id, title, "--:--", "im"); - callback(false, media); - }, - /* custom embed */ cu: function (id, callback) { var media; diff --git a/src/utilities.js b/src/utilities.js index 485ae238..7561f897 100644 --- a/src/utilities.js +++ b/src/utilities.js @@ -177,7 +177,7 @@ }; }, - root.formatLink = function (id, type, meta) { + root.formatLink = function (id, type, _meta) { switch (type) { case "yt": return "https://youtu.be/" + id; @@ -193,8 +193,6 @@ return "https://twitch.tv/" + id; case "rt": return id; - case "im": - return "https://imgur.com/a/" + id; case "us": return "https://ustream.tv/channel/" + id; case "gd": @@ -211,12 +209,6 @@ return "https://clips.twitch.tv/" + id; case "cm": return id; - case "mx": - if (meta !== null) { - return `https://mixer.com/${meta.mixer.channelToken}`; - } else { - return `https://mixer.com/${id}`; - } default: return ""; } @@ -229,10 +221,8 @@ case "us": case "rt": case "cu": - case "im": case "hb": case "hl": - case "mx": return true; default: return false; diff --git a/www/js/util.js b/www/js/util.js index 6f77d97f..b5c6d21a 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -38,8 +38,6 @@ function formatURL(data) { return "https://twitch.tv/" + data.id; case "rt": return data.id; - case "im": - return "https://imgur.com/a/" + data.id; case "us": return "https://ustream.tv/channel/" + data.id; case "gd": @@ -56,8 +54,6 @@ function formatURL(data) { return "https://clips.twitch.tv/" + data.id; case "cm": return data.id; - case "mx": - return "https://mixer.com/" + data.meta.mixer.channelToken; default: return "#"; } @@ -1401,13 +1397,6 @@ function parseMediaLink(url) { }; } - if((m = url.match(/imgur\.com\/a\/([^\?&#]+)/))) { - return { - id: m[1], - type: "im" - }; - } - if((m = url.match(/soundcloud\.com\/([^\?&#]+)/))) { return { id: url, @@ -1423,15 +1412,6 @@ function parseMediaLink(url) { }; } - // Deprecated as of December 2017 - if ((m = url.match(/vid\.me\/embedded\/([\w-]+)/)) || - (m = url.match(/vid\.me\/([\w-]+)/))) { - return { - id: m[1], - type: "vm" - }; - } - if ((m = url.match(/(.*\.m3u8)/))) { return { id: url, @@ -1446,14 +1426,6 @@ function parseMediaLink(url) { }; } - // Deprecated as of July 2020 - if ((m = url.match(/\bmixer\.com\/([\w-]+)/))) { - return { - id: m[1], - type: "mx" - }; - } - /* Shorthand URIs */ // So we still trim DailyMotion URLs if((m = url.match(/^dm:([^\?&#_]+)/))) {