diff --git a/.gitignore b/.gitignore index 4b30afdb..2428fe8b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ integration-test-config.json conf/*.toml www/js/cytube-google-drive.user.js www/js/cytube-google-drive.meta.js +www/js/player.js +tor-exit-list.json diff --git a/package.json b/package.json index 5e4a39c8..6194bf28 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.52.0", + "version": "3.52.1", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/player/ustream.coffee b/player/ustream.coffee index f68ab142..1ec899bb 100644 --- a/player/ustream.coffee +++ b/player/ustream.coffee @@ -8,5 +8,5 @@ window.UstreamPlayer = class UstreamPlayer extends EmbedPlayer load: (data) -> data.meta.embed = tag: 'iframe' - src: "/ustream_bypass/embed/#{data.id}?html5ui&autoplay=1" + src: "https://www.ustream.tv/embed/#{data.id}?html5ui" super(data) diff --git a/src/web/routes/ustream_bypass.js b/src/web/routes/ustream_bypass.js deleted file mode 100644 index 111ba8d2..00000000 --- a/src/web/routes/ustream_bypass.js +++ /dev/null @@ -1,54 +0,0 @@ -import { HTTPError } from '../../errors'; -import * as HTTPStatus from '../httpstatus'; -import https from 'https'; -import Promise from 'bluebird'; - -const INJECTION = ` - - `; - -function ustreamSucks(channelId) { - const url = `https://www.ustream.tv/embed/${channelId}`; - return new Promise((resolve, reject) => { - const req = https.get(url, (res) => { - if (res.statusCode !== HTTPStatus.OK) { - res.resume(); - return reject(new HTTPError(res.statusMessage, { status: res.statusCode })); - } - - res.setEncoding('utf8'); - let buffer = ''; - res.on('data', data => buffer += data); - res.on('end', () => { - buffer = buffer.replace(//, INJECTION); - resolve(buffer); - }); - }); - - req.on('error', error => { - reject(error); - }); - }); -} - -export default function initialize(app) { - app.get('/ustream_bypass/embed/:channelId', (req, res) => { - if (!req.params.channelId || !/^\d+$/.test(req.params.channelId)) { - throw new HTTPError(`Invalid channel ID "${req.params.channelId}".`, { - status: HTTPStatus.BAD_REQUEST - }); - } - - ustreamSucks(req.params.channelId).then(buffer => { - res.type('html').send(buffer); - }).catch(HTTPError, error => { - res.status(error.status).send(error.message); - }).catch(error => { - res.status(HTTPStatus.INTERNAL_SERVER_ERROR).send('Internal Server Error'); - }); - }); -}; diff --git a/src/web/webserver.js b/src/web/webserver.js index 3f761463..298ddc51 100644 --- a/src/web/webserver.js +++ b/src/web/webserver.js @@ -208,7 +208,6 @@ module.exports = { require('./acp').init(app, ioConfig); require('../google2vtt').attach(app); require('./routes/google_drive_userscript')(app); - require('./routes/ustream_bypass')(app); if (process.env.UNFINISHED_FEATURE) { const { AccountDataRoute } = require('./routes/account/data'); diff --git a/www/js/util.js b/www/js/util.js index 282d969b..36c2d353 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -3226,6 +3226,13 @@ function startQueueSpinner(data) { } function stopQueueSpinner(data) { + // TODO: this is a temp hack, need to replace media ID check with + // a passthrough request ID (since media ID from API is not necessarily + // the same as the URL "ID" from the user) + if (data.type === "us") { + data = { id: data.title.match(/Ustream.tv - (.*)/)[1] }; + } + var shouldRemove = (data !== null && typeof data === 'object' && $("#queueprogress").data("queue-id") === data.id);