Commit graph

11586 commits

Author SHA1 Message Date
Damien Elmes
7884edfd3a
Yarn 4 (#3772)
* Update to yarn 4, and pin the version

* Use yarn to invoke prettier, as yarn 4 is not setting +x

* Fix a few peer dependency warnings
2025-01-26 14:40:17 +11:00
Mike Hardy
2ef46afb48
build: specify the canvas transitive node dependency build failure workaround in future-compatible way (#3752)
* fix: specify canvas npm optional dep ignore workaround more cleanly

this should allow it to work with yarn classic and yarn modern

* chore: add self to CONTRIBUTORS
2025-01-26 11:57:30 +11:00
Jarrett Ye
43e860783b
Fix/re-optimize FSRS if short-term param is weird (#3742)
* Fix/re-optimize FSRS if short-term param is weird

* Reset progress when another run is required (dae)

* only count the same-day steps

* Fix flicker when optimizing again (dae)
2025-01-26 10:42:17 +11:00
Damien Elmes
5883e4eae8 Move Optimize All action into main deck options page
Closes #3696

I have no strong feelings about the message/button wordings or
layout, so if people have better suggestions, they are welcome.
2025-01-25 22:57:05 +11:00
Damien Elmes
c253d40d1d Use prettier's cache
Approximately halves runtime on my system
2025-01-25 22:52:25 +11:00
Damien Elmes
3d13d259bb Use Qt 6.8 on ARM Linux; add tools/run-qt6.8
Prior to this change, ./run fails out of the box on ARM systems, as Qt
wasn't available on PyPI until the 6.8 release.

Also added a script in tools/ for testing Qt6.8 issues on other platforms.
2025-01-25 21:59:31 +11:00
Damien Elmes
cd1824165f Revert "Qt 6.8.1"
This reverts commit 04228de666.

Anki 25.01 Beta 1 revealed a bunch of regressions with the latest
Qt, and zero reports of improvements from it, so we'll be better off
holding off on it for now, and perhaps reporting the deadkeys issue
to Qt once we've got a proper reproduction process.
2025-01-25 21:41:33 +11:00
Luc Mcgrady
f038d6726a
Fix: Simulator Ignores New Cards Already Introduced (#3760)
* Subtract introduced:1 count from learn count of first day of simulator.

* Fix: Cards filtered

* Tidy up

* Fix: Cards filtered (2)

* ./check

* Removed unnecessary filter

* Fix: Doesn't work for real new cards

* ./check

* Fix: .is_none()

* Limit to 1 day

* Removed "days_to_simulate" argument from convert
2025-01-25 21:16:25 +11:00
user1823
b80384c715
More accurate sorting by R (#3747)
* Match calc of relative overdueness in SM2 and FSRS

* Fix calculation of FSRS relative overdueness

* Improve readability by avoiding double negative

* Move comment line
2025-01-25 21:15:49 +11:00
llama
9b2987b4a8
Fix numeric deck and notetype names being treated as ids when importing csv (#3748)
* fallback to treating deck and notetype ids as names

* add test for metadata
2025-01-25 20:13:30 +11:00
Omar Kohl
eaec53bfc4
Ignore SYNC_PORT and SYNC_BASE in syncserver Dockerfile (#3716)
Hardcode them to:

    SYNC_PORT=8080
    SYNC_BASE=/anki_data

If these env variables are passed into the container with different values,
they are ignored.

The reasons is if the user modifies SYNC_BASE they risk data loss since
anki-sync-server will no longer write data into the volume. If they change
SYNC_PORT they need to also change it when mapping this internal port to the
external port of the container, which could be confusing plus it has no benefit
to allow this since it's always possible to change the external port even if
the internal port is fixed to 8080 (e.g. `-p 1234:8080`).

In both cases there is no benefit to making these values configurable and there
are risks associated.

Unfortunately there is no easy way of implementing this for the
Dockerfile.distroless so it's up to the user not to modify these values.
2025-01-25 19:28:55 +11:00
Damien Elmes
5ef8e33d42 Update translations 2025-01-25 19:25:24 +11:00
Ross Brown
dc37a28de0
Add translation strings for True Retention table (#3745)
* Add translation strings for True Retention table

* Hard-code strings to make pylint happy
2025-01-25 19:18:43 +11:00
GithubAnon0000
e32292585b
FIX lang selection resetting to en_US for some langs (#3744)
* FIX lang selection resetting to en_US for some langs

Fixes https://forums.ankiweb.net/t/anki-25-01-beta/54490/17?u=anon_0000.

# Issue
Set a hand full of certain languages in the preferences screen and see that the translations have been applied after reboot. The language selection in preferences wrongly shows en_US though, not the current active language. If you wanted to switch to `en_US` in this case, then you'd have to first switch to a working language (like de_DE) and then switch to en_US.

# Solution
`anki/qt/aqt/preferences.py` has the functions `setup_language()` and `current_lang_index()`. I noticed that it defaults to en_US, if the language is not in `compatMap` and it couldn’t return the index of the current language. No idea if this code is faulty but I headed over to `anki/pylib/anki/lang.py` afterwards.

Here, in `compatMap`, I added e.g. `"la": "la_LA"`. I knew the code since I could get it with `print("––– lang is ", lang)` in `preferences.py` (`current_lang_index()` retrieves `la` for latin).

After adding those code changes from my PR, the problem for those selected languages had gone away.

No idea if that's best practices though or if something else should be fixed instead.

* UPDATE CONTRIBUTORS adding myself to the list
2025-01-25 19:14:50 +11:00
llama
df808727c8
fix changes to tags not being reflected when editing in io mode (#3768) 2025-01-25 10:36:21 +03:00
Omar Kohl
71e2a6f782
Introduce PUID and PGID env variables to syncserver Dockerfile (#3714)
PUID and PGID are optional env variables to specify the user and group id of
the user that the anki-sync-server process should run with.

This gives more flexibility for solving permission problems with volumes and is
a common pattern for Docker images (e.g. see here:
https://docs.linuxserver.io/general/understanding-puid-and-pgid/)

The anki-sync-server process will write any files with the permissions of the
user it's running with, which can be a problem when you need to access those
files from outside the container or when they are being written into a bind
mount that is owned by a particular user on the host system.

To be able to implement this the entrypoint.sh needs to run as root (since it
needs to create a user and change file permissions). anki-sync-server then
needs to be started with the user 'anki', which is why the new dependency
'su-exec' is required. The user 'anki' and group 'anki-group' can no longer be
created at image build time because then their ids would be fixed.

Also update the build instructions to require building the Docker image inside
the directory where the Dockerfile resides since the build now needs to copy
the entrypoint.sh and it seems wrong the specify the path
docs/syncserver/entrypoint.sh inside the Dockerfile.
2025-01-25 18:19:38 +11:00
Arthur Milchior
6c37d5fc70
Add percentage to FSRS spinner (#3679)
* Add percentage to FSRS spinner

This commit add a percentage option in SpinBox and SpinBoxFloatRow, set to False
by default.

If it's true, a percent symbol is added at the end of the line before
the increase/decrease button.

While the value is represented as a percentage without decimal places,
the internal representation is not changed. Which mean that a
multiplier must used to compute the string value, indicate to the
input field the min, max and step, and when updating the result.

* Remove unsightly percentage sign, and update historical retention too

https://github.com/ankitects/anki/pull/3679#issuecomment-2579636981

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2025-01-25 18:17:02 +11:00
llama
873c4e617d
Recognise and check for media referenced in <source> tags (#3763)
* recognise and check <source> tags for media

* add test
2025-01-25 10:16:24 +03:00
llama
8ec94e281c
Remove unfinished polygon when undoing and redoing in IO mode (#3759)
* make removeUnfinishedPolygon return whether a polygon was removed

* treat removing an unfinished polygon as a discrete undo step

* has to be handled when redoing as well, but not as a discrete step
2025-01-25 10:08:47 +03:00
llama
d463f11d07
Allow reopening the add cards window (#3756)
* allow reopening the add cards window

* deck needs to be changed after notetype
since changing notetype potentially changes deck
2025-01-25 09:54:10 +03:00
kelciour
760ce162fb
Cleanup avplayer on profile close (#3754) 2025-01-25 09:44:15 +03:00
Damien Elmes
3364daa0cc Update translations 2025-01-24 22:42:07 +11:00
Damien Elmes
f3626c72b7 Ankiweb ID -> Email
https://forums.ankiweb.net/t/harmonization-email-and-ankiweb-id-strings/54817
2025-01-24 22:41:23 +11:00
Damien Elmes
28ba578fc7 Fix invalid reschedule revlog entries
https://forums.ankiweb.net/t/statistics-messed-up-after-fsrs-reschedule/54622

Caused by syncing the revlogs in a normal sync to a client that doesn't
understand them yet - they end up using the default for RevlogReviewKind
instead, which is 0.
2025-01-24 19:06:50 +11:00
Damien Elmes
5f68c5208e Use only newer vite version
https://github.com/ankitects/anki/pull/3765
2025-01-24 18:36:38 +11:00
Damien Elmes
455677a5c0 Ensure sveltekit gets built before congrats page
Fixes race condition in build
2025-01-24 18:32:19 +11:00
Damien Elmes
2d1c6c64e8 Add a separate route for card info in the sidebar
The move to Sveltekit broke the 'card info during review' add-on and
its descendants. This didn't get noticed in 24.11 due to the old
card-info.js file still being shipped.

I considered adding back the card-info.js generation, but it ended up
being simpler to move parts of the add-on into a separate page instead.
This is a stop-gap solution - in the future I'd like to get us to a
point where such component compositions can be done by add-ons,
and don't need to be done as part of Anki's build process.

Related: #3187
2025-01-24 18:08:11 +11:00
Damien Elmes
774d57cdc8 Restore the missing external congrats page 2025-01-24 16:21:36 +11:00
Damien Elmes
bc48eb4595 Log Anki version at startup
Useful for confirming running version when debugging startup problems
2025-01-24 14:33:34 +11:00
Damien Elmes
c9e0469f60 Bump vite for latest CVE 2025-01-24 14:07:01 +11:00
Damien Elmes
5974f5df7e Mention how about is not intended to mirror CONTRIBUTORS
https://github.com/ankitects/anki/pull/3750
https://github.com/ankitects/anki/pull/3575
2025-01-24 14:07:01 +11:00
Damien Elmes
06ef25755b Ensure pyoxidizer rebuilt on arch change
Fixes broken builds when switching between ARM and AMD on a Mac.
2025-01-24 12:50:00 +11:00
Damien Elmes
46310612ae Add camera to entitlements
https://forums.ankiweb.net/t/are-there-any-plans-to-allow-the-use-of-the-webcam-in-anki-for-mac/53851
2025-01-24 12:47:20 +11:00
user1823
64ca90934b
Increase font size in debug console (#3743) 2025-01-20 06:47:33 +03:00
Gregory
1be94a8b04
Update about.py (#3738)
add contributor
2025-01-18 17:19:09 +11:00
llama
430d5f5639
Revert Editor.set_note's signature change with an alternative approach for #3730 (#3736)
* remove orig_note_id param

* add and use Note.orig_note_id instead

* add and use Editor.orig_note_id instead
2025-01-18 17:14:09 +11:00
Jarrett Ye
d2ced60f7c
Update to FSRS-rs v2.0.2 (L2 regularization) (#3737) 2025-01-18 16:43:53 +11:00
Ross Brown
5b8d8247f8
Fix True Retention table clipping on overflow (#3735) 2025-01-18 16:00:13 +11:00
llama
86c2887e56
Add support for copied image files when adding IO notes (#3733)
* unhardcode allowed_suffixes

* support pasting urls from clipboard when adding io notes
2025-01-18 15:59:36 +11:00
Jarrett Ye
ac2b44859e
Feat/add future projection to forgetting curve with today marker (#3732)
* Feat/Add future projection to forgetting curve with today marker

* format

* remove the vertical line
2025-01-18 15:54:53 +11:00
Luca Auer
899cb89990
Prevent stale frames from being drawn / always ensure up-to-date contents in webview (#3668)
* Prevent stale frames being drawn.

At key points where external changes enter the webview, stale images might get rendered. This ensures that a frame showing current state is always shown.

* Only stage single redraw

* Remove potentially superfluous calls to `self.update()`

* Remove potentially superfluous calls to `self.update()`.

I lost this one during some git troubles.

* Revert unrelated change

The function is supposed to take a boolean telling it whether or not the loading succeeded, which it doesn't as is. However, this is unrelated and works either way so I also reverted it again.

* chore: code cleanup

* cleanup: Remove redundant check for presence of callback

A callback will be used either way for this call, so it can be simplified. The check happens inside the handler.

* Add comment explaining why this change is necessary, referencing the relevant PR.

* Clarify comment to answer the why, not the what.

One can see what is being done, why is probably more important.
2025-01-18 15:54:20 +11:00
Damien Elmes
7ba143bad8 Update translations 2025-01-17 16:03:17 +11:00
Damien Elmes
73d6641b7f Bump version 2025-01-17 16:03:17 +11:00
Damien Elmes
0653dae86c Unify AMD and ARM Docker images
+ Initial groundwork for AMD64 builds on ARM/Rosetta. Not currently
viable due to bugs in either Linux or Rosetta which results in a
Sveltekit build hanging indefinitely.
2025-01-17 16:03:17 +11:00
llama
9c0911891d
Fix "Create copy" for IO notes (#3730)
* expose get_image_occlusion_fields

* fix create copy for io

* revert current impl

* passthru original note id when creating copy

* add IOCloningMode

* fix create copy for io
2025-01-17 16:03:00 +11:00
Abdo
3acca96ed8
Fix issue in regex for underscored CSS imports (#3728)
* Use lazy quantifier in UNDERSCORED_CSS_IMPORTS regex

* Add test
2025-01-17 15:48:58 +11:00
user1823
c35237c94d
Don't treat manually scheduled cards with no reps as new cards (#3727)
Complements the change in https://github.com/ankitects/anki/pull/3639, ensuring that scheduler and rescheduling produce the same results.
2025-01-17 15:48:41 +11:00
Lukas Sommer
d153ce9241
Comments for translators (#3729) 2025-01-17 06:11:07 +03:00
user1823
5ef2328ea4
Clear memory states during bulk action if item is None (#3717)
* Clear memory states during bulk action if item is None

Prevents issues like https://forums.ankiweb.net/t/suggestion-copy-card-debug-info-button/54206/10 and https://github.com/ankitects/anki/issues/3634

* Fix entries not being removed if ignore_before_date after the last grade

* Fix test failure

* Also clear memory states when rescheduling using FSRS helper add-on if item is None
2025-01-15 20:49:15 +11:00
Luc Mcgrady
146a0b2dcf
"Copy template as markdown" button. (#3719)
* Added: Copy template info button

* Consistent with Ankidroid

* Fix: Missing newline

* Renamed variables

* ./check

* Fix: Remove ``` from templates

* Stylistic changes

* ./check
2025-01-15 20:29:35 +11:00