Mark my optional files using directory on signing instead of file path
This commit is contained in:
parent
cd025316db
commit
e8a439cad3
2 changed files with 6 additions and 5 deletions
|
@ -173,7 +173,7 @@ class ContentDbPlugin(object):
|
||||||
is_downloaded = 1
|
is_downloaded = 1
|
||||||
else:
|
else:
|
||||||
is_downloaded = 0
|
is_downloaded = 0
|
||||||
if site.address + "/" + file_inner_path in self.my_optional_files:
|
if site.address + "/" + content_inner_dir in self.my_optional_files:
|
||||||
is_pinned = 1
|
is_pinned = 1
|
||||||
else:
|
else:
|
||||||
is_pinned = 0
|
is_pinned = 0
|
||||||
|
|
|
@ -18,12 +18,11 @@ class UiWebsocketPlugin(object):
|
||||||
self.time_peer_numbers_updated = 0
|
self.time_peer_numbers_updated = 0
|
||||||
super(UiWebsocketPlugin, self).__init__(*args, **kwargs)
|
super(UiWebsocketPlugin, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def actionFileWrite(self, to, inner_path, *args, **kwargs):
|
def actionSiteSign(self, to, privatekey=None, inner_path="content.json", *args, **kwargs):
|
||||||
super(UiWebsocketPlugin, self).actionFileWrite(to, inner_path, *args, **kwargs)
|
|
||||||
|
|
||||||
# Add file to content.db and set it as pinned
|
# Add file to content.db and set it as pinned
|
||||||
content_db = self.site.content_manager.contents.db
|
content_db = self.site.content_manager.contents.db
|
||||||
content_db.my_optional_files[self.site.address + "/" + inner_path] = time.time()
|
content_inner_dir = helper.getDirname(inner_path)
|
||||||
|
content_db.my_optional_files[self.site.address + "/" + content_inner_dir] = time.time()
|
||||||
if len(content_db.my_optional_files) > 50: # Keep only last 50
|
if len(content_db.my_optional_files) > 50: # Keep only last 50
|
||||||
oldest_key = min(
|
oldest_key = min(
|
||||||
content_db.my_optional_files.iterkeys(),
|
content_db.my_optional_files.iterkeys(),
|
||||||
|
@ -31,6 +30,8 @@ class UiWebsocketPlugin(object):
|
||||||
)
|
)
|
||||||
del content_db.my_optional_files[oldest_key]
|
del content_db.my_optional_files[oldest_key]
|
||||||
|
|
||||||
|
return super(UiWebsocketPlugin, self).actionSiteSign(to, privatekey, inner_path, *args, **kwargs)
|
||||||
|
|
||||||
def updatePeerNumbers(self):
|
def updatePeerNumbers(self):
|
||||||
content_db = self.site.content_manager.contents.db
|
content_db = self.site.content_manager.contents.db
|
||||||
content_db.updatePeerNumbers()
|
content_db.updatePeerNumbers()
|
||||||
|
|
Loading…
Reference in a new issue