[Ideas/Features] Cross platform addons support using Rust backend and Svelte frontend
After viewing the code of
import-csv, I think that the addons support will be available using Rust backend and Svelte UI.
All the important methods are implemented in backend which called using fetch request from frontend to backend. So, the frontend can access decks info, note type info etc. It also can also modify the decks data and notes data. The Anki ecosystem will use webview to load the addons pages and serve request from rust back over localhost.
The addons download and extract will be similar to existing addons implementation.
The webview already implemented in Anki, so the code will be reused to create the webview window for serving
The addons can be distributed to npm or addons page of ankiweb. But downloading from npm will download whole project, so may be only built project should be published by addon developer.
The Anki, AnkiDroid and AnkiMobile will download the addons from npm or addons page and extract the content in some folder like
meta.json file will store the information like name, version, licence etc.
config.json will store the information about how the addons should be opened i.e. through deck options menu, file menu or inside reviewer or note editor. It will also store others configuration related to addons. A button will be added for installed addons to menu depending on
When the button clicked it will open the webview and load the
The webserver then serve the content when requested using
The file will be served
addon-name.js addon-name.html addon-name.css
The addons development should be done on Anki source with web browser as loading the pages on localhost. The
card-info will be useful in getting started.
Then the page built using bazel and the published. The tar.gz must contains addon-name.js/html/css, meta.json and config.json file.
The addons should be harmless to the system. Addons must not make request to web url other than localhost. It should not unnecessary modify contents of decks and notes.
If addons required more features which is not available then it should be requested or implemented in rust backend and PR created to upstream. If approved and merged then the features will be available to AnkiDroid and AnkiMobile also.