Skip to content

Fix inline script in field input#12

Open
tpilewicz wants to merge 2 commits into
triaeiou:mainfrom
tpilewicz:main
Open

Fix inline script in field input#12
tpilewicz wants to merge 2 commits into
triaeiou:mainfrom
tpilewicz:main

Conversation

@tpilewicz

@tpilewicz tpilewicz commented Jun 8, 2025

Copy link
Copy Markdown

Closes #9

The idea is that we can't run an inline script anymore because the CSP forbids it. So I moved the code of the inline script to a separate init_config file. The CSP allows running any script that is located in the addons folder.

It's a bit hacky though, in the sense that the type checker won't understand where MarkdownInput comes from 😄

I noticed other inline scripts (in window_input.py) that will probably be broken by Anki's CSP. But I don't know when they're used, so I don't know how to test a fix, so I prefer not to touch it until I know how it's used.

@tpilewicz

Copy link
Copy Markdown
Author

@triaeiou would you mind taking a look? I know the fix is hacky but it would allow running the add-on on Anki v25 :)

Also FYI here's how I tested it: npm run build then I pasted the bin folder into Anki's addon folder (in folder 904999275, the addon's id)

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.

Support for version 25

1 participant