Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3c93ca6a7f
2 changed files with 4 additions and 8 deletions
|
@ -10,6 +10,7 @@ import gevent
|
||||||
|
|
||||||
from Debug import Debug
|
from Debug import Debug
|
||||||
from Crypt import CryptHash
|
from Crypt import CryptHash
|
||||||
|
from Crypt import CryptBitcoin
|
||||||
from Config import config
|
from Config import config
|
||||||
from util import helper
|
from util import helper
|
||||||
from util import Diff
|
from util import Diff
|
||||||
|
@ -726,7 +727,6 @@ class ContentManager(object):
|
||||||
new_content["inner_path"] = inner_path
|
new_content["inner_path"] = inner_path
|
||||||
|
|
||||||
# Verify private key
|
# Verify private key
|
||||||
from Crypt import CryptBitcoin
|
|
||||||
self.log.info("Verifying private key...")
|
self.log.info("Verifying private key...")
|
||||||
privatekey_address = CryptBitcoin.privatekeyToAddress(privatekey)
|
privatekey_address = CryptBitcoin.privatekeyToAddress(privatekey)
|
||||||
valid_signers = self.getValidSigners(inner_path, new_content)
|
valid_signers = self.getValidSigners(inner_path, new_content)
|
||||||
|
@ -793,7 +793,6 @@ class ContentManager(object):
|
||||||
return 1 # Todo: Multisig
|
return 1 # Todo: Multisig
|
||||||
|
|
||||||
def verifyCertSign(self, user_address, user_auth_type, user_name, issuer_address, sign):
|
def verifyCertSign(self, user_address, user_auth_type, user_name, issuer_address, sign):
|
||||||
from Crypt import CryptBitcoin
|
|
||||||
cert_subject = "%s#%s/%s" % (user_address, user_auth_type, user_name)
|
cert_subject = "%s#%s/%s" % (user_address, user_auth_type, user_name)
|
||||||
return CryptBitcoin.verify(cert_subject, issuer_address, sign)
|
return CryptBitcoin.verify(cert_subject, issuer_address, sign)
|
||||||
|
|
||||||
|
@ -919,7 +918,6 @@ class ContentManager(object):
|
||||||
# Return: None = Same as before, False = Invalid, True = Valid
|
# Return: None = Same as before, False = Invalid, True = Valid
|
||||||
def verifyFile(self, inner_path, file, ignore_same=True):
|
def verifyFile(self, inner_path, file, ignore_same=True):
|
||||||
if inner_path.endswith("content.json"): # content.json: Check using sign
|
if inner_path.endswith("content.json"): # content.json: Check using sign
|
||||||
from Crypt import CryptBitcoin
|
|
||||||
try:
|
try:
|
||||||
if type(file) is dict:
|
if type(file) is dict:
|
||||||
new_content = file
|
new_content = file
|
||||||
|
@ -930,7 +928,7 @@ class ContentManager(object):
|
||||||
else:
|
else:
|
||||||
new_content = json.load(file)
|
new_content = json.load(file)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
raise VerifyError("Invalid json file: %s" % err)
|
raise VerifyError(f"Invalid json file: {err}")
|
||||||
if inner_path in self.contents:
|
if inner_path in self.contents:
|
||||||
old_content = self.contents.get(inner_path, {"modified": 0})
|
old_content = self.contents.get(inner_path, {"modified": 0})
|
||||||
# Checks if its newer the ours
|
# Checks if its newer the ours
|
||||||
|
|
|
@ -14,7 +14,8 @@ from Config import config
|
||||||
from util import helper
|
from util import helper
|
||||||
from util import RateLimit
|
from util import RateLimit
|
||||||
from util import Cached
|
from util import Cached
|
||||||
|
from .Site import Site
|
||||||
|
from Debug import Debug
|
||||||
|
|
||||||
@PluginManager.acceptPlugins
|
@PluginManager.acceptPlugins
|
||||||
class SiteManager(object):
|
class SiteManager(object):
|
||||||
|
@ -30,10 +31,8 @@ class SiteManager(object):
|
||||||
# Load all sites from data/sites.json
|
# Load all sites from data/sites.json
|
||||||
@util.Noparallel()
|
@util.Noparallel()
|
||||||
def load(self, cleanup=True, startup=False):
|
def load(self, cleanup=True, startup=False):
|
||||||
from Debug import Debug
|
|
||||||
self.log.info("Loading sites... (cleanup: %s, startup: %s)" % (cleanup, startup))
|
self.log.info("Loading sites... (cleanup: %s, startup: %s)" % (cleanup, startup))
|
||||||
self.loaded = False
|
self.loaded = False
|
||||||
from .Site import Site
|
|
||||||
address_found = []
|
address_found = []
|
||||||
added = 0
|
added = 0
|
||||||
load_s = time.time()
|
load_s = time.time()
|
||||||
|
@ -170,7 +169,6 @@ class SiteManager(object):
|
||||||
return site
|
return site
|
||||||
|
|
||||||
def add(self, address, all_file=True, settings=None, **kwargs):
|
def add(self, address, all_file=True, settings=None, **kwargs):
|
||||||
from .Site import Site
|
|
||||||
self.sites_changed = int(time.time())
|
self.sites_changed = int(time.time())
|
||||||
# Try to find site with differect case
|
# Try to find site with differect case
|
||||||
for recover_address, recover_site in list(self.sites.items()):
|
for recover_address, recover_site in list(self.sites.items()):
|
||||||
|
|
Loading…
Reference in a new issue