Commit Graph

59 Commits

Author SHA1 Message Date
Damien Elmes
0543a4533b add devMode flag to utils
also remove the extra toolbar call in loadProfile(), as we require a
restart to update the translations anyway
2017-08-01 14:28:13 +10:00
Illia Volochii
13b7e01044 Stop inheriting from object
It is not needed in Python 3.
2017-02-07 00:21:33 +02:00
Damien Elmes
04bc1a7766 use sync.ankiweb.net for syncing
media sync goes through the same domain now, avoiding a slow extra
SSL handshake
2017-01-29 14:57:59 +10:00
Damien Elmes
4380705992 add timeout to sync steps 2017-01-17 15:53:17 +10:00
Damien Elmes
f104044a09 adjust user agent name 2017-01-08 19:57:04 +10:00
Damien Elmes
f6245cdfd1 use requests for http; add progress info back
- wrap request in AnkiRequestsClient so we can keep track of
upload/download bytes without having to monkey patch anything
- force a 64kB buffer size instead of the default 8kB
- show one decimal point in up/down so small requests still give
visual feedback
- update add-on downloading and update check to use requests
- remove the update throttling in aqt/sync.py, as it's not really
necessary anymore
2017-01-08 19:06:32 +10:00
Damien Elmes
03b2ad37d9 add (currently unused) abort command 2016-12-25 12:54:47 +10:00
Damien Elmes
d181133ac0 some sync fixes
- fix an extra \r\n being included at the end of the last form var
- req()s in the middle of a sync should throw an exception if they
receive a 403, as the calling code does not check for an empty return
2016-12-21 10:42:13 +10:00
Christoph Mack
079d551782 Add missing boundary at end of multipart/form-data request body for requests that include no application/octet-stream data
This makes the sync request sent to the /download endpoint valid multipart/form-data according to RFC 2046, 5.1
2016-09-03 14:15:09 +02:00
Damien Elmes
05d13de766 fix up ankiweb.certs paths
also fixes
https://anki.tenderapp.com/discussions/ankidesktop/18420-portable-anki-sync-error
2016-07-07 11:58:06 +10:00
Damien Elmes
94463991bc basic sync support
currently no progress shown on large uploads/downloads
2016-07-04 15:45:53 +10:00
Damien Elmes
15b349e3a8 start port to python 3
unit tests pass and main screens of GUI load
2016-05-12 14:45:35 +10:00
Damien Elmes
a27847de58 DEV->ANKIDEV 2015-05-19 14:26:33 +10:00
Damien Elmes
a0bad7da45 update media url 2015-03-13 17:06:34 +11:00
Damien Elmes
67c86e8f5e make sure sync msg is saved before we abort sync 2015-03-12 12:51:05 +11:00
Damien Elmes
7024fed002 fix cont=False handling in sync 2015-03-02 21:09:12 +11:00
Damien Elmes
e294469521 cont should be checked befoer any further processing 2014-11-06 16:56:16 +09:00
Damien Elmes
6e7e08ebd0 be explicit about modSchema()'s check flag
- remove gui code that adds exceptions for syncing
- use check=False for all syncing and upgrade code
2014-11-03 16:28:12 +09:00
Damien Elmes
3d5d852708 reduce sync chunk size 2014-10-19 16:58:26 +09:00
Damien Elmes
3ee1937310 we need to count up for downloads
as we're streaming changes we don't know the total amount of downloads
required
2014-07-29 07:37:30 +09:00
Damien Elmes
cf801e4fb4 display more feedback when syncing media
deletes in particular take some time for the server to process, but
don't require much bandwidth, leading to the progress appearing to
have pause when content is actually being processed

this also gives the user an idea of how long the process will take to
complete
2014-07-28 17:00:26 +09:00
Damien Elmes
f5d60c70e2 remove unused functions 2014-07-28 14:28:12 +09:00
Damien Elmes
ba8ed39e13 fix media sync thinking >25 changes is a concurrent update 2014-07-15 11:36:52 +09:00
Damien Elmes
77c9d5f5f3 tweak dev url 2014-07-12 18:21:49 +09:00
Damien Elmes
df72c5a55f split media and regular server urls 2014-07-08 11:16:51 +09:00
Damien Elmes
a93c3423e3 must commit on concurrent update 2014-07-04 18:06:40 +09:00
dae
2aa7714f87 new media syncing protocol
- media syncing no longer locks the account, so it can be done
  in the background in the future, and multiple clients can safely
  sync media at the same time
- all operations are now idempotent, so they can be repeatedly safely
  in the event of a connection error
- whether it's a normal incremental sync, an initial sync,
  or the media database has been deleted, no files will be uploaded
  or downloaded if they already exist on the other side
- file removals are now chunked like additions & updates, preventing
  timeouts due to large requests
- if the server can't process a chunk in time, it will return a count
  of what it did process, so the client can retry the rest

Notes for AnkiDroid:

- when porting this, recommend you pick a different name for the
.media.db2 file, so users don't accidentally copy the AD version to
the desktop or vice versa
- please make sure filenames are added to the zip in NFC form
2014-06-26 09:00:38 +09:00
dae
bc90904acd return success if media sync completes 2014-06-05 13:33:47 +09:00
Damien Elmes
c529a77686 bundle new and old cert
fails to validate on some systems even when httplib2's default
certs are bundled, so we need this not just for SNI
2014-04-11 01:13:55 +09:00
Damien Elmes
fcc4df821f disable explicit ca_certs
may have added this to support beta.ankiweb.net as python doesn't
support SNI, but it prevents changing cert
2014-04-10 14:02:35 +09:00
Damien Elmes
4e900b4608 pass client media count to server 2013-12-09 17:36:17 +09:00
Damien Elmes
9334bc37fa log media sanity 2013-11-13 16:54:25 +09:00
Damien Elmes
bab63de768 silly me, we were overriding retries in the aqt monkeypatch 2013-10-20 10:25:25 +09:00
Damien Elmes
9b27b06b68 fix retries count for unit tests 2013-10-19 12:53:18 +09:00
Damien Elmes
313fc7c9ef more generous timeout 2013-10-18 14:22:03 +09:00
Damien Elmes
01832a9139 disable http retries
logs indicate client was retrying based on timeout and so on,
causing more problems
2013-10-18 14:21:47 +09:00
Damien Elmes
b99533a5ad add logging to some scheduling and syncing code 2013-10-18 11:52:21 +09:00
Damien Elmes
8d7edcb2bb include a session key when syncing 2013-10-10 22:59:34 +09:00
Damien Elmes
3ed2861115 include platform in cv 2013-10-06 04:37:39 +09:00
Damien Elmes
f29a04ae29 bump sync ver to 7 and change meta return value
- /sync/meta now returns a dictionary
- it includes the following extra fields
- msg: if non-empty, show this message at the end of the sync
- cont: if false, show above message and abort sync
- uname: the user's email address, so it can be stored by the local client to
  show users who have forgotten which email address they used. in the future
  this will be saved only when logging in, so do a conditional access on it
2013-10-04 06:09:28 +09:00
Damien Elmes
33403fd890 include client type in cv 2013-10-02 04:09:16 +09:00
Damien Elmes
621ba0e1ac include client version in /sync/meta 2013-10-02 03:53:10 +09:00
Damien Elmes
be78c3f9e3 better msg when media sanity fails 2013-05-30 10:54:55 +09:00
Damien Elmes
744d9abfdb fix modification check in note merge 2013-05-28 14:41:12 +09:00
Damien Elmes
dceacff47c tell server which files we need 2013-05-27 15:29:24 +09:00
Damien Elmes
0a81df60dc automatically resync media, and don't send media server already has (#583) 2013-05-27 14:25:30 +09:00
Damien Elmes
ab198c46be unify pre-check, sanity-check and upload error messages 2013-05-14 15:41:18 +09:00
Damien Elmes
e913c75fd7 perform basic check prior to syncing 2013-05-14 15:10:58 +09:00
Damien Elmes
d2535fd6cb run basic integrity check prior to full up 2013-05-13 19:36:09 +09:00
Damien Elmes
e64d825730 fix some sync issues
- better error message when upload fails
- don't show success message on error
- fix 'unable to find server' accidentally being catchall
2013-03-01 01:36:14 +09:00