Go to file
Damien Elmes cf45cbf429
Rework syncing code, and replace local sync server (#2329)
This PR replaces the existing Python-driven sync server with a new one in Rust.
The new server supports both collection and media syncing, and is compatible
with both the new protocol mentioned below, and older clients. A setting has
been added to the preferences screen to point Anki to a local server, and a
similar setting is likely to come to AnkiMobile soon.

Documentation is available here: <https://docs.ankiweb.net/sync-server.html>

In addition to the new server and refactoring, this PR also makes changes to the
sync protocol. The existing sync protocol places payloads and metadata inside a
multipart POST body, which causes a few headaches:

- Legacy clients build the request in a non-deterministic order, meaning the
entire request needs to be scanned to extract the metadata.
- Reqwest's multipart API directly writes the multipart body, without exposing
the resulting stream to us, making it harder to track the progress of the
transfer. We've been relying on a patched version of reqwest for timeouts,
which is a pain to keep up to date.

To address these issues, the metadata is now sent in a HTTP header, with the
data payload sent directly in the body. Instead of the slower gzip, we now
use zstd. The old timeout handling code has been replaced with a new implementation
that wraps the request and response body streams to track progress, allowing us
to drop the git dependencies for reqwest, hyper-timeout and tokio-io-timeout.

The main other change to the protocol is that one-way syncs no longer need to
downgrade the collection to schema 11 prior to sending.
2023-01-18 12:43:46 +10:00
.buildkite Whitelist dependabot 2023-01-07 09:53:29 +10:00
.cargo Re-enable formatting for .toml files 2022-11-28 09:16:28 +10:00
.config Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
.github/ISSUE_TEMPLATE Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.vscode.dist Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
build Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
cargo Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
docs Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
ftl Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
proto Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
pylib Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
python Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
qt Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
rslib Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
sass Auto-hide toolbar in Reviewer (#2262) 2023-01-09 14:39:31 +10:00
tools Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
ts Fix and refactor image size constraints (#2318) 2023-01-13 23:18:25 +10:00
.deny.toml Migrate from slog to tracing 2022-12-24 10:44:40 +10:00
.dprint.json Update Chrono Crate (#2242) 2022-12-07 17:00:14 +10:00
.eslintrc.js Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.gitattributes try again to improve GitHub's language stats 2021-01-20 13:20:45 +10:00
.gitignore Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
.gitmodules Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.isort.cfg Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.mypy.ini Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.prettierignore Improved add-on extension API (#1626) 2022-02-03 14:52:11 +10:00
.prettierrc Mathjax editor improvements (#1502) 2021-11-23 10:27:32 +10:00
.pylintrc Switch back to winrt to see if it fixes slow TTS 2022-12-06 20:30:54 +10:00
.rustfmt-empty.toml Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
.rustfmt.toml Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
.version Bump version 2023-01-09 11:08:53 +10:00
Cargo.lock Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
Cargo.toml Rework syncing code, and replace local sync server (#2329) 2023-01-18 12:43:46 +10:00
CONTRIBUTORS Nested clozes and increased cloze meta data (#2141) 2022-12-19 12:03:15 +10:00
LICENSE move aqt_data into source folder; implement wheel building 2020-11-04 12:14:03 +10:00
ninja Add env var to enable sourcemaps 2022-12-04 11:37:16 +10:00
package.json Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
pkgkey.asc add public key for release signing 2018-09-18 10:40:45 +10:00
README.md fix build badge 2021-06-24 09:21:56 +10:00
run Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
run.bat Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
rust-toolchain.toml Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
SECURITY.md add SECURITY.md 2021-09-22 22:55:19 +10:00
yarn.lock Update json5 due to CWE 2023-01-03 13:03:25 +10:00

Anki

Build status

This repo contains the source code for the computer version of Anki.

If you'd like to try development builds of Anki but don't feel comfortable building the code, please see https://betas.ankiweb.net/

For more information on building, please see Development.