Rev562, Check site privatekey from users.json when executing siteSign, Optional files checking on owned sites, Fix workermanager error on set list of peers, Fix PROTOCOL_SSLv3 error happens on some linux distrib
This commit is contained in:
parent
c2fc131cdc
commit
2cf34c132f
6 changed files with 27 additions and 7 deletions
|
@ -8,7 +8,7 @@ class Config(object):
|
|||
|
||||
def __init__(self, argv):
|
||||
self.version = "0.3.2"
|
||||
self.rev = 546
|
||||
self.rev = 562
|
||||
self.argv = argv
|
||||
self.action = None
|
||||
self.createParser()
|
||||
|
|
|
@ -2,7 +2,7 @@ import array
|
|||
import time
|
||||
|
||||
|
||||
class PeerHashfield():
|
||||
class PeerHashfield:
|
||||
def __init__(self):
|
||||
self.storage = self.createStoreage()
|
||||
self.time_changed = time.time()
|
||||
|
|
|
@ -258,8 +258,10 @@ class Site:
|
|||
self.log.debug("Fallback to old-style update")
|
||||
self.redownloadContents()
|
||||
|
||||
if not self.settings["own"]:
|
||||
self.storage.checkFiles(quick_check=True) # Quick check files based on file size
|
||||
if self.settings["own"]:
|
||||
self.storage.verifyFiles(quick_check=True) # Check files (need for optional files)
|
||||
else:
|
||||
self.storage.checkFiles(quick_check=True) # Quick check and mark bad files based on file size
|
||||
|
||||
changed, deleted = self.content_manager.loadContent("content.json")
|
||||
|
||||
|
|
|
@ -139,6 +139,9 @@ class WorkerManager:
|
|||
return False # Workers number already maxed and no starting peers definied
|
||||
if not peers:
|
||||
peers = self.site.peers.values() # No peers definied, use any from site
|
||||
if type(peers) is set:
|
||||
peers = list(peers)
|
||||
|
||||
random.shuffle(peers)
|
||||
for peer in peers: # One worker for every peer
|
||||
if peers and peer not in peers:
|
||||
|
|
17
src/main.py
17
src/main.py
|
@ -7,6 +7,11 @@ import logging
|
|||
# Third party modules
|
||||
import gevent
|
||||
from gevent import monkey
|
||||
import ssl
|
||||
# Fix PROTOCOL_SSLv3 not defined
|
||||
if "PROTOCOL_SSLv3" not in dir(ssl):
|
||||
ssl.PROTOCOL_SSLv3 = ssl.PROTOCOL_SSLv23
|
||||
|
||||
if "patch_subprocess" in dir(monkey):
|
||||
monkey.patch_all(thread=False, subprocess=False)
|
||||
else:
|
||||
|
@ -145,9 +150,15 @@ class Actions(object):
|
|||
logging.info("Signing site: %s..." % address)
|
||||
site = Site(address, allow_create=False)
|
||||
|
||||
if not privatekey: # If no privatekey in args then ask it now
|
||||
import getpass
|
||||
privatekey = getpass.getpass("Private key (input hidden):")
|
||||
if not privatekey: # If no privatekey definied
|
||||
from User import UserManager
|
||||
user = UserManager.user_manager.get()
|
||||
site_data = user.getSiteData(address)
|
||||
privatekey = site_data.get("privatekey")
|
||||
if not privatekey:
|
||||
# Not found in users.json, ask from console
|
||||
import getpass
|
||||
privatekey = getpass.getpass("Private key (input hidden):")
|
||||
succ = site.content_manager.sign(inner_path=inner_path, privatekey=privatekey, update_changed_files=True)
|
||||
if succ and publish:
|
||||
self.sitePublish(address, inner_path=inner_path)
|
||||
|
|
|
@ -94,5 +94,9 @@ try:
|
|||
except Exception, err:
|
||||
pass
|
||||
|
||||
# Fix PROTOCOL_SSLv3 not defined
|
||||
if "PROTOCOL_SSLv3" not in dir(__ssl__):
|
||||
__ssl__.PROTOCOL_SSLv3 = __ssl__.PROTOCOL_SSLv23
|
||||
logging.debug("Redirected PROTOCOL_SSLv3 to PROTOCOL_SSLv23.")
|
||||
|
||||
logging.debug("Python SSL version: %s" % __ssl__.OPENSSL_VERSION)
|
||||
|
|
Loading…
Reference in a new issue