Make the site block check usable from plugins and core modules
Fixes https://github.com/HelloZeroNet/ZeroNet/issues/1888
This commit is contained in:
parent
6c8849139f
commit
1144964062
3 changed files with 13 additions and 0 deletions
|
@ -24,6 +24,14 @@ class SiteManagerPlugin(object):
|
|||
super(SiteManagerPlugin, self).load(*args, **kwargs)
|
||||
filter_storage = ContentFilterStorage(site_manager=self)
|
||||
|
||||
def isAddressBlocked(self, address):
|
||||
# FIXME: code duplication of isSiteblocked(address) or isSiteblocked(address_hashed)
|
||||
# in several places here and below
|
||||
address_hashed = filter_storage.getSiteAddressHashed(address)
|
||||
if filter_storage.isSiteblocked(address) or filter_storage.isSiteblocked(address_hashed):
|
||||
return True
|
||||
return super(SiteManagerPlugin, self).isAddressBlocked(address)
|
||||
|
||||
def add(self, address, *args, **kwargs):
|
||||
should_ignore_block = kwargs.get("ignore_block") or kwargs.get("settings")
|
||||
if should_ignore_block:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue