Skip to content

Add support for ankiconnect api key#142

Merged
tatsumoto-ren merged 3 commits intoAjatt-Tools:masterfrom
iamllama:ankiconnect-api-key
Apr 20, 2025
Merged

Add support for ankiconnect api key#142
tatsumoto-ren merged 3 commits intoAjatt-Tools:masterfrom
iamllama:ankiconnect-api-key

Conversation

@iamllama
Copy link
Copy Markdown
Contributor

@iamllama iamllama commented Apr 20, 2025

Hello there! AnkiConnect allows setting an api key for use in authenticating requests, which is also supported by rikaitan

This pr proposes to add support for it by way of adding an ankiconnect_api_key config option

@tatsumoto-ren
Copy link
Copy Markdown
Member

Hello! Why would you need to add that to mpvacious?

Apparently, Rikaitan already supports it, and it was added 3 years ago, but the purpose is unclear.

ankiconnect.lua Outdated
local self = {}

self.execute = function(request, completion_fn)
if self.config.ankiconnect_api_key ~= '' then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should call is_empty() here.

@iamllama
Copy link
Copy Markdown
Contributor Author

iamllama commented Apr 20, 2025

Why would you need to add that to mpvacious?

I had to make this change for it to work*, given my current ankiconnect config 😅
image

As for why ankiconnect felt the need to add such an option, i'm not sure, but since it exists, it'd be nice to have feature parity and support it. Though admittedly it does not seem widely used, given that no one's asked for it yet 🤔

*unauthenticated requests are ignored if apiKey is set

Apparently, Rikaitan already supports it, and it was added 3 years ago, but the purpose is unclear.

Dug around for context, and found FooSoft/yomichan#2139

@tatsumoto-ren tatsumoto-ren merged commit f55fb7c into Ajatt-Tools:master Apr 20, 2025
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.

2 participants