Ignore muted files in Site.needFile
This commit is contained in:
parent
4153f60258
commit
4d4880a5c8
1 changed files with 11 additions and 1 deletions
|
@ -216,11 +216,21 @@ class SiteStoragePlugin(object):
|
|||
filter_storage.includeUpdateAll()
|
||||
return super(SiteStoragePlugin, self).onUpdated(inner_path, file=file)
|
||||
|
||||
@PluginManager.registerTo("Site")
|
||||
class SitePlugin(object):
|
||||
def needFile(self, inner_path, update=False, blocking=True, peer=None, priority=0):
|
||||
self.log.debug(f'needFile {inner_path}')
|
||||
matches = re.findall('/(1[A-Za-z0-9]{26,35})/', inner_path)
|
||||
for auth_address in matches:
|
||||
if filter_storage.isMuted(auth_address):
|
||||
self.log.info(f'Mute match in Site.needFile: {auth_address}, ignoring {inner_path}')
|
||||
return False
|
||||
return super(SitePlugin, self).needFile(inner_path, update, blocking, peer, priority)
|
||||
|
||||
@PluginManager.registerTo("FileRequest")
|
||||
class FileRequestPlugin:
|
||||
def actionUpdate(self, params):
|
||||
inner_path = params.get('inner_path', '')
|
||||
self.log.info(f'FileRequest.actionUpdate {inner_path}')
|
||||
matches = re.findall('/(1[A-Za-z0-9]{26,35})/', inner_path)
|
||||
for auth_address in matches:
|
||||
if filter_storage.isMuted(auth_address):
|
||||
|
|
Loading…
Reference in a new issue