Skip to content

Notes Info API isn't implemented causing MalformedJsonException when updating card image through mokuro files #50

@precondition

Description

@precondition

When using the HTML files provided by Mokuro (not to be confused with the separate Mokuro Reader app) and enabling Anki integration in the advanced settings, I can successfully create new cards by pressing the green button in the Yomibaba/Yomitan pop-up but I can't add a picture to the card.

Screenshot of the advanced settings

image

Looking at the dev console of the Kiwi Browser mobile app that I use, I can see the following stack trace when I press "Complete":

Uncaught (in promise)
com.google.gson.stream.MalformedJsonException:
Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 14 path $com.google.gson.stream.MalformedJsonException:
Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 14 path $
    at
com.google.gson.JsonParser.parseReader(JsonParser.java:66)
    at
com.google.gson.JsonParser.parseString(JsonParser.java:47)
    at
com.kamwithk.ankiconnectandroid.routing.AnkiAPIRouting.findRouteHandleError(AnkiAPIRouting.java:101)
    at
com.kamwithk.ankiconnectandroid.routing.APIHandler.chooseAPI(APIHandler.java:33)
    at
com.kamwithk.ankiconnectandroid.routing.RouteHandler.get(RouteHandler.java:70)
    at
fi.iki.elonen.router.RouterNanoHTTPD$DefaultStreamHandler.post(RouterNanoHTTPD.java:100)
    at
fi.iki.elonen.router.RouterNanoHTTPD$UriResource.process(RouterNanoHTTPD.java:386)
    at
fi.iki.elonen.router.RouterNanoHTTPD$UriRouter.process(RouterNanoHTTPD.java:596)
    at
fi.iki.elonen.router.RouterNanoHTTPD$UriRouter.process(RouterNanoHTTPD.java:596)
    at
[...]

    at java.lang.Thread.run(Thread.java:764)
Caused by:
com.google.gson.stream.MalfromedJsonException:
Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 14 path $
    at
com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1597)
    at
com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1404)
    at
com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542)
    at
[...]

(I didn't find a way to copy the contents of the error from the Kiwi browser console so this was transcribed by hand on the basis of the screenshots in the spoiler)

Screenshots of error

image
image

I made sure to open AnkiDroid, start the Ankiconnect (v1.12) service and added https://mokuro.moe to the CORS host in the settings. I also disabled battery optimizations on the Ankiconnect app and the Kiwi Browser app.

I tested doing the exact same steps on desktop (open the same web page, highlight the same word, create the card, add an image via mokuro) and it worked fine so it is not as if the mokuro file is serving bad JSON data that Ankiconnect can't do anything about, since it seems like the desktop version of Ankiconnect has no issue with the commands received from mokuro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions