diff --git a/anki/consts.py b/anki/consts.py index 682314a23..1b219941b 100644 --- a/anki/consts.py +++ b/anki/consts.py @@ -47,7 +47,7 @@ SCHEMA_VERSION = 11 SYNC_ZIP_SIZE = int(2.5*1024*1024) SYNC_ZIP_COUNT = 100 SYNC_URL = os.environ.get("SYNC_URL") or "https://ankiweb.net/sync/" -SYNC_VER = 7 +SYNC_VER = 8 HELP_SITE="http://ankisrs.net/docs/manual.html" diff --git a/anki/sync.py b/anki/sync.py index c854ea249..e8a53a002 100644 --- a/anki/sync.py +++ b/anki/sync.py @@ -2,10 +2,16 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -import urllib, os, sys, httplib2, gzip +import urllib +import os +import sys +import gzip +import random from cStringIO import StringIO + +import httplib2 from anki.db import DB -from anki.utils import ids2str, intTime, json, isWin, isMac, platDesc +from anki.utils import ids2str, intTime, json, isWin, isMac, platDesc, checksum from anki.consts import * from hooks import runHook import anki @@ -519,6 +525,7 @@ class HttpSyncer(object): def __init__(self, hkey=None, con=None): self.hkey = hkey + self.skey = checksum(str(random.random()))[:8] self.con = con or httpCon() def assertOk(self, resp): @@ -541,6 +548,7 @@ class HttpSyncer(object): vars['c'] = 1 if comp else 0 if hkey: vars['k'] = self.hkey + vars['s'] = self.skey for (key, value) in vars.items(): buf.write(bdry + "\r\n") buf.write(