mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
include a session key when syncing
This commit is contained in:
parent
2f3f285528
commit
8d7edcb2bb
2 changed files with 11 additions and 3 deletions
|
@ -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"
|
||||
|
||||
|
|
12
anki/sync.py
12
anki/sync.py
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue