Go to file
2013-08-02 01:09:28 +07:00
AnkiServer Added basic authentication support 2013-08-02 00:08:32 +07:00
tests Added a quick way to get a list of all collections. 2013-07-31 18:17:58 +01:00
.coveragerc Got almost 80% test coverage of AnkiServer/apps/rest_app.py and fixed some bugs. 2013-07-15 17:11:28 +01:00
.gitignore Got nearly 100% test coverage for AnkiServer/collection.py 2013-07-15 15:27:13 +01:00
example.ini Squashed commit of the following: 2013-07-12 22:08:16 +01:00
logging.conf Committed old Anki 1.2 sync server code. It's not very generic. :-/ 2013-04-03 14:31:44 +01:00
README.md Updated README.md 2013-08-02 01:09:28 +07:00
setup.py Squashed commit of the following: 2013-07-12 22:08:16 +01:00
supervisor-anki-server.conf Updated the supervisord example config. 2013-07-17 19:19:37 +01:00

Anki Sync Server

A personal Anki sync server (so you can sync against your own server rather than AnkiWeb).

It also includes a RESTful API, so that you could implement your own AnkiWeb if wanted.

Installing

Instructions for installing and running AnkiServer:

  1. First, you need to install "virtualenv". If your system has easy_install, this is just a matter of:

    $ easy_install virtualenv

    If your system doesn't have easy_install, I recommend getting it!

  2. Next, you need to create a Python environment for running AnkiServer and install some of the dependencies we need there:

    $ virtualenv AnkiServer.env $ AnkiServer.env/bin/easy_install webob PasteDeploy PasteScript sqlalchemy simplejson

  3. Download and install libanki. You can find the latest release of Anki here:

    http://code.google.com/p/anki/downloads/list

    Look for a *.tgz file with a Summary of "Anki Source". At the time of this writing that is anki-2.0.11.tgz.

    Download this file and extract.

    Then either:

    a. Run the 'make install', or

    b. Copy the entire directory to /usr/share/anki

  4. Make the egg info files (so paster can see our app):

    $ AnkiServer.env/bin/python setup.py egg_info

  5. Copy the example.ini to production.ini and edit for your needs.

  6. Create authentication database:

    $ sqlite3 auth.db 'create table auth (user varchar primary key, hash varchar)'

  7. Create user:

    Enter username and password when prompted.

    $ read -p "Username: " USER && read -sp "Password: " PASS

    $ SALT=$(openssl rand -hex 8)

    $ HASH=$(echo -n $USER$PASS$SALT | sha256sum | sed 's/[ ]*-$//')$SALT

    $ sqlite3 test.db "INSERT INTO auth VALUES ('$USER', '$HASH')"

    $ mkdir -p collections/$USER

    $ unset USER PASS SALT HASH

  8. Then we can run AnkiServer like so:

    $ AnkiServer.env/bin/paster serve production.ini