Skip to content

Commit

Permalink
Accept #946
Browse files Browse the repository at this point in the history
  • Loading branch information
calzoneman committed May 18, 2022
1 parent fd451fe commit dcfcee9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "3.82.10",
"version": "3.82.11",
"repository": {
"url": "http://github.com/calzoneman/sync"
},
Expand Down
13 changes: 2 additions & 11 deletions src/custom-media.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ const SOURCE_CONTENT_TYPES = new Set([
'video/webm'
]);

const LIVE_ONLY_CONTENT_TYPES = new Set([
'application/dash+xml'
]);

export function lookup(url, opts) {
if (!opts) opts = {};
if (!opts.hasOwnProperty('timeout')) opts.timeout = 10000;
Expand Down Expand Up @@ -163,11 +159,11 @@ export function validate(data) {
validateURL(data.thumbnail);
}

validateSources(data.sources, data);
validateSources(data.sources);
validateTextTracks(data.textTracks);
}

function validateSources(sources, data) {
function validateSources(sources) {
if (!Array.isArray(sources))
throw new ValidationError('sources must be a list');
if (sources.length === 0)
Expand All @@ -183,11 +179,6 @@ function validateSources(sources, data) {
`unacceptable source contentType "${source.contentType}"`
);

if (LIVE_ONLY_CONTENT_TYPES.has(source.contentType) && !data.live)
throw new ValidationError(
`contentType "${source.contentType}" requires live: true`
);

if (!SOURCE_QUALITIES.has(source.quality))
throw new ValidationError(`unacceptable source quality "${source.quality}"`);

Expand Down
9 changes: 0 additions & 9 deletions test/custom-media.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ describe('custom-media', () => {
assert.throws(() => validate(invalid), /URL protocol must be HTTPS/);
});

it('rejects non-live DASH', () => {
invalid.live = false;
invalid.sources[0].contentType = 'application/dash+xml';

assert.throws(
() => validate(invalid),
/contentType "application\/dash\+xml" requires live: true/
);
});
});

describe('#validateSources', () => {
Expand Down

0 comments on commit dcfcee9

Please sign in to comment.