Commit Graph

10142 Commits

Author SHA1 Message Date
RumovZ
cdfb84f19a
Implement TTS using windows crate (#2371)
* Implement TTS using windows crate

* Use API calls instead of SSML

* Properly stop player in case of TTS error

* Add context to WindowsErrors

* Validate available voices

* Remove TTS text from synthesize error

* Limit maximum buffer size

* Make validation optional and list it in tts filter

* We no longer need the winrt module (dae)

* Use a separate request object so the meaning of the bool is clear (dae)

* Slightly shorten runtime error message (dae)

The default message appears to clip slightly.

* Alternate buffer implementation (dae)

* Use array instead of vec

* Drop the max buffer size to 128k (dae)
2023-02-17 12:26:07 +10:00
RumovZ
5a53da23ca
Deck scoped dupe check (#2372)
* Support limiting dupe check to deck

* Expose deck limiting dupe check on frontend

* Make CSV dupe options configurable with headers

* Rename duplicate file headers

* Change dupe check limit to enum
2023-02-16 17:53:36 +10:00
Damien Elmes
b4290fbe44 Bump werkzeug version
Fixes CVE-2023-23934
2023-02-16 17:41:25 +10:00
Damien Elmes
d6a18d2d71 Handle the case where win32com.client fails to import
Hopefully fixes the "no attribute 'Flags'" issue:

https://forums.ankiweb.net/t/technical-issue-with-anki-desktop/27089
2023-02-16 17:41:25 +10:00
Damien Elmes
bf10bbbb62 Allow using the bundled mpv for testing on Windows 2023-02-16 17:41:25 +10:00
evandrocoan
d9f1e22648
Create the hook will_show_web to control html5 media elements with Javascript (#2340)
* Replaced ankimedia object directly call by addon specific hook

# Conflicts:
#	qt/aqt/browser/previewer.py
#	qt/aqt/clayout.py
#	qt/aqt/reviewer.py

* Replaced ankimedia.js by addon specific hook

# Conflicts:
#	qt/aqt/browser/previewer.py
#	qt/aqt/clayout.py
#	qt/aqt/main.py

* Create specific location name for each hook to reuse control

* Created the card_review_webview_did_init hook

* Extended the hook card_will_show to replace will_show_web

The new hook card_will_show_state takes three new arguments

* Created the hook audio_did_pause_or_unpause to replace will_show_web

The new hook is called when audio toggle pause is called

* Created the hook audio_will_replay to replace will_show_web

The new hook is called when the audio is replayed by the user.

* Created the hook previewer_will_redraw_after_show_both_sides_toggled

to replace will_show_web.
The new hook fully replaces the last uses of will_show_web.

* Replaced card_will_show_state hook with reviewer_did_init and

equivalents. Instead of receiving the required state, it access it
by caching the object values with hooks as reviewer_did_init.
2023-02-13 14:50:26 +10:00
Damien Elmes
ad74a01491 Fix yarn install failing if node binary unavailable
The paths we were using were relative, and were breaking if cwd is
changed.
2023-02-10 15:11:36 +10:00
Damien Elmes
0be31b1b17 Fix excess missed markers in non-Latin text 2023-02-10 15:11:36 +10:00
Aristotelis
0f86c9fd11
Rework & unify webview identification and title setting (#2366)
* Create common web view registry and unify title setting

* Consistently use space-separated naming for webview titles

None of the modified titles seem to be in use by add-ons, so we are not bound to the current naming.

The old naming was likely following camelCase as the name was also acting as a key for saveGeom, which is no longer the case.

* Update webview_did_inject_style_into_page example

* Add docstring to addon-targeted method

* Change AnkiWebView.origin to property

* Fix dupe enum value

* Tweak method name

* Add semicolon

* Rename `AnkiWebViewOrigin` to `AnkiWebViewKind`
2023-02-10 14:53:11 +10:00
Damien Elmes
f616bea580 Allow the network timeout to be customized
https://forums.ankiweb.net/t/local-sync-server-collection-exceeds-size-limit/27183/7
2023-02-08 14:33:02 +10:00
RumovZ
ed54cf71ec
Improve HttpError mapping (#2370)
* Use reqwest From impl in HttpError From impl

* Map timeouts to NetworkError (dae)
2023-02-08 12:54:42 +10:00
Damien Elmes
567ba06b5c Show custom data in stats screen
https://forums.ankiweb.net/t/feature-request-display-custom-data-in-card-info/27187
2023-02-07 12:27:43 +10:00
Damien Elmes
14da816857 Update translations 2023-02-07 11:59:53 +10:00
Damien Elmes
92cf5cd898 Don't enforce download size on client
https://forums.ankiweb.net/t/local-sync-server-collection-exceeds-size-limit/27183/6
2023-02-07 11:58:07 +10:00
RumovZ
855dc9d75b
Add Rust bin to deprecate unused ftl entries (#2364)
* Add Rust bin to deprecate unused ftl entries

* Align function names with bin names

* Support passing in multiple ftl roots

* Use source instead of jsons for deprecating

* Fix CargoRun not working more than once (dae)

* Add ftl:deprecate (dae)

* Deprecate some strings (dae)

This is not all of the strings that are currently unused

* Check json files before deprecating; add allowlist (dae)

The scheduler messages we'll probably want to reuse for the v2->v3
transition, so I'd prefer to keep them undeprecated for now.

* Deprecate old bury options (dae)

* Support gathering usages from Kotlin files for AnkiDroid (dae)

* Update json scripts (dae)

* Remove old deprecation headers

* Parameterize JSON roots to keep

* Tweak deprecation message (dae)
2023-02-07 11:56:14 +10:00
RumovZ
c824dd0b90
Disable burying of previously gathered cards (#2361)
* Enforce hierarchical bury modes

Interday learning burying is only allowed if review burying is enabled
and review burying is only allowed if new burying is enabled.
Closes #2352.

* Switch front end to new bury modes

* Wording tweaks (dae)

* Hide interday option if using v2 scheduler (dae)
2023-02-06 12:02:27 +10:00
Damien Elmes
6a97efe7af Deck-specific limits should be ignored when the v2 scheduler is enabled
Closes #2365
2023-02-06 11:02:26 +10:00
RumovZ
f3ef242bc5
Support UTF-8-BOM when importing CSV (#2360)
The csv crate already supports it, but the meta line parsing didn't.
2023-02-05 11:53:21 +10:00
Damien Elmes
b97d1ac074 Protobufjs fixed the relative path issue 2023-02-03 09:31:42 +10:00
Damien Elmes
32ec6e06f6 Fix comparison being collapsed when extra characters in input 2023-02-02 19:13:12 +10:00
Damien Elmes
321402a6d0 Revert to blanking out missed chars in provided text
Quite a few users seem surprised to have missed characters appear in
their input text
2023-02-02 19:13:11 +10:00
Damien Elmes
2c952cf3af Wrap expected text in code block when no answer provided 2023-02-02 18:01:23 +10:00
Damien Elmes
de86d6b40f Update protobufjs to remove transitive dependency on taffydb
Fixes CVE-2019-10790

This required the addition of -p proto due to
https://github.com/protobufjs/protobuf.js/issues/1855
2023-02-02 17:43:25 +10:00
Damien Elmes
801c30d3df Update translations 2023-02-01 19:48:11 +10:00
Damien Elmes
a5917c3b5b Bump version 2023-02-01 19:47:49 +10:00
evandrocoan
c32f14f7cb Trimmed whitespaces on qt/tools/genhooks_gui.py 2023-01-30 19:23:47 +10:00
Kaben Nanlohy
77bba533ea
Allow burying cards in browser (#2351)
* Allow burying cards in browser

This code is based on existing "toggle suspend" command in browser.

- Adds "toggle bury" command to browser cards menu.
- Adds "browsing-toggle-bury" to core translation. Only english-language.
- Adds "buried" coloring to rows for buried cards in browser table.

Not yet done:

- Keyboard shortcut for "toggle bury" action.
- Non-english translations.

* Add contributor as requested in CONTRIBUTORS.

* Fix formatting in browser_table.rs.

* Add keyboard shortcut to "toggle bury" command.

This adds keyboard shortcut "ctrl-shift-j" to "toggle bury" command in
browser cards menu.

* Simplify logic for color of buried-card rows.
2023-01-30 19:21:06 +10:00
Fabricio Duarte
766d1fdb5c
Bind entry value to select component in deck config selector (#2354) 2023-01-29 15:16:14 +10:00
evandrocoan
13d557589f
Improve info message (#2343) 2023-01-29 12:55:01 +10:00
Damien Elmes
4c98a1a318 Fix error shown after toggling full screen
https://forums.ankiweb.net/t/anki-2-1-57-beta/26494/62
2023-01-29 12:41:28 +10:00
Damien Elmes
6b7d372ca9 Skip answer comparison if the user didn't type anything 2023-01-28 21:54:16 +10:00
Damien Elmes
4922654d8f Ensure values clamped when using mousewheel/arrow keys
Closes #2298
2023-01-28 21:54:16 +10:00
Damien Elmes
9c2035e2d1 Make SpinBox types more specific, and add default max value. 2023-01-28 21:54:16 +10:00
Damien Elmes
df09e34927 Fix DailyLimits passing undefined values into SpinBox
If the type says it's a number, we should ensure it's a number :-)

This also fixes fields being empty when they contain a 0 value.
2023-01-28 21:54:16 +10:00
Damien Elmes
d20a7d291f Validate and clamp deck config when loading
Fixes #2353
2023-01-28 21:51:47 +10:00
Damien Elmes
c7e49d8708 Fix SpinBox writing NaNs into deck config
Partial fix for #2353
2023-01-28 21:51:47 +10:00
Damien Elmes
17480a2c80 Use HTTP/1.1 for syncing
HTTP2 + a request body size not being declared up front was creating extra
work for AnkiWeb.
2023-01-28 21:51:47 +10:00
Damien Elmes
14189a91ba Update translations 2023-01-26 19:46:20 +10:00
Abdo
d5c7071c03
Fix 'View Files' not working with a relative base folder (#2350)
* Fix 'View Files' not working with a relative base folder

* Satisfy CONTRIBUTORS check
2023-01-26 19:45:53 +10:00
Damien Elmes
5a1c29a818 Escape HTML in deck names in the deck list
Due to the way the deck list is constructed in Python, this could lead
to the execution of script tags. Thanks to Tyler Butler for the report.
2023-01-26 10:49:57 +10:00
Damien Elmes
21cd4f2f17 Move Python setup into ninja_gen
This matches the node handling
2023-01-26 10:00:14 +10:00
Damien Elmes
4142de57e2 Fix clean build failure due to protoc change
da7d4dd2fc changed the name of the env
var in .cargo/config.toml, causing the check in setup_protoc() to think
a custom path had been provided, which skipped the download and extract
step.
2023-01-26 09:33:39 +10:00
Damien Elmes
ae8f44d4b3 Add a translator to About as requested
A reminder to any contributors that they're welcome to submit a PR or
request that they be added here.
2023-01-25 23:42:39 +10:00
Damien Elmes
17b33f8298
Use Rust nightly for formatting (#2348)
* Support specifying a working dir to a build command

* Use nightly for formatting

* Pass valid TERM in from environment

Rustfmt depends on a valid setting, and not just the var to be non-empty.

* Wrap comment
2023-01-25 23:35:53 +10:00
Mani
5bc75a7885
Use a ninja variable for node binary (#2346)
* Use a ninja variable for node binary

* Update docs (dae)
2023-01-25 21:05:11 +10:00
Damien Elmes
96a9dba67d Ensure svelte changes trigger dprint run 2023-01-23 20:45:55 +10:00
Mani
da7d4dd2fc
Use a ninja variable for Protoc binary (#2345)
* Use a ninja variable for Protoc binary

* fix whitespace
2023-01-23 20:44:47 +10:00
Damien Elmes
ff59b33c54 Use a ninja variable for Python binary
If we're going to allow for swapping out other dependencies with local
versions, we don't want to have to be passing them around everywhere
they are used.
2023-01-23 17:27:07 +10:00
Damien Elmes
dc0185720a Fix outer whitespace not being trimmed in type answer 2023-01-23 17:20:35 +10:00
Damien Elmes
c8275257ce Probable fix for future due graph
Cards due earlier today will have a negative offset like -78000(secs).
The old typescript code was using floating point division to yield -1;
with integer division we get 0 instead.

https://forums.ankiweb.net/t/wrong-info-when-hovering-over-future-due-graph/26522
2023-01-20 00:18:13 +10:00