Commit Graph

116 Commits

Author SHA1 Message Date
Damien Elmes
20dc281558 Revert "Update to Qt 6.6.1 on Mac"
This reverts commit cbab96ec75.

This moves the bundle back to Qt 5.3 due to
https://forums.ankiweb.net/t/anki-23-12-mac-apple-qt6-dmg-crashing-on-browser/38783

We'll move back up when 6.6.2 comes out in mid-late Jan.
2023-12-28 18:17:50 +10:00
Abdo
3e5458b3db
Skip tests failing around rollover hour (#2909)
* Skip tests failing around rollover hour

* Set ANKI_TEST_MODE for Rust tests instead
2023-12-28 18:06:19 +10:00
Damien Elmes
425d9e3fe1 Fix mpv not working out of the box in win32 source build
Regressed in 711c28e1a5
2023-12-06 11:34:56 +10:00
Damien Elmes
cbab96ec75 Update to Qt 6.6.1 on Mac
This also fixes the Mac bundle using an old Qt version.

Linux held back due to ABI breakage; should be fixed in about a week
when PyQt 6.6.1 comes out. Windows build also fails to run - not sure
if it's the same issue or not.
2023-12-04 16:15:52 +10:00
Abdo
dc3bd3efde
Replace css_browser_selector with our own implementation (#2854)
* Replace css_browser_selector

* Add classes to root element instead of body

* Export addBrowserClasses() in reviewer_extras for mobile clients (dae)

* Avoid setting .mac on iOS devices (dae)
2023-11-30 10:57:33 +10:00
Abdo
e88dfb68a5
Load MathJax's text-chtml-full component in reviewer/previewer (#2836)
* Load MathJax's text-chtml-full in review screens

* Remove no longer needed MathJax extensions
2023-11-20 16:50:55 +10:00
Damien Elmes
a5cd3f32f4 Fix broken bundling on Windows 11
When Windows notices "install" in the filename it triggers a UAC elevation,
causing 'cargo run' to fail.
2023-11-20 12:01:34 +10:00
Damien Elmes
f9d5f422e4 Fix Android backend failing to build on Windows with n2 2023-11-08 13:31:35 +10:00
Damien Elmes
afa39e7d96 Give users a hint when they try to build from a source tarball 2023-11-04 08:35:44 +10:00
Damien Elmes
b4c9e54347 Jemalloc no longer seems to fail in cross-compile builds 2023-11-02 19:56:08 +10:00
Damien Elmes
373a63f610 Work around Xcode 15 breaking older macOS versions 2023-11-02 19:54:44 +10:00
Damien Elmes
9600f033f7 Add reviewer_extras.css
Will help with https://github.com/ankidroid/Anki-Android-Backend/issues/313
2023-10-27 03:07:31 +10:00
Damien Elmes
b2d515c8bb Update to Qt 6.5.3 on Windows/Mac
+ Fix incorrect version selection on Mac

Closes #2733 (except for Linux users)
2023-10-15 09:48:36 +10:00
Gulshan Singh
a230c754b9
Add Sphinx documentation generation functionality (#2720)
* Add Sphinx documentation generation functionality

* sphinx-docs -> python/sphinx

* Use ninja instead of make

* Update copyright info in sphinx docs

* Run sphinx-apidoc before building Sphinx docs

* Cleanup Sphinx path insertion

* Don't write build outputs into source; use autoapi

* aqt -> _aqt

* Mention sphinx in development.md

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2023-10-13 13:03:54 +10:00
Damien Elmes
d7ff99780e Improve Python Protobuf speed
upb was being included in the bundle, but not found at run time due
to src files being embedded in the binary.
2023-10-04 13:36:47 +10:00
Damien Elmes
2ab8aa002e QtQml was also required 2023-09-24 16:42:26 +10:00
Damien Elmes
52293dc371 Update Qt for Mac bundle 2023-09-24 16:24:11 +10:00
Damien Elmes
d441680984 Remove select image button in I/O
Closes #2620
2023-09-17 11:51:48 +10:00
RumovZ
850043b49b
Tooltips for CSV import and import page refactoring (#2655)
* Make enum selector generic

* Refactor ImportCsvPage to support tooltips

* Improve csv import defaults

* Unify import pages

* Improve import page styling

* Fix life cycle issue with import properties

* Remove size constraints to fix scrollbar styling

* Add help strings and urls to csv import page

* Show ErrorPage on ImportPage error

* Fix escaping of import path

* Unify ImportPage and ImportLogPage

* Apply suggestions from code review (dae)

* Fix import progress

* Fix preview overflowing container

* Don't include <br> in FileIoErrors (dae)

e.g. 500: Failed to read '/home/dae/foo2.csv':<br>stream did not contain valid UTF-8

I thought about using {@html ...} here, but that's a potential security issue,
as the filename is not something we control.
2023-09-14 09:06:15 +10:00
RumovZ
14de8451dc
Merging Notetypes on Import (#2612)
* Remember original id when importing notetype

* Reuse notetypes with matching original id

* Add field and template ids

* Enable merging imported notetypes

* Fix test

Note should be updated if the incoming note's notetype is
remapped to the existing note's notetype.
On the other hand, it should be skipped if its notetype id is mapped
to some new notetype.

* Change field and template ids to i32

* Add merge notetypes flag to proto message

* Add dialog for apkg import

* Move HelpModal into components

* Generalize import dialog

* Move SettingTitle into components

* Add help modal to ImportAnkiPackagePage

* Move SwitchRow into components

* Fix backend method import

* Make testable in browser

* Fix broken modal

* Wrap in container and fix margins

* Update commented Anki version of new proto fields

* Check ids when comparing notetype schemas

* Add tooltip for merging notetypes.

* Allow updating notes regardless of mtime

* Gitignore yarn-error.log

* Allow updating notetypes regardless of mtime

* Fix apkg help carousel

* Use i64s for template and field ids

* Add option to omit importing scheduling info

* Restore last settings in apkg import dialog

* Display error when getting metadata in webview

* Update manual links for apkg importing

* Apply suggestions from code review

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>

* Omit schduling -> Import all cards as new cards

* Tweak importing-update-notes-help

* UpdateCondition → ImportAnkiPackageUpdateCondition

* Load keyboard.ftl

* Skip updating dupes in 'update alwyas' case

* Explain more when merging notetypes is required

* "omit scheduling" → "with scheduling"

* Skip updating notetype dupes if 'update always'

* Merge duplicated notetypes from previous imports

* Fix rebase aftermath

* Fix panic when merging

* Clarify 'update notetypes' help

* Mention 'merge notetypes' in the log

* Add a test which covers the previously panicking path

* Use nested ftl messages to ensure consistency

* Make order of merged fields deterministic

* Rewrite test to trigger panic

* Update version comment on new fields
2023-09-09 09:00:55 +10:00
Damien Elmes
6cf38b0326 Update to the latest nextest; use --locked as recommended by them 2023-09-08 07:57:15 +10:00
Damien Elmes
b29c147a5d Improve error message when command fails to run 2023-09-07 14:55:52 +10:00
Damien Elmes
25cab1c67a Revert "Revert "Pull in latest upstream n2 fixes""
Was some debug code in my status hiding patch; commit link updated.
2023-08-31 08:31:43 +10:00
Damien Elmes
1100bb6fe8 Revert "Pull in latest upstream n2 fixes"
This reverts commit e07e60495b.

Latest update has an issue on macOS.
2023-08-31 08:00:34 +10:00
Damien Elmes
e07e60495b Pull in latest upstream n2 fixes
- Fixes an issue where tasks would continue to appear active for a while
after they had finished on Unix platforms
- The latest n2 now behaves the same way as ninja when substituting
variables, so we no longer need to do the substitution ourselves.
2023-08-31 07:40:57 +10:00
Damien Elmes
dcf91fcc50 Fix ninja compatibility 2023-08-25 02:45:16 +10:00
Damien Elmes
239e964c42
Shift output suppression into n2 (#2618)
After updating with tools/install-n2, you should now be able to see
the last line of long-running commands like cargo invocations.
2023-08-23 11:59:52 +10:00
Abdo
98715e593a
Improve presentation of importing results (#2568)
* Implement import log screen in Svelte

* Show filename in import log screen title

* Remove unused NoteRow property

* Show number of imported notes

* Use a single nid expression

* Use 'count' as variable name for consistency

* Import from @tslib/backend instead

* Fix summary_template typing

* Fix clippy warning

* Apply suggestions from code review

* Fix imports

* Contents -> Fields

* Increase max length of browser search bar

https://github.com/ankitects/anki/pull/2568/files#r1255227035

* Fix race condition in Bootstrap tooltip destruction

https://github.com/twbs/bootstrap/issues/37474

* summary_template -> summaryTemplate

* Make show link a button

* Run import ops on Svelte side

* Fix geometry not being restored in CSV Import page

* Make VirtualTable fill available height

* Keep CSV dialog modal

* Reword importing-existing-notes-skipped

* Avoid mentioning matching based on first field

* Change tick and cross icons

* List skipped notes last

* Pure CSS spinner

* Move set_wants_abort() call to relevant dialogs

* Show number of imported cards

* Remove bold from first sentence and indent summaries

* Update UI after import operations

* Add close button to import log page

Also make virtual table react to resize event.

* Fix typing

* Make CSV dialog non-modal again

Otherwise user can't interact with browser window.

* Update window modality after import

* Commit DB and update undo actions after import op

* Split frontend proto into separate file, so backend can ignore it

Currently the automatically-generated frontend RPC methods get placed in
'backend.js' with all the backend methods; we could optionally split them
into a separate 'frontend.js' file in the future.

* Migrate import_done from a bridgecmd to a HTTP request

* Update plural form of importing-notes-added

* Move import response handling to mediasrv

* Move task callback to script section

* Avoid unnecessary :global()

* .log cannot be missing if result exists

* Move import log search handling to mediasrv

* Type common params of ImportLogDialog

* Use else if

* Remove console.log()

* Add way to test apkg imports in new log screen

* Remove unused import

* Get actual card count for CSV imports

* Use import type

* Fix typing error

* Ignore import log when checking for changes in Python layer

* Apply suggestions from code review

* Remove imported card count for now

* Avoid non-null assertion in assignment

* Change showInBrowser to take an array of notes

* Use dataclasses for import log args

* Simplify ResultWithChanges in TS

* Only abort import when window is modal

* Fix ResultWithChanges typing

* Fix Rust warnings

* Only log one duplicate per incoming note

* Update wording about note updates

* Remove caveat about found_notes

* Reduce font size

* Remove redundant map

* Give credit to loading.io

* Remove unused line

---------

Co-authored-by: RumovZ <gp5glkw78@relay.firefox.com>
2023-08-02 20:29:44 +10:00
Derek Dang
ca41dfeb3d
Fix a11y-noninteractive-element-interactions (#2578)
* Fix a11y-noninteractive-element-interactions

* Update CONTRIBUTORS

* Fix formatting issues

* Address a11y-noninteractive-element-interactions
2023-07-17 14:34:09 +10:00
Damien Elmes
fc0bff4166 Add updated script for transforming ftl text 2023-07-06 22:27:09 +10:00
Damien Elmes
13572a86b2 Move i18n helpers into ftl/, with a single main.rs
Clap gives us a nice help message and better arg parsing
2023-07-04 10:47:15 +10:00
Damien Elmes
79779f915e Avoid :pages prefix on ts/*, so build rule matches folder location 2023-07-03 17:24:27 +10:00
Damien Elmes
a06e2335c4 Merge the separate editor index files
They're almost the same, and the extra work competes for CPU cores
with the other build steps.
2023-07-03 17:24:27 +10:00
Damien Elmes
9f5b7e79cc Move markpure to TypeScript
Combined with the previous changes, this allows the mobile clients to
build the web components without having to set up a Python environment,
and should speed up AnkiDroid CI.
2023-07-03 17:24:27 +10:00
Damien Elmes
cb8007ce30 Move .py i18n method generation to Rust 2023-07-03 15:58:46 +10:00
Damien Elmes
4c76e3150b Move .ts i18n method generation to Rust
Based on a similar approach I used for AnkiDroid. The separate modules
file has been integrated into ftl.js.
2023-07-03 14:36:09 +10:00
Damien Elmes
f3b6deefe9 Combine all backend methods into a single js/d.ts file, like in Python
Easier to import from, and allows us to declare the output of the build
action without having to iterate over all the proto filenames. Have
confirmed it doesn't break esbuild's tree shaking.
2023-07-03 13:46:38 +10:00
Damien Elmes
62c7cdc543 Add scss formatter 2023-07-03 09:44:38 +10:00
Damien Elmes
711c28e1a5 Fix some Windows path issues
- Don't bake modified PATH in to build.ninja; instead set it at run time.
- Add win audio in build.rs, as doing it in run.bat results in it being
added multiple times when you run multiple times.
2023-07-02 18:22:44 +10:00
Damien Elmes
c6f429ab17 Add option to use LTO in release builds
Shrinks rslib.so from about 40MB to about 26MB, at the cost of considerably
higher build time in a release build.
2023-07-02 18:22:44 +10:00
Damien Elmes
56a1046ff8 Fix bundling
PyOxidizer binary is now going into a platform folder, and our Qt
deps moved.
2023-07-02 18:22:44 +10:00
Damien Elmes
b4bfc1a80d Let ninja/n2 do the configure invocation
I'd introduced maybe_reconfigure_build() after running into issues where
configure was not being invoked, but have discovered why that was happening:
the out folder path must be identical to the canonical path listed in
build.ninja, which it wasn't when a symlink was used. With this change,
we avoid having to invoke ninja twice, and get visibility into the
configure step.

This also makes rsbridge only depend on out/env, which prevents it from
being rebuilt when any reconfigure happens.
2023-07-02 18:22:44 +10:00
Damien Elmes
821b034b37 Fix clean build failure 2023-07-02 14:55:47 +10:00
Damien Elmes
c8458fce16
Update to Svelte 4, and update most other JS deps (#2565)
* eslint-plugin-svelte3 -> eslint-plugin-svelte

The former is deprecated, and blocks an update to Svelte 4.

Also drop unused svelte2tsx and types package.

* Drop unused symbols code for now

It may be added back in the future, but for now dropping it will save
200k from our editor bundle.

* Remove sass and caniuse-lite pins

The latter no longer seems to be required. The former was added to
suppress deprecation warnings when compiling the old bootstrap version
we have pinned. Those are hidden by the build tool now (though we really
need to address them at one point: https://github.com/ankitects/anki/issues/1385)

Also removed unused files section.

* Prevent proto compile from looking in node_modules/@types/sass

When deps are updated, tsc aborts because @types/sass is a dummy package
without an index.d.ts file.

* Filter Svelte warnings out of ./run

* Update to latest Bootstrap

This fixes the deprecation warnings we were getting during build:
bootstrap doesn't accept runtime CSS variables being set in Sass, as
it wants to apply transforms to the colors.

Closes #1385

* Start port to Svelte 4

- svelte-check tests have a bunch of failures; ./run works
- Svelte no longer exposes internals, so we can't use create_in_transition
- Also update esbuild and related components like esbuild-svelte

* Fix test failures

Had to add some more a11y warning ignores - have added
https://github.com/ankitects/anki/issues/2564 to address that in the
future.

* Remove some dependency pins

+ Remove sass, we don't need it directly

* Bump remaining JS deps that have a current semver

* Upgrade dprint/license-checker/marked

The new helper method avoids marked printing deprecation warnings to
the console.

Also remove unused lodash/long types, and move lodahs-es to devdeps

* Upgrade eslint and fluent packages

* Update @floating-ui/dom

The only dependencies remaining are currently blocked:

- Jest 29 gives some error about require vs import; may not be worth
investigating if we switch to Deno for the tests
- CodeMirror 6 is a big API change and will need work.

* Roll dprint back to an earlier version

GitHub dropped support for Ubuntu 18 runners, causing dprint's artifacts
to require a glibc version greater than what Anki CI currently has.
2023-07-01 16:21:53 +10:00
Damien Elmes
baa631c6ef Migrate proto build actions to ninja_gen; switch from dyn Error to anyhow 2023-06-30 19:37:02 +10:00
Damien Elmes
0bf4fddf40 Use a build input instead of build var for substituted binaries
The vars were not resolved when listed as inputs to other rules, which
was causing problems when using n2, and this approach is simpler.
2023-06-30 19:13:35 +10:00
Damien Elmes
01f9c600af Use overriden node/protoc binaries as inputs
https://forums.ankiweb.net/t/getting-error-when-python-protoc-and-node-binary-path-set-in-environment/31615
2023-06-28 10:08:32 +10:00
Damien Elmes
b2e7ab522b Remove some unused Rust dependencies 2023-06-24 19:30:29 +10:00
Damien Elmes
e9415b43f4 Migrate archive tool into runner
Also fix minilints declaring a stamp it wasn't creating. The same
approach is necessary with archives now too, as it no longer executes
under a standard "runner run".

For now, rustls is hard-coded - we could pass the desired TLS impl in
from the ./ninja script, but the runner is not recompiled frequently
anyway.
2023-06-23 17:41:31 +10:00
Damien Elmes
40e1520acb Drop workspace-hack in favor of workspace deps
Workspace deps were introduced in Rust 1.64. They don't cover all the
cases that Hakari did unfortunately, but they are simpler to maintain,
and they avoid a couple of issues that Hakari had:

- It sometimes made updating dependencies harder due to the locked versions,
so you had to disable Hakari, do the updates, and then re-generate (
e.g. 943dddf28f)
- The current Hakari config was breaking AnkiDroid's build, as it was
stopping a cross-compile from functioning correctly.
2023-06-23 17:41:31 +10:00