themoeway / yomitan

Japanese pop-up dictionary browser extension. Successor to Yomichan.
https://chromewebstore.google.com/detail/yomitan/likgccmbimhjbgkjambclfkhldnlhbnn
GNU General Public License v3.0
989 stars 76 forks source link

Two RequestInit errors related to audio on lookups #204

Closed Gin-no-kami closed 8 months ago

Gin-no-kami commented 11 months ago

Description Yomitan is generating errors in various audio related cases. The sentence that I am working with is 試合を有利に進められるはず and I am trying to add a card for the word 有利.

1) Attempt to play audio through a custom source (local-audio-yomichan). I confirmed that the server is working correctly by manually creating the link that yomitan would generate. However when I click the audio button in yomitan the following error is created in devtools :

Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': The provided value is not of type 'RequestInit'.
    at RequestBuilder.fetchAnonymous (request-builder.js:57:9)
    at AudioDownloader._getInfoCustomJson (audio-downloader.js:208:53)
    at AudioDownloader.getTermAudioInfoList (audio-downloader.js:47:30)
    at Backend._onApiGetTermAudioInfoList (backend.js:561:44)
    at invokeMessageHandler (core.js:367:31)
    at Backend._onMessage (backend.js:331:16)
    at Backend._onMessageWrapper (backend.js:302:25)

I have JapanesePod101 + Alternate as the second and third options but yomitan seems to error our before them and doesn't move on to the later options.

2) Now after deleting the custom source, I am able to get audio to work with JapanesePod101. However when I go to add the card I get the following error about downloading audio.

Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': The provided value is not of type 'RequestInit'.
    at RequestBuilder.fetchAnonymous (request-builder.js:57:9)
    at AudioDownloader._downloadAudioFromUrl (audio-downloader.js:263:53)
    at AudioDownloader.downloadTermAudio (audio-downloader.js:66:47)
    at async Backend._injectAnkiNoteAudio (backend.js:1839:36)
    at async Backend._injectAnkNoteMedia (backend.js:1796:33)
    at async Backend._onApiInjectAnkiNoteMedia (backend.js:517:16)

The only way that I can add the card is if I delete all audio sources from yomitan.

Browser version Brave 1.56.20 Chromium 115.0.5790.171

Yomichan version Extension version: Yomitan 23.4.7.0 Platform: Linux Browser: Chrome Language: en-US User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 AnkiConnect version: 6 Installed dictionaries: 新和英, JMdict, 旺文社国語辞典 第十一版, 明鏡国語辞典 第二版, ハイブリッド新辞林, 実用日本語表現辞典, 新明解国語辞典 第八版, 三省堂国語辞典 第七版, デジタル大辞泉, 精選版 日本国語大辞典, 大辞林 第四版, 岩波国語辞典 第八版, 広辞苑 第七版, 故事ことわざの辞典, 新明解四字熟語辞典, 学研 四字熟語辞典, CC100, BCCWJ, Netflix, Anime, VN, Narou, Novels, JPDB, JLPT文法解説まとめ, JPDB Kanji, TheKanjiMap Kanji Radicals/Composition, KANJIDIC, JMnedict, JMdict Forms

Running Anki 2.1.65

Exported settings file yomichan-settings-2022-12-21-14-00-53.txt

praschke commented 11 months ago

This error is on the line fetch(1, 2);. This function does not take integers, I suspect the line was left in after some debugging for the purposes of documentation. It should be taken out.

djahandarie commented 8 months ago

@Gin-no-kami Could you verify if this is fixed on the latest version of Yomitan?

djahandarie commented 8 months ago

Closing since it should be fixed, feel free to reopen if not.