anki/aqt
Glutanimate 5e90758f39 Allow add-on authors to set a whitelist of webview-accessible files
Extends the AddonManager API with two new methods, setWebExports and
getWebExports. setWebExports expects an add-on module name and a
valid RegEx pattern to match subpaths in the add-on folder against.

Any matching subpaths will be accessible in Anki's web views by
referencing them with /_addons/{addon_id}/{subpath}.

For instance, to allow access to .css and .png files in your add-on's
user_files directory you would call:

> mw.addonManager.setWebExports(__name__, r"user_files/.+(\.png|\.css)")

You could then reference these files in web views as such:

> <img src="/_addons/{addon_id}/user_files/test.png">

Please note that this bypasses the default security policies used
in Anki webviews. You should take care to construct your RegEx
patterns specific enough so that they do not match any sensitive
files of our add-on.
2019-03-02 18:57:51 +01:00
..
__init__.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
about.py Add a button to copy debug information to About dialog 2019-02-24 14:55:55 +01:00
addcards.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
addons.py Allow add-on authors to set a whitelist of webview-accessible files 2019-03-02 18:57:51 +01:00
browser.py include note id in state 2019-02-26 11:21:25 +10:00
clayout.py style and arg order fix 2019-02-18 12:44:04 +10:00
customstudy.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
deckbrowser.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
deckchooser.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
deckconf.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
downloader.py improve add-on downloading error readability 2019-02-26 09:36:20 +10:00
dyndeckconf.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
editcurrent.py fix editcurrent not freeing webview on close 2019-02-19 08:01:11 +10:00
editor.py preserve whitespace when pasting text 2019-02-06 12:00:50 +10:00
errors.py Move supportText() to utils in order to allow use outside of errors 2019-02-24 14:50:39 +01:00
exporting.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
fields.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
importing.py fix schema not being modified on backup import 2019-02-14 15:22:57 +10:00
main.py Allow add-on authors to set a whitelist of webview-accessible files 2019-03-02 18:57:51 +01:00
mediasrv.py Allow add-on authors to set a whitelist of webview-accessible files 2019-03-02 18:57:51 +01:00
modelchooser.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
models.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
overview.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
pinnedmodules.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
preferences.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
profiles.py catch profile rename error in non-English locales 2019-02-06 09:02:56 +10:00
progress.py avoid running timers after collection unload 2019-02-06 12:03:14 +10:00
qt.py Explicitly import all QtWebEngineWidgets 2019-02-15 13:55:35 +01:00
reviewer.py fix context menu in editor, and move workaround into shared function 2019-02-05 14:37:07 +10:00
sound.py allow running with pyaudio missing 2019-02-13 09:36:39 +10:00
stats.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
studydeck.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
sync.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
tagedit.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
taglimit.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
toolbar.py update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
update.py send build hash in update check so broken betas can be notified 2019-02-18 14:07:43 +10:00
utils.py be explicit about text format when showing add-on errors 2019-02-26 09:36:02 +10:00
webview.py Set webview bg to system default window color instead of Qt.transparent 2019-02-25 11:44:27 +01:00
winpaths.py fix winpaths for py3 2018-08-08 23:31:18 +10:00