Commit graph

5127 commits

Author SHA1 Message Date
Damien Elmes
b57d1ed08a allow dragging of images in review screen again
when we were using webkit+file URLs, this deleted files from the
media folder! But we're behind a HTTP server now, so this should
be safe.

https://forums.ankiweb.net/t/no-longer-able-to-copy-latex-output/3128/5

originally disabled in
dd4bae6e8d
2020-09-22 10:29:53 +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
34eea85fde Merge pull request #765 from Arthur-Milchior/ignoreGuids
NF: remove _changedGuids
2020-09-21 14:35:44 +10:00
Arthur Milchior
b322e6d5f2 NF: remove _changedGuids
Nothing is ever added to the map.
That was a bug detected by lint in ankidroid
2020-09-21 06:02:10 +02: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
2d02e5ffa3 fix average added
https://forums.ankiweb.net/t/statistics-bug-cards-added-average/3556
2020-09-21 11:31:27 +10:00
Damien Elmes
5ff567cda5 Merge pull request #764 from abdnh/back-side-only
'Show Both Sides' -> 'Back Side Only'
2020-09-21 10:47:52 +10:00
abdo
25c2eda7d2 'Show Both Sides' -> 'Back Side Only' 2020-09-20 19:31:00 +03:00
Damien Elmes
28b5c6c107 small learning steps were being stored as a float
https://forums.ankiweb.net/t/bug-with-fractional-learning-intervals/3524/5
2020-09-20 10:29:39 +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
Damien Elmes
d1664804db Merge pull request #761 from kelciour/linux-audio-stops-working
Revert mpv back to listening for idle callback
2020-09-17 14:15:11 +10:00
kelciour
401b1b43b2 Revert back to listening for idle callback
https://forums.ankiweb.net/t/anki-2-1-33-linux-audio-stops-working/3023
2020-09-16 09:25:18 +03:00
Damien Elmes
1b8d1303ca Merge pull request #758 from hgiesel/synchook
Add sync_will_start and sync_did_finish hook
2020-09-15 21:20:46 +10:00
Henrik Giesel
5981cebb8e Move sync_did_finish before reset 2020-09-15 13:06:11 +02:00
Damien Elmes
234cfaaa88 Merge pull request #760 from abdnh/extended-drop
Support extended drag & drop
2020-09-15 20:31:43 +10:00
abdo
a410a1117a Support extended drag & drop 2020-09-14 17:07:31 +03:00
Henrik Giesel
306424455c Add some documentation to sync_did_finish hook 2020-09-14 13:18:16 +02:00
Henrik Giesel
52502fb1d3 Put sync_did_finish hook before after_sync because it might unload collection 2020-09-14 13:06:20 +02:00
Henrik Giesel
a685272e16 Add sync_will_start and sync_did_finish hook 2020-09-14 12:22:01 +02:00
Damien Elmes
39627a17b7 add pointers to other README files 2020-09-09 10:01:42 +10:00
Damien Elmes
8bda2b73e7 Merge pull request #753 from kaczmarj/add/dockerfile
add Dockerfile
2020-09-09 09:49:13 +10:00
Damien Elmes
c801857d64 fix padding in RTL langs
closes #757
2020-09-09 09:44:15 +10:00
Jakub Kaczmarzyk
a22f4439a1 Merge branch 'master' into add/dockerfile 2020-09-08 14:59:32 -04:00
Jakub Kaczmarzyk
4d8b2207b4 Update Dockerfile and add README.docker
- Fix permissions in `/opt` to allow non-root user to compile Anki (which requires reading and/or creating files below `/opt`).
- Create `pythonbuilder` stage, which runs only `make build`. The wheels from this stage are copied into the final stage.
- Add README.docker
2020-09-08 14:58:25 -04:00
Damien Elmes
34ad8a9129 typo 2020-09-07 16:09:52 +10:00
Damien Elmes
d649dfb7fd doc updates
thanks to Robert: https://github.com/ankitects/anki/pull/756

closes #756
2020-09-07 16:03:48 +10:00
Damien Elmes
e401cadc73 Merge pull request #752 from cyphar/rust-deps
rust: switch to stable compilers
2020-09-07 15:25:38 +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
32f5bc96a8 another showDupes fix from ANH
https://forums.ankiweb.net/t/show-duplicates-not-working/2883/10
2020-09-04 10:13:30 +10:00
Damien Elmes
a5955f0206 sound tags need filename html escaped
https://forums.ankiweb.net/t/unable-to-play-longer-audio-on-cards/1313/30
2020-09-04 09:36:38 +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
d81251676d Revert "Merge pull request #749 from ANH25/editor-media-autoplay"
This reverts commit 373402ed0a, reversing
changes made to 35c59cb899.

https://github.com/ankitects/anki/pull/749#issuecomment-686385112
2020-09-04 08:34:26 +10:00
Damien Elmes
dff3644875 fix custom study link being shown in filtered deck
https://forums.ankiweb.net/t/crashing-after-custom-study-learn-forgotten-cards/3013
2020-09-04 08:31:33 +10:00
Jakub Kaczmarzyk
61f8ef4c16 add maintainer label 2020-09-03 09:21:02 -04:00
Damien Elmes
bc60d233e5 rebuild_filtered_deck() and new_filtered() 2020-09-03 18:02:47 +10:00
Damien Elmes
6f7f5686e8 empty_filtered_deck() 2020-09-03 17:43:07 +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
Jakub Kaczmarzyk
82c63f90ef fix jakub kaczmarzyk's email 2020-09-02 16:12:52 -04:00
Jakub Kaczmarzyk
a0c25dc783 add Jakub Kaczmarzyk + rm whitespace 2020-09-02 15:58:26 -04:00
Jakub Kaczmarzyk
58533c909b add Dockerfile
Docker provides a standard way of installing software. This is particularly useful with software that requires fairly complex dependencies, like Anki. The Dockerfile added in this commit builds a Docker image with Anki. The Docker image is based on `python:3.8`, which is based on a Debian Buster image. This Docker image can be useful to end users, because it can be installed on any system that has Docker (e.g., Windows, macOS, Linux), and it is also useful to developers who might not have -- or want to install -- the dependencies that Anki requires at compile time.

To build the image, run `docker build --tag anki .` in the project root directory.

To run the image with a GUI (on Unix-like systems), run

```
docker run --rm -it --env "DISPLAY=$DISPLAY" --volume /tmp/.X11-unix:/tmp/.X11-unix anki
```

One may also mount a user's Anki directory into the container and run the container as the current user.

One may also run with Singularity (which typically has more transparent support for GUI applications and behaving as the current user) by first building the Docker image as above and then converting to Singularity Image Format (SIF) with

```
sudo singularity build anki.sif docker-daemon://anki:latest
```

Run the Singularity image with

```
singularity run anki.sif
```
2020-09-02 15:35:18 -04:00