Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
caryoscelus committed Aug 31, 2022
2 parents ae52b9e + 02dfbed commit 3c93ca6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/Content/ContentManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from Debug import Debug
from Crypt import CryptHash
from Crypt import CryptBitcoin
from Config import config
from util import helper
from util import Diff
Expand Down Expand Up @@ -726,7 +727,6 @@ def sign(self, inner_path="content.json", privatekey=None, filewrite=True, updat
new_content["inner_path"] = inner_path

# Verify private key
from Crypt import CryptBitcoin
self.log.info("Verifying private key...")
privatekey_address = CryptBitcoin.privatekeyToAddress(privatekey)
valid_signers = self.getValidSigners(inner_path, new_content)
Expand Down Expand Up @@ -793,7 +793,6 @@ def getSignsRequired(self, inner_path, content=None):
return 1 # Todo: Multisig

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)
return CryptBitcoin.verify(cert_subject, issuer_address, sign)

Expand Down Expand Up @@ -919,7 +918,6 @@ def verifyContentInclude(self, inner_path, content, content_size, content_size_o
# Return: None = Same as before, False = Invalid, True = Valid
def verifyFile(self, inner_path, file, ignore_same=True):
if inner_path.endswith("content.json"): # content.json: Check using sign
from Crypt import CryptBitcoin
try:
if type(file) is dict:
new_content = file
Expand All @@ -930,7 +928,7 @@ def verifyFile(self, inner_path, file, ignore_same=True):
else:
new_content = json.load(file)
except Exception as err:
raise VerifyError("Invalid json file: %s" % err)
raise VerifyError(f"Invalid json file: {err}")
if inner_path in self.contents:
old_content = self.contents.get(inner_path, {"modified": 0})
# Checks if its newer the ours
Expand Down
6 changes: 2 additions & 4 deletions src/Site/SiteManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from util import helper
from util import RateLimit
from util import Cached

from .Site import Site
from Debug import Debug

@PluginManager.acceptPlugins
class SiteManager(object):
Expand All @@ -30,10 +31,8 @@ def __init__(self):
# Load all sites from data/sites.json
@util.Noparallel()
def load(self, cleanup=True, startup=False):
from Debug import Debug
self.log.info("Loading sites... (cleanup: %s, startup: %s)" % (cleanup, startup))
self.loaded = False
from .Site import Site
address_found = []
added = 0
load_s = time.time()
Expand Down Expand Up @@ -170,7 +169,6 @@ def get(self, address):
return site

def add(self, address, all_file=True, settings=None, **kwargs):
from .Site import Site
self.sites_changed = int(time.time())
# Try to find site with differect case
for recover_address, recover_site in list(self.sites.items()):
Expand Down

0 comments on commit 3c93ca6

Please sign in to comment.