themoeway / yomitan

Pop-up dictionary browser extension. Successor to Yomichan.
https://yomitan.wiki
GNU General Public License v3.0
1.15k stars 89 forks source link

Cannot add Anki cards on Brave #335

Closed VoQZHD closed 2 weeks ago

VoQZHD commented 9 months ago

image image image

The buttons are green but appear to do nothing when pressed, there's a progress indicator but no progress.

Brave Version 1.60.118 Chromium: 119.0.6045.163 (Official Build) (64-bit)

Yomitan (development build) 23.11.23.0 yomitan-settings-2023-11-29-15-22-38.json

Cyanisk commented 9 months ago

I seem to have the exact same problem with brave. Yomitan is connected to Anki, can find duplicates and open the Anki browser to display said duplicates. However when trying to add a new card the progress bar keeps spinning and (after about 5 minutes) finally times out:

2023-12-15_15-12

An error occurred: Unexpected response of type undefined ({"action":"injectAnkiNoteMedia","params":{"timestamp":1702634261405,"definitionDetails":{"type":"term","term":"食べる","reading":"たべる"},"audioDetails":{"sources":[{"type":"jpod101","url":"","voice":""}],"preferredAudioIndex":null,"idleTimeout":null},"screenshotDetails":null,"clipboardDetails":{"image":false,"text":false},"dictionaryMediaDetails":[]}}) Log debug info to console

Clicking Log debug info to console logs a {ankiNoteErrors: Array(1)} to the developer tools console, but I don't know if it's helpful (and if so, how to export it)?

For good measure I tried using Yomitan in ungoogled-chromium which seems to work without issue. Also, Yomibaba works well on Brave.

Brave Version 1.61.101 Chromium: 120.0.6099.71 (Official Build) (64-bit) Yomitan 23.11.23.0

bijak commented 9 months ago

Same problem here, also on Brave Version 1.61.104 Chromium: 120.0.6099.115 (Official Build) Yomitan: 23.11.23.0

EDIT: (Should have mentioned that I used the same settings on kiwi browser that I imported to my Android devices and they all worked fine - only Brave has had this issue so far)

wolfv506 commented 9 months ago

Me too, I have the same specs as bijak

djahandarie commented 9 months ago

Sounds like the problem is limited to Brave. I guess we don't have any developers who use it... we'd need to find someone willing to debug.

VoQZHD commented 9 months ago

The issue resolves itself after reinstalling the extension

bijak commented 9 months ago

For the record, reinstalling the extension did not resolve this issue for me

simonrod2404 commented 9 months ago

Reinstalling the extension also didn't solve resolve it for me. I even switched from stable to testing, but it still doesn't work.

tahoeschrader commented 8 months ago

I am not sure why this issue was closed. I have the same issue, and reinstalling the extension does not fix it.

djahandarie commented 8 months ago

If anyone viewing this issue has Brave and time to debug, please try to makes some progress and leave notes about what the issue might be 🙏

tahoeschrader commented 8 months ago

I don't have any Javascript or Chrome Dev Tools experience, but the card creation starts to hang at line 63 of js/comm/api.js

return this._invoke('injectAnkiNoteMedia', {timestamp, definitionDetails, audioDetails, screenshotDetails, clipboardDetails, dictionaryMediaDetails});

Screenshot 2023-12-25 at 6 26 31 PM

This is basically just saying exactly what's written out in the error from @Cyanisk up above. If anyone has advice on where to go from here, I can keep trying. Once it hits chrome.runtime.sendMessage(...), I am unable to step into any more functions and the process starts taking forever to load.

tahoeschrader commented 8 months ago

When I try debugging on Chrome Canary, it gets past this step with no issue even though all the Watch objects look the same. I also couldn't debug into chrome.runtime.sendMessage(...), so wasn't able to get any helpful information. Like others mentioned, there is no issue with Yomibaba on Brave.

djahandarie commented 8 months ago

Thanks for trying to debug! That's just the message that gets sent between the yomitan content script and yomitan service worker. If you open up your extensions, there should be a way to inspect the service worker page. On that page, put a breakpoint in backend.js on the appropriate function (should be called _onApiInjectAnkiNoteMedia IIRC) -- that should let you continue debugging until the service worker hits some problem.

Cyanisk commented 8 months ago

Yomitan has been working flawlessly for me after simply reinstalling the extension, so unfortunately I don't think I'll be able to help debugging

tahoeschrader commented 8 months ago

Thanks djahandarie, I was able to get further with that advice. Tracking down the problem right now and it seems to be coming from _downloadAudioFromUrl -> fetchAnonymous -> await this._updateSessionRules({addRules});.

I am not sure how to debug into chrome.declarativeNetRequest.updateSessionRules:

_updateSessionRules(options) {
    return new Promise((resolve, reject) => {
        chrome.declarativeNetRequest.updateSessionRules(options, () => {
            const e = chrome.runtime.lastError;
            if (e) {
                reject(new Error(e.message));
            } else {
                resolve();
            }
        });
    });
}
bijak commented 8 months ago

Wasn't able to get further than above tracing error messages, but I did figure out some steps to reproduce the problem.

  1. Set up Yomitan and Anki so that everything is working
  2. Restart your computer or fully restart Brave (ie kill it in the task manager after closing the browser window since it keeps running in the background)
  3. Now you can no longer mine to Anki

I tried this several times and it broke it every time. Additionally I found a much simpler fix than reinstalling the extension: just disabling and re-enabling it again in the extension options.

I also tried reproducing these steps on Edge since I have it installed, and no luck there so it does seem to be something Brave specific.

wolfv506 commented 8 months ago

Like discussed on the discord, the problem only arises if you have an {audio} field in your anki export template. (maybe helpful for people who want to reproduce the bug)

puinyu commented 8 months ago

try modifying this option image also applies to firefox

tahoeschrader commented 8 months ago

try modifying this option

image

also applies to firefox

changing this setting to all the available options doesn't seem to affect this bug

puinyu commented 8 months ago

changing this setting to all the available options doesn't seem to affect this bug

have you tried turning the extension off and on again

tahoeschrader commented 8 months ago

changing this setting to all the available options doesn't seem to affect this bug

have you tried turning the extension off and on again

yes (others in this issue have also tried reinstalling to no avail)

https://github.com/themoeway/yomitan/assets/26147461/96c0b1bc-d7a4-453c-bcbd-ce913b22f3a8

puinyu commented 8 months ago

yes (others in this issue have also tried reinstalling to no avail)

try turning off the actual extension image

https://github.com/themoeway/yomitan/assets/119428043/31f6ac28-34bc-4be7-af11-32421d16011e

wolfv506 commented 8 months ago

yes (others in this issue have also tried reinstalling to no avail)

try turning off the actual extension image

2024-01-01.13-25-22.mp4

This works but when I restart my PC, I have the same bug again...

scarrupt commented 8 months ago

It might due to the following bug with declarativeNetRequest:

https://github.com/brave/brave-browser/issues/30854

Fix should be added in Brave version 1.63

arbyste commented 8 months ago

I can confirm that I have this issue in Brave 1.61, but not in 1.63 (beta version)

Katsumi-III commented 7 months ago

Also have this issue and attempted to install the recommended version of Brave. but yielded

 Could not depsolve transaction; 1 problem detected:
 Problem: conflicting requests
  - nothing provides brave-keyring >= 1.11-1 needed by brave-browser-beta-1.63.134-1.x86_64 from @commandline

As a layman just trying to use ASBPLAYER with Yomitan here, I don't know what I am looking at, nor how to fix this

Katsumi-III commented 7 months ago

Also have this issue and attempted to install the recommended version of Brave. but yielded

 Could not depsolve transaction; 1 problem detected:
 Problem: conflicting requests
  - nothing provides brave-keyring >= 1.11-1 needed by brave-browser-beta-1.63.134-1.x86_64 from @commandline

As a layman just trying to use ASBPLAYER with Yomitan here, I don't know what I am looking at, nor how to fix this

I had reinstalled Yomitan while on a previous version of Brave which yielded no resolution, but I have just reinstalled on Brave v1.62.153 and now Yomitan can successfully add new cards

Katsumi-III commented 7 months ago

Thought that it was resolved after reinstalling in Brave v1.62.153 but, after pc restart the issue reappeared.

Katsumi-III commented 7 months ago

Thought that it was resolved after reinstalling in Brave v1.62.153 but, after pc restart the issue reappeared.

Re-enabling the extension seems to fix it temporarily Extension version: Yomitan 24.01.14.0 Platform: Linux

jamesmaa commented 2 weeks ago

Stale issue. Please reopen if you experience this problem