include a session key when syncing

This commit is contained in:
Damien Elmes 2013-10-10 12:02:11 +09:00
parent 2f3f285528
commit 8d7edcb2bb
2 changed files with 11 additions and 3 deletions

View file

@ -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"

View file

@ -2,10 +2,16 @@
# Copyright: Damien Elmes <anki@ichi2.net>
# 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(