Added missing fields to meta endpoint
This commit is contained in:
parent
d0f7d05b44
commit
bc889958dc
@ -50,9 +50,10 @@ logger = logging.getLogger("ankisyncd")
|
|||||||
class SyncCollectionHandler(Syncer):
|
class SyncCollectionHandler(Syncer):
|
||||||
operations = ['meta', 'applyChanges', 'start', 'applyGraves', 'chunk', 'applyChunk', 'sanityCheck2', 'finish']
|
operations = ['meta', 'applyChanges', 'start', 'applyGraves', 'chunk', 'applyChunk', 'sanityCheck2', 'finish']
|
||||||
|
|
||||||
def __init__(self, col):
|
def __init__(self, col, session):
|
||||||
# So that 'server' (the 3rd argument) can't get set
|
# So that 'server' (the 3rd argument) can't get set
|
||||||
super().__init__(self, col)
|
super().__init__(self, col)
|
||||||
|
self.session = session
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _old_client(cv):
|
def _old_client(cv):
|
||||||
@ -96,13 +97,15 @@ class SyncCollectionHandler(Syncer):
|
|||||||
self.col.media.connect()
|
self.col.media.connect()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'scm': self.col.scm,
|
|
||||||
'ts': anki.utils.intTime(),
|
|
||||||
'mod': self.col.mod,
|
'mod': self.col.mod,
|
||||||
|
'scm': self.col.scm,
|
||||||
'usn': self.col._usn,
|
'usn': self.col._usn,
|
||||||
|
'ts': anki.utils.intTime(),
|
||||||
'musn': self.col.media.lastUsn(),
|
'musn': self.col.media.lastUsn(),
|
||||||
|
'uname': self.session.name,
|
||||||
'msg': '',
|
'msg': '',
|
||||||
'cont': True,
|
'cont': True,
|
||||||
|
'hostNum': 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
def usnLim(self):
|
def usnLim(self):
|
||||||
@ -176,8 +179,9 @@ class SyncCollectionHandler(Syncer):
|
|||||||
class SyncMediaHandler:
|
class SyncMediaHandler:
|
||||||
operations = ['begin', 'mediaChanges', 'mediaSanity', 'uploadChanges', 'downloadFiles']
|
operations = ['begin', 'mediaChanges', 'mediaSanity', 'uploadChanges', 'downloadFiles']
|
||||||
|
|
||||||
def __init__(self, col):
|
def __init__(self, col, session):
|
||||||
self.col = col
|
self.col = col
|
||||||
|
self.session = session
|
||||||
|
|
||||||
def begin(self, skey):
|
def begin(self, skey):
|
||||||
return {
|
return {
|
||||||
@ -376,7 +380,7 @@ class SyncUserSession:
|
|||||||
raise Exception("no handler for {}".format(operation))
|
raise Exception("no handler for {}".format(operation))
|
||||||
|
|
||||||
if getattr(self, attr) is None:
|
if getattr(self, attr) is None:
|
||||||
setattr(self, attr, handler_class(col))
|
setattr(self, attr, handler_class(col, self))
|
||||||
handler = getattr(self, attr)
|
handler = getattr(self, attr)
|
||||||
# The col object may actually be new now! This happens when we close a collection
|
# The col object may actually be new now! This happens when we close a collection
|
||||||
# for inactivity and then later re-open it (creating a new Collection object).
|
# for inactivity and then later re-open it (creating a new Collection object).
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user