Commit Graph

99 Commits

Author SHA1 Message Date
flan
ac1920d078 Make SyncMediaHandler not inherit anki.sync.MediaSyncer
All endpoints are implemented in the child class now, so there's
no need to use any code from the parent class.
2020-01-04 05:51:33 +01:00
flan
c07fe0e65c Print version on startup
The version is determined from either the contents of _version.py
(expected to be present in release tarballs) or the output of
`git describe --always`.
2020-01-04 05:39:24 +01:00
flan
316e553681 Make comment for SyncCollectionHandler.removed() less confusing 2020-01-03 03:03:21 +01:00
flan
7f551f47f7 Remove unused argument to logger.error() 2020-01-03 03:02:42 +01:00
flan
7ef3d4f3fa Fix full sync on Windows
From <https://docs.python.org/3.7/library/os.html#os.rename>:
> On Windows, if dst already exists, OSError will be raised even if
> it is a file.
...
> If you want cross-platform overwriting of the destination, use
> replace().

Thanks to kerry liu (https://github.com/hqzxjczx) for reporting this.

Fixes #32.
2019-04-16 19:57:24 +02:00
flan
b9a1203491 Don't create DBs during schema check if they don't exist 2019-03-16 15:24:46 +01:00
flan
5ad14b01b4 Notify the user about DB migrations 2019-03-14 00:45:29 +01:00
Anton Melser
fa89b0e0a2 Load the CollectionWrapper from a factory method
This allows a class implementing CollectionWrapper's interface to be
added from config
2019-03-09 14:05:15 +08:00
Anton Melser
9ee9697582 Move the upload/download sqlite3 file logic to a manager
Also add a factory method so the manager can be controlled via config
2019-03-09 14:05:15 +08:00
Anton Melser
50cc6a12d9 Use factory method for session_manager
Also add some abstraction over the SQL to allow for different SQL
dialects
2019-03-09 14:05:15 +08:00
Anton Melser
ea0cbc669b Use factory method for user_manager
Also add some abstraction over the SQL to allow for different SQL
dialects
2019-03-09 14:05:12 +08:00
flan
7b408bdf5b Don't log very long strings unless debugging 2019-03-08 17:00:59 +01:00
flan
4fe378adce Add username field to CollectionWrapper 2019-03-08 14:24:58 +01:00
flan
5051144124 Include request parameters in log messages 2019-03-08 14:24:58 +01:00
flan
f5b6cf464d Include time in log messages 2019-03-08 14:24:58 +01:00
flan
fe635b317f Use logging module for HTTP request logging too 2019-03-08 14:24:58 +01:00
flan
47cf75d8d6 Log all ankisyncd events under ankisyncd.* 2019-03-08 14:24:58 +01:00
Anton Melser
75fecf6e6f Add support for setting/overriding config from envvars
This is practical for environments like docker/kubernetes
2019-03-08 15:11:32 +08:00
flan
970664e6a9 Revert "Simplify version suffix patch"
95ccbfdd36 broke it

This reverts commit 61b4582364.
2019-02-19 00:52:43 +01:00
flan
61b4582364 Simplify version suffix patch 2018-12-24 16:31:36 +01:00
reivilibre
da1150d7af Fixes inability to sync with beta versions of Anki
The version string for '2.1.6-beta2' is reported as '2.1.6-' which
causes a problem when trying to parse '6-' as an integer.
2018-12-13 00:36:13 +01:00
flan
c68fd12d67 Make config paths easier to override 2018-08-28 18:07:27 +02:00
flan
92d6579c83 Replace remaining prints with logging.info calls 2018-08-28 17:59:29 +02:00
flan
527991beea Don't check if config file exists before loading it 2018-08-28 17:58:11 +02:00
flan
dbdb3ffb3b Make UserManager errors less redundant 2018-08-28 17:26:26 +02:00
flan
129647cb70 Move logging.basicConfig call up to include messages from imported modules 2018-08-28 17:16:19 +02:00
flan
5bcb01bd9e Use predefined config locations 2018-08-28 17:15:40 +02:00
flan
9fb00c80b9 Remove debug print 2018-08-22 14:22:54 +02:00
flan
ef39c8c385 Drop unsupported clients if they try to sync a v2 collection 2018-08-20 18:41:36 +02:00
flan
6b9aaa0a6c Check client version in SyncCollectionHandler.meta
When the server sends an error response (4xx/5xx), the desktop
client displays "user friendly" error messages instead of
the actual response body.
2018-08-20 18:27:43 +02:00
flan
0b9f30adea Implement applyGraves 2018-08-20 18:02:09 +02:00
flan
3e26fab3a3 Add methods removed in dae/anki@d6874de8
Reference: d6874de8c8
2018-08-20 17:03:47 +02:00
flan
a83e68412d Remove media patch, put usnLim in server code
Since dae/anki@d6874de8, usnLim always returns -1 regardless of the
`server` attribute.

Reference: d6874de8c8
2018-08-20 15:44:13 +02:00
flan
8b9961febc Prefer anki-bundled if it exists 2018-08-20 14:44:29 +02:00
flan
c3024ba396 Make the server runnable with python3 -m ankisyncd 2018-08-20 14:42:40 +02:00
flan
7ace256e0a Check for protocol version before proceeding 2017-11-09 15:56:25 +01:00
flan
de7b6ec22f Remove redundant try/catch block around os.makedirs() 2017-11-08 13:49:28 +01:00
flan
aae65cc5d8 Remove redundant else blocks 2017-11-08 13:43:27 +01:00
flan
c0ea23c307 Monkey patch anki at runtime
The server should work fine with /usr/share/anki now, as long as
external Anki version >= 2.1.
2017-11-06 23:01:08 +01:00
flan
2a27d78591 Use config specified in argv[1] 2017-11-06 21:06:45 +01:00
flan
59f28faa1e Use mapping protocol access instead of legacy configparser API 2017-11-06 21:06:18 +01:00
flan
354354ca72 Make built-in server actually use the "host" config field 2017-11-06 17:36:00 +01:00
flan
ca106e6136 Clean up imports 2017-11-06 17:27:13 +01:00
flan
7d1a222501 Remove redundant except block
ValueError is handled in _decode_data() already
2017-11-06 17:06:49 +01:00
flan
e97a11edb4 Make spacing more consistent 2017-11-06 16:56:13 +01:00
flan
9ffd380e64 Make it possible to use hooks before and after every sync operation
Excluding media sync.
2017-11-05 23:34:49 +01:00
flan
65bef264be Use int instead of str for the response code 2017-11-05 22:17:37 +01:00
flan
978b1d7371 Make _check_zip_data() and _adopt_media_changes_from_zip() take a ZipFile 2017-11-04 18:42:21 +01:00
flan
0e5bbf4f9e Use more with statements 2017-11-04 18:41:56 +01:00
flan
c9c02d3253 Resolve relative paths and symlinks before opening auth/session DB 2017-11-04 04:22:06 +01:00