mirror of https://github.com/calzoneman/sync.git
Accept #946
This commit is contained in:
parent
fd451fe9d2
commit
dcfcee9a23
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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}"`);
|
||||
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
Loading…
Reference in New Issue