Commit graph

697 commits

Author SHA1 Message Date
Damien Elmes
f83f0f08e2 drop El Capitan support 2020-11-12 20:03:41 +10:00
Damien Elmes
5ab4cbfd63 prep for i18n updates
Update scripts will be split into separate repo
2020-11-11 16:18:28 +10:00
Damien Elmes
8147c9996a Merge pull request #793 from nwwt/object-audio-tags-support
Audio & object tag support
2020-11-11 10:33:31 +10:00
Andreas Reis
81d6d21ae3 cleanup / renames
・ soundRegexps →  sound_regexps

・ htmlRegexps →  html_media_regexps

・ HTML_TAGS →  HTML_MEDIA_TAGS

・ escapeImages →  escape_media_filenames + alias

・ strip_html_preserving_image_filenames →  strip_html_preserving_media_filenames
2020-11-10 14:53:04 +01:00
Damien Elmes
434fdae4f0 Merge pull request #805 from cecini/duecounts
align rslib get_subnode impl with anki pythonapi find_deck_in_tree
2020-11-06 10:57:49 +10:00
Damien Elmes
aaa950f66c handle notes with invalid utf8 2020-11-06 10:21:51 +10:00
Damien Elmes
e049062147 fix missing buildinfo on Windows 2020-11-05 11:21:27 +10:00
Damien Elmes
f738053c35 fixes for consuming rust lib from external repo 2020-11-04 19:20:49 +10:00
Damien Elmes
f24d80bac5 update to latest fluent libs, and integrate maximum digit handling
We now limit number of digits in our formatter, instead of relying
on an upstream patch.
2020-11-03 14:10:45 +10:00
Damien Elmes
a001029961 add shallow_since to a bunch of git deps 2020-11-03 11:42:11 +10:00
Damien Elmes
6cde50e475 ues native roots with rustls 2020-11-03 10:42:20 +10:00
Damien Elmes
c6e6c8a54d update env_logger, and minor dep updates 2020-11-03 09:04:57 +10:00
Damien Elmes
c62e2e1e58 reqwest was missing default-features = false
Still needed until we fix OpenSSL compilation on Linux
2020-11-02 21:53:24 +10:00
Damien Elmes
f620bfc3bf update rusqlite and pin-project
Thanks to Alan for the heads up
2020-11-02 18:26:19 +10:00
Damien Elmes
db0e0e78f8 update cargo deps; add script to copy them from rslib/ 2020-11-02 18:17:26 +10:00
Damien Elmes
7c27c4b9a0 move backend.proto into rslib/ 2020-11-02 16:28:31 +10:00
Damien Elmes
3632c22feb clippy lint 2020-11-01 16:19:08 +10:00
Damien Elmes
cfbbb69648 trailing newline .ftl check can happen at build time
Removes the need to build ripgrep for CI
2020-11-01 14:59:45 +10:00
Damien Elmes
f9171eb3d3 remove old makefiles 2020-11-01 14:41:01 +10:00
Damien Elmes
ce3b08ac58 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
cecini
e12c09bd11 align rslib get_subnode impl with anki pythonapi find_deck_in_tree, fix nestdeck due counts issue 2020-10-29 23:53:26 +08:00
Andreas Reis
c77ac81e9d Add audio & object tags to media check
Makes the media check recognize files in <audio> and <object> tags as used.

They've been observed/supported by the WebView (checked: Anki, AnkiDroid) since just about forever already and are extremely useful if one knows a thing about web dev.
2020-10-25 13:09:57 +01:00
abdo
29d17bf608 Ensure non-empty names
https://github.com/ankitects/anki/pull/801/
2020-10-22 16:11:06 +03:00
abdo
69da22a2b9 Strip double quotes from names
Strip double quotes from all kinds of names

https://github.com/ankitects/anki/pull/798
2020-10-21 21:48:49 +03:00
Damien Elmes
791894d2d0 fix new clippy lints 2020-10-09 21:35:53 +10:00
Damien Elmes
d3de0bbaff reindex when checking database
Came across a user with a corrupt index:

sqlite> pragma integrity_check;
 integrity_check = wrong # of entries in index ix_revlog_cid
 integrity_check = wrong # of entries in index ix_cards_sched

This is not picked up by a quick check, and a vacuum does not
fix it, but a reindex does.

AnkiWeb currently performs a full check when a file is uploaded
to it, so this was leading to "corrupt" to show up when syncing
the collection, with a local DB check not reporting/fixing the issue.
2020-10-05 17:40:43 +10:00
Damien Elmes
2ed1507162 bump version 2020-10-02 10:22:21 +10:00
Damien Elmes
61bbe6a604 fix * handling in unqualifed text as well
https://forums.ankiweb.net/t/anki-2-1-desktop-searching-with-only-when-limited-to-a-field/3789/4
2020-09-29 21:18:19 +10:00
Damien Elmes
2e7c71b415 fix escaping of * in field search
mentioned in
https://github.com/ankitects/anki/pull/769
2020-09-27 16:04:08 +10:00
Damien Elmes
1a619073d7 bump version 2020-09-24 10:52:24 +10:00
Damien Elmes
b39612eb33 rename downgrade method for clarity 2020-09-22 15:53:26 +10:00
Damien Elmes
ea7b8c5e49 update schema to fix default initial ease in deck configs
Closes #766

- changes the on-disk representation from % to a multiplier,
eg 250 -> 2.5, as this is consistent with the other options
- resets deck configs at or below 1.3 to 2.5
- for any cards that were using a reset deck config, reset their
current factor if it's at or below 2.0x. The cutoff is arbitrary,
and just intended to make sure we catch cards the user has rated
Easy on multiple times. The existing due dates are left alone.
2020-09-22 08:16:39 +10:00
Damien Elmes
4d66bafc51 stop is:due gathering learning cards that are not due yet
https://forums.ankiweb.net/t/how-to-avoid-rebuilding-filtered-decks-to-skip-learning-cards-steps/3551/
2020-09-21 11:41:54 +10:00
Damien Elmes
2a5ebad11f fix incorrect SQL in previous change 2020-09-19 12:27:00 +10:00
Damien Elmes
35470fdcf3 congrats_info() failed if learning card had negative due
https://forums.ankiweb.net/t/integralvalueoutofrange-for-filtered-deck/3353
2020-09-18 20:14:35 +10:00
Damien Elmes
717ea6db3d sched_timing_today() needs a default rollover hour
When unset it was reverting to the V1 code.

https://forums.ankiweb.net/t/daily-counts-are-reset-on-sync/3441/16
2020-09-18 19:13:47 +10:00
Damien Elmes
779a8930e7 check original due in card stats
https://forums.ankiweb.net/t/how-come-some-of-my-cards-are-showing-retrospective-due-dates/3434/6
2020-09-17 14:36:18 +10:00
Aleksa Sarai
21769bfa68 rust: switch to stable compilers
The only dependency which required nightly compilers was pyo3, which
supports stable Rust (1.39.0 and later) since version 0.11.0. Supporting
stable Rust makes it easier to package Anki for distributions. No other
code changes were required.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-09-05 19:39:51 +10:00
Aleksa Sarai
da040372da rslib: disable bzip2 feature
We can't link against libzip2.so.1 when building manylinux wheels, but
the only dependency which required this was "zip" and we don't appear to
make use of bzip2 in Anki.

This fixes the following "make build" error on Linux:

  x maturin failed
    Caused by: Failed to ensure manylinux compliance
    Caused by: Your library is not manylinux compliant because it links the following forbidden libraries: ["libbz2.so.1"]

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-09-05 19:39:11 +10:00
Aleksa Sarai
96da137314 rs: remove most &mut references in BackendService
The previous implementation had some slightly questionable memory safety
properties (older versions of PyO3 didn't uphold the Rust aliasing rules
and would thus create multiple &mut references to #[pyclass] objects).
This explains why Backend has internal Mutex<T>s even though all of its
methods took &mut self.

The solution is to simply make all methods take &self, which luckily
doesn't pose too make issues -- most of the code inside Backend already
has sufficient locking. The only two things which needed to be
explicitly handled where:

1. "self.runtime" which was fairly easy to handle. All usages of
   the Runtime only require an immutable reference to create a new
   Handle, so we could switch to OnceCell which provides
   lazy-initialisation semantics without needing a more heavy-handed
   Mutex<tokio::runtime::Handle>.

2. "self.sync_abort" was simply wrapped in a Mutex<>, though some of the
   odd semantics of sync_abort (not being able to handle multiple
   processes synchronising at the same time) become pretty obvious with
   this change (for now we just log a warning in that case). In
   addition, switch to an RAII-style guard to make sure we don't forget
   to clear the abort_handle.

As a result, we now no longer break Rust's aliasing rules and we can
build with newer versions of PyO3 which have runtime checks for these
things (and build on stable Rust).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-09-05 19:37:59 +10:00
Aleksa Sarai
1f95cb3139 rslib: auto-format protobuf code
prost-build doesn't generate rustfmt-safe code, so we had to add it to
the ignore list for rustfmt on "make check". However, the ignore list
isn't supported by stable rustfmt, so we have to work around this some
other way -- in this case, just do "rustfmt" on the generated file in
"build.rs" (this way, formatting errors in checked-in source code are
still caught but generated code doesn't cause spurrious errors).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-09-04 16:30:06 +10:00
Damien Elmes
cce0ee2b03 handle quoted html chars in media check
https://forums.ankiweb.net/t/unable-to-play-longer-audio-on-cards/1313/30
2020-09-04 09:36:38 +10:00
Damien Elmes
f32d773e25 set_deck() 2020-09-03 17:42:46 +10:00
Damien Elmes
f7d4bf8489 support did:[deck id] search 2020-09-03 16:43:22 +10:00
Damien Elmes
32759a55e4 log 0 day interval as 1 day
Allows distinguishing it from resetting to new, and is treated as
a one day delay when answering anyway.
2020-09-03 16:00:06 +10:00
Damien Elmes
7c169daa95 move card sorting and resetting to backend 2020-09-03 15:54:15 +10:00
Damien Elmes
72142d51c4 set local offset when saving preferences 2020-09-03 12:43:18 +10:00
Damien Elmes
366c5c4774 log manual reschedule, but ignore the log entry in the stats 2020-09-02 17:56:23 +10:00
Damien Elmes
31b7d7d645 move reschedCards() to backend 2020-09-02 17:56:23 +10:00
Damien Elmes
396081d329 move filtered deck empty/fill to backend
emptying of individual card ids still to be done
2020-09-02 17:56:23 +10:00