diff --git a/ext/info.html b/ext/info.html index 8fb48499..d3da035f 100644 --- a/ext/info.html +++ b/ext/info.html @@ -48,7 +48,7 @@
  • Information and downloadable dictionaries: Homepage
  • Support and source code: Github
  • Release notes: This version | All versions
  • -
  • More extension information: Permissions | Licenses
  • +
  • More extension information: Permissions | Licenses | Issues
  • diff --git a/ext/issues.html b/ext/issues.html new file mode 100644 index 00000000..4d74ae76 --- /dev/null +++ b/ext/issues.html @@ -0,0 +1,59 @@ + + + + + + Yomichan Issues + + + + + + + + + + + + + +
    +
    +
    + + + +

    Yomichan Issues

    + +

    Audio download failed due to possible extension permissions error (Chrome)

    +
    +
    +

    + Depending on the extension's configuration, Yomichan can sometimes run into issues with + downloading audio files while creating Anki cards. + This may be due to a permissions issue where Yomichan hasn't been granted access to + the sites hosting the audio files. +

    +

    + Check the Site access section of the + extension settings pages + and grant the extension access to all sites or add the specific audio host URLs. +

    +
    +
    + + + +
    +
    +
    + + + + + + + + + + diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index c0f286f8..cff8a586 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -1909,7 +1909,10 @@ class Backend { // The message logged to the console looks like this: // Access to fetch at '' from origin 'chrome-extension://' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. const result = new Error('Audio download failed due to possible extension permissions error'); - result.data = {errors}; + result.data = { + errors, + referenceUrl: '/issues.html' + }; return result; } } diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js index 3fabdbb0..95080e27 100644 --- a/ext/js/display/display-generator.js +++ b/ext/js/display/display-generator.js @@ -220,7 +220,23 @@ class DisplayGenerator { for (const error of errors) { const div = document.createElement('li'); div.className = 'anki-note-error-message'; - this._setTextContent(div, isObject(error) && typeof error.message === 'string' ? error.message : `${error}`); + let message = isObject(error) && typeof error.message === 'string' ? error.message : `${error}`; + let link = null; + if (isObject(error) && isObject(error.data)) { + const {referenceUrl} = error.data; + if (typeof referenceUrl === 'string') { + message = message.trimEnd(); + if (!/[.!?]^/.test()) { message += '.'; } + message += ' '; + link = document.createElement('a'); + link.href = referenceUrl; + link.target = '_blank'; + link.rel = 'noreferrer noopener'; + link.textContent = 'More info'; + } + } + this._setTextContent(div, message); + if (link !== null) { div.appendChild(link); } list.appendChild(div); }