summaryrefslogtreecommitdiff
path: root/ext/js/media/audio-downloader.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-05-22 15:45:20 -0400
committerGitHub <noreply@github.com>2021-05-22 15:45:20 -0400
commitd16739a83a20e1729e08dbcbbc155be15972d146 (patch)
treef7c12fa946a688750365ecf0f66227fcad4f927d /ext/js/media/audio-downloader.js
parentb48052ff320f1a68aac317158c4c757a70b14f04 (diff)
Json schema validation improvements (#1697)
* Create new JsonSchema class * Add proxy handler * Update tests * Update validation scripts * Update backend * Update audio downloader * Update options util * Update dictionary importer * Update json schema file reference * Remove old json-schema.js * Rename new json-schema.js * Update file names * Rename class
Diffstat (limited to 'ext/js/media/audio-downloader.js')
-rw-r--r--ext/js/media/audio-downloader.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/js/media/audio-downloader.js b/ext/js/media/audio-downloader.js
index 47cdaf13..577d1c1b 100644
--- a/ext/js/media/audio-downloader.js
+++ b/ext/js/media/audio-downloader.js
@@ -16,7 +16,7 @@
*/
/* global
- * JsonSchemaValidator
+ * JsonSchema
* NativeSimpleDOMParser
* SimpleDOMParser
*/
@@ -26,7 +26,7 @@ class AudioDownloader {
this._japaneseUtil = japaneseUtil;
this._requestBuilder = requestBuilder;
this._customAudioListSchema = null;
- this._schemaValidator = null;
+ this._customAudioListSchema = null;
this._getInfoHandlers = new Map([
['jpod101', this._getInfoJpod101.bind(this)],
['jpod101-alternate', this._getInfoJpod101Alternate.bind(this)],
@@ -222,11 +222,11 @@ class AudioDownloader {
const responseJson = await response.json();
- const schema = await this._getCustomAudioListSchema();
- if (this._schemaValidator === null) {
- this._schemaValidator = new JsonSchemaValidator();
+ if (this._customAudioListSchema === null) {
+ const schema = await this._getCustomAudioListSchema();
+ this._customAudioListSchema = new JsonSchema(schema);
}
- this._schemaValidator.validate(responseJson, schema);
+ this._customAudioListSchema.validate(responseJson);
const results = [];
for (const {url: url2, name} of responseJson.audioSources) {