Don't accept file update if it's from muted user
refs https://github.com/HelloZeroNet/ZeroNet/issues/1855
This commit is contained in:
parent
a334eefdf7
commit
4153f60258
1 changed files with 12 additions and 0 deletions
|
@ -216,6 +216,18 @@ class SiteStoragePlugin(object):
|
||||||
filter_storage.includeUpdateAll()
|
filter_storage.includeUpdateAll()
|
||||||
return super(SiteStoragePlugin, self).onUpdated(inner_path, file=file)
|
return super(SiteStoragePlugin, self).onUpdated(inner_path, file=file)
|
||||||
|
|
||||||
|
@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):
|
||||||
|
self.log.info(f'Mute match in FileRequest.actionUpdate: {auth_address}, ignoring {inner_path}')
|
||||||
|
self.response({'ok': f'Thanks, file {inner_path} updated!'})
|
||||||
|
return False
|
||||||
|
return super(FileRequestPlugin, self).actionUpdate(params)
|
||||||
|
|
||||||
@PluginManager.registerTo("UiRequest")
|
@PluginManager.registerTo("UiRequest")
|
||||||
class UiRequestPlugin(object):
|
class UiRequestPlugin(object):
|
||||||
|
|
Loading…
Reference in a new issue