Skip to content

Conversation

@mallomar
Copy link

@mallomar mallomar commented Oct 7, 2025

Fixes KOReader Anki plugin compatibility by accepting numeric version fields in API requests.

Problem

KOReader sends {"version":6,"action":"requestPermission"} with version as a number (per the official AnkiConnect API spec), but AnkiConnect Android was rejecting this with a MalformedJsonException at column 14 (immediately after the numeric 6).

Solution

  1. Made the JSON parser lenient to accept both numeric and string version fields
  2. Updated get_version() to explicitly handle both number and string types for the version field

Testing

  • The official AnkiConnect API spec uses version as a number
  • This maintains backward compatibility with clients that send version as a string (like Yomitan)
  • Fixes #[89]

Related issue: #89

KOReader sends version as a number per the AnkiConnect API spec. Made JSON parser lenient to accept both numeric and string version fields for compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant