Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

A personal custom Anki sync server,aim to provide an easier way for deployment

License

Notifications You must be signed in to change notification settings

ankicommunity/anki-sync-server-rs

Repository files navigation

anki-sync-server-rs

GitHub repo size LicenseGithub statusGithub contributorsDockerHub versionDockerHub pullsDockerHub stars Gitter Downloads

简体中文|English

Warning:This project is no longer maintained.

It may works with Anki clients ~2.1.64 Please use the official sync server,for more see guide

A cross-platform Anki sync server.

This is a rust (still sqlite c library backed) take on anki sync server ,which keep track of the official sync server.

Quickstart guide

Installing (binary)

  1. Grab binary from github releases and unpack it, each platform has its corresponding tag (e.g. windows_x86_64 for Windows 64bit,details see support platform ) ,enter the decompressed folder.
  2. Add user

For linux users or macOS users,run,

 ./ankisyncd user --add username password

for Windows users,open a terminal in the folder and run,

 ./ankisyncd.exe user --add username password

If you want to perform other operations ,such as deleting users or changing the password of one user,run with the --help flag for more details,

 ./ankisyncd user --help
  1. Run server ./ankisyncd (for Windows users,you can just double click the binary for a quick start).
  2. Enjoy!

Installing (Docker)

details see Docker

You can also build the binary from source code Install or build a docker image from the source DockerBuild.

Set up Anki (Clients)

Anki 2.1

>= 2.1.57

Due to the software update,Now Anki supports sync custom server settings inside the client.

  1. Go to Tools ->Preferences--<Syncing
  2. see below and enter your server address in the blank labled self-hosted sync server. Here is an example.If your server address is 192.0.0.1,then the content to fill in is http://192.0.0.1:27701/
  3. Restart Anki

<2.1.57 ((install add-on from ankiweb)

  1. Go to Tools -> Add-ons
  2. click on the button labeled Get Add-ons and enter the code 358444159.
  3. You get add-on custom sync server redirector, choose it. Then click on the config button in the bottom right corner.
  4. Apply your server IP address
  5. Restart Anki

AnkiMobile

It seems that Ankimobile now has the ability to sync against self-hosted sync server.At least for Ankimobile 2.0.90(20090.2),A post from A user has reported in Anki forum. As for the detailed steps,we will be happy to accept a PR about how to configure AnkiMobile to enable custom sync server If some one is using AnkiMobile and would be kind enough. When things do not go as expected,refer to the text:

If you're using AnkiMobile and are unable to connect to a server on your local network, please go into the iOS settings, locate Anki near the bottom, and toggle "Allow Anki to access local network" off and then on again.

From Anki tutorial

AnkiDroid

Go to Advanced -> Custom sync server (Go to Settings -> Sync -> Custom sync server in 2.16 and newer versions)

Unless you have set up a reverse proxy to handle encrypted connections, use http as the protocol. The port will be either the default 27701, or whatever you have specified in ankisyncd.toml (if using a reverse proxy, whatever port you configured to accept the front-end connection).

Use the same base url for both the Sync url and the Media sync url, but append /msync to the Media sync url. Do not append /sync to the Sync url (Note: This is not the case any more in 2.16 and newer versions).

Take IP address 192.0.0.0 for example and use default port 27701 with http protocol,the corresponsding urls are,

Sync url:http://192.0.0.0:27701

Media sync url: http://192.0.0.0:27701/msync

In 2.16 and newer versions,

Sync url:http://192.0.0.0:27701/sync/

Media sync url: http://192.0.0.0:27701/msync/

Even though the AnkiDroid login interface will request an email address, this is not actually required; it can simply be the username you configured with ankisyncd user -a.

For https setup and support see certificate setup (Note: in 2.16 and newer versions,Ankidroid could supprt http connection once more). See reverse proxy setup for setting up a reverse proxy in front of the sync server.

How to contribute

See CONTRIBUTING.md.

All contributions must be licensed under AGLP-v3.0 to comply with the license of the anki code used as the base of this project.

License

See LICENSE

Compatibility

When the server made its first appearance,we have done some tests,details see TEST

Configuration

Env vars

Ankidyncd supports setting environment variables to add accounts,ANKISYNCD_USERNAME,ANKISYNCD_PASSWORD.

Key Value
ANKISYNCD_USERNAME username,non-empty if set
ANKISYNCD_PASSWORD password,non-empty if set

Optional Server Configuration

If you want to change the location where sync data is stored, or change the listening port,you can modify the configuration file ankisyncd.toml,and then run server,

./ankisyncd  --config /path/to/ankisyncd.toml

REFERENCE

ankisyncd architecture or apis depend on ankicommunity/anki-sync-server and ankitects/anki. Sync APIs are initially based on anki/rslib 2.1.46.We almost replicated the media synchronization implementation logic in anki-sync-server.And this project is heavily dependent on upstream project Anki,that is,if the project Anki is no longer accessible,this project might be malfunctional and abandoned.

SInce 2.1.57,this project keeps track of the process of Anki sync server.