Commit Graph

65 Commits

Author SHA1 Message Date
Damien Elmes
30f5269304 hook new deck config screen up behind an env var 2021-04-22 10:59:16 +10:00
Damien Elmes
55277aa90a implement deck config saving on JS end 2021-04-20 19:50:05 +10:00
Damien Elmes
76eb119870 add schema change prompt to removal, tweak return struct 2021-04-18 17:33:12 +10:00
Damien Elmes
6632b63a11 support overriding listening IP during dev 2021-04-16 10:23:13 +10:00
Damien Elmes
0b8ae7225a add a shortcut to speed up local ts dev
@hgiesel if you're not already doing something like this, you might
find this useful
2021-04-14 23:21:33 +10:00
Damien Elmes
7f738c11a2 deck config prototype work in progress
Still in the early stages, and not hooked up yet.
2021-04-14 22:33:10 +10:00
Damien Elmes
b57e9be46f allow js to request specific i18n modules
Brings the payload on the congrats page with a non-English language
down from about 150k to 15k
2021-03-26 21:43:36 +10:00
Damien Elmes
88c002f4eb convert qt strings to f-strings with flynt
Also revealed an incorrect type def in editor.py that mypy wasn't
noticing before :-(
2021-02-11 10:09:06 +10:00
Damien Elmes
bb29ce88f3 minor code cleanups with pyupgrade
- pyupgrade --py38-plus --keep-runtime-typing --keep-percent-format
- third-party mpv and winpaths excluded
2021-02-11 09:43:40 +10:00
Damien Elmes
4a5ef69068 add remaining types and disable missing types on (almost) all aqt 2021-02-03 00:00:29 +10:00
Damien Elmes
a56b09b987 add a bunch of return types 2021-02-01 23:53:23 +10:00
Damien Elmes
f15715fb07 add types to various other files
Mainly automated with MonkeyType
2021-02-01 22:08:56 +10:00
Damien Elmes
6c483bb577 add public wrappers for remaining backend functions 2021-01-31 18:56:16 +10:00
Damien Elmes
9d853bbb03 start work on more clearly defining backend/protobuf boundaries
- anki._backend stores the protobuf files and rsbackend.py code
- pylib modules import protobuf messages directly from the
_pb2 files, and explicitly export any will be returned or consumed
by public pylib functions, so that calling code can import from pylib
- the "rsbackend" no longer imports and re-exports protobuf messages
- pylib can just consume them directly.
- move errors to errors.py

Still todo:

- rsbridge
- finishing the work on rsbackend, and check what we need to add
back to the original file location to avoid breaking add-ons
2021-01-31 18:55:45 +10:00
Damien Elmes
4ac9ad1407 show actual error when graphData fails
The original reason for the catch-all message was users with bad
data such as decimal intervals, but those get automatically coerced
these days. The common case should now be invalid search strings, which
we can show verbatim.
2021-01-29 14:39:05 +10:00
Damien Elmes
37ca8afaf6 minor wording tweak: GraphsPreferences -> GraphPreferences 2021-01-23 20:47:45 +10:00
Henrik Giesel
bf130d1da0 Change the function name in genbackend.py 2021-01-22 20:05:28 +01:00
Henrik Giesel
de71123ab4 Rename GraphsPreferencesOut to simply GraphsPreferences 2021-01-22 19:39:03 +01:00
Henrik Giesel
d1ada88657 Successfully send post request to rust 2021-01-22 14:37:24 +01:00
Henrik Giesel
054c30a695 Add non-functioning logic for settings graphs preferences 2021-01-22 13:14:35 +01:00
Henrik Giesel
665a13e378 Add GraphsPreferences endpoint to backend 2021-01-22 13:13:48 +01:00
Henrik Giesel
ffc40d8959 Replace browsersel with css-browser-selector in aqt files and add redirect 2020-12-31 16:47:20 +01:00
Henrik Giesel
ed8b12e1d6 Add redirect for jquery-ui 2020-12-30 12:08:12 +01:00
Damien Elmes
9e1eaacc06 Revert "Merge pull request #873 from hgiesel/otherjsdeps"
This reverts commit 62600051ae, reversing
changes made to 88553acb0d.

- Standard graphs render incorrectly on latest version - the wrong number
of days are shown, and the grid lines look wrong. Any version after 0.8.3
seems to suffer from this problem.
- Pie graphs and stack graphs don't render - they are provided in separate
files, and plot.js in previous Anki versions has them included in the one
file. To maintain compatibility with add-ons, we'd need to create a single
file as before, instead of importing multiple files.

If the above issues are fixed I'd be happy to merge this in again, but
as the old graphs are on the way out, it's probably not worth the effort.
2020-12-30 14:13:52 +10:00
Henrik Giesel
a6319326a9 Redirect references to old plotting library version 2020-12-29 12:15:46 +01:00
Damien Elmes
666d847a0a
Merge pull request #856 from hgiesel/jquery
Update jQuery from 1.12.4 to 3.5.1, include in Bazel build process
2020-12-29 10:00:33 +10:00
Damien Elmes
d8778da3e8 fix legacy js remapping
Thanks to Henrik for catching it.
2020-12-29 09:57:34 +10:00
Henrik Giesel
202fd6ffa5 Add mapping in redirectWebExport for new jquery file 2020-12-28 14:52:44 +01:00
Damien Elmes
a61f3bbc48 fix some warnings on startup 2020-12-16 15:38:24 +10:00
ianki
c2901e4859 Add hooks for filtering media. 2020-11-09 02:12:23 -08:00
Damien Elmes
ecfeb71195 fix tests on Linux 2020-11-04 21:39:41 +10:00
Damien Elmes
aea0a6fcc6 initial Bazel conversion
Running and testing should be working on the three platforms, but
there's still a fair bit that needs to be done:

- Wheel building + testing in a venv still needs to be implemented.
- Python requirements still need to be compiled with piptool and pinned;
need to compile on all platforms then merge
- Cargo deps in cargo/ and rslib/ need to be cleaned up, and ideally
unified into one place
- Currently using rustls to work around openssl compilation issues
on Linux, but this will break corporate proxies with custom SSL
authorities; need to conditionally use openssl or use
https://github.com/seanmonstar/reqwest/pull/1058
- Makefiles and docs still need cleaning up
- It may make sense to reparent ts/* to the top level, as we don't
nest the other modules under a specific language.
- rspy and pylib must always be updated in lock-step, so merging
rspy into pylib as a private module would simplify things.
- Merging desktop-ftl and mobile-ftl into the core ftl would make
managing and updating translations easier.
- Obsolete scripts need removing.
- And probably more.
2020-11-01 14:26:58 +10:00
Henrik Giesel
70aed820da Set MIME type for javascript files 2020-10-26 23:32:38 +01:00
Damien Elmes
ac265fe75a formatting fixes for latest black 2020-09-01 10:24:38 +10:00
Damien Elmes
e5685254c6 reimplement congrats screen in Rust+Typescript 2020-09-01 10:24:38 +10:00
Damien Elmes
a517accee3 update to latest black 2020-08-31 13:29:28 +10:00
Damien Elmes
18c59c60a4 unnecessary f-string 2020-08-04 17:52:49 +10:00
Damien Elmes
440aa129d9 disable media get / posts when collection closed
https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/4?u=dae
2020-08-04 10:03:17 +10:00
Damien Elmes
c1ecb7b827 fix untyped def issues in aqt/mediasrv.py 2020-08-02 10:22:21 +10:00
Damien Elmes
f45627dbd3 don't throw error on empty path
https://forums.ankiweb.net/t/anki-2-1-28-error-message-when-reviewing-cards/1439
2020-07-27 11:28:32 +10:00
Damien Elmes
2cba721702 formatting and debug statement tweak 2020-07-24 11:57:37 +10:00
Damien Elmes
80a2bfa642 ask user to check db when graphs fail to load 2020-07-24 09:56:28 +10:00
Damien Elmes
320b56ae43 can't rely on stdout to handle unicode 2020-07-15 09:36:29 +10:00
Damien Elmes
bc5b6dfb63 mediasrv symlink fix
https://forums.ankiweb.net/t/anki-2-1-28-beta/629/39
2020-07-11 10:53:41 +10:00
Damien Elmes
93425be839 formatting 2020-07-07 13:28:30 +10:00
Damien Elmes
85cbd263da tidy up logging 2020-07-07 10:50:12 +10:00
Damien Elmes
4ab9d04c95 if webexports does not match, return 403 2020-07-07 10:50:03 +10:00
evandrocoan
121725390d Fix _addons/ URL prefix not being removed on Windows systems
Anki 2.1.28 Beta
https://forums.ankiweb.net/t/anki-2-1-28-beta/629/26

> Did the requirements on how to expose resources on the internal server change? Because scripts, css files and the like, registered with setWebExports, do not work anymore with beta2.
> A look at the console shows the following for all resources:
> Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR)

**\Anki2\addons21\someaddon\__init__.py**
```py
from aqt import mw
import aqt

# assuming add-on folder is named "test"
# and assuming a 'test.js' is in the same folder
addon_id = "someaddon"
port = mw.mediaServer.getPort()
mw.addonManager.setWebExports(addon_id, ".*\\.js$")

print("Hello")

aqt.editor._html += f"""
<script>
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = 'http://127.0.0.1:{port}/_addons/{addon_id}/test.js';
    document.body.appendChild(script);
</script>"""
```
2020-07-06 13:51:37 -03:00
Damien Elmes
4033f00988 don't stuff mw into function objects
Using the global is preferable to fighting against mypy to insert mw
into a function object.
2020-07-03 10:55:29 +10:00
Damien Elmes
14602be0ca port previous css workaround to flask 2020-07-03 10:40:23 +10:00