* bumped unpaddedbase32 version

* improved readme
* better shutdown message in ui
This commit is contained in:
Kevin Froman 2019-11-06 18:03:38 -06:00
parent aa07d50eed
commit adcb3f31a9
8 changed files with 17 additions and 8 deletions

View file

@ -202,6 +202,7 @@ class OnionrCommunicatorDaemon:
except AttributeError:
pass
else:
# Stop onionr direct connection services
for server in self.service_greenlets:
server.stop()
localcommand.local_command('shutdown') # shutdown the api

View file

@ -47,7 +47,7 @@ def site(name: str)->Response:
# Now make sure the key is regardless a valid base32 format ed25519 key (readding padding if necessary)
if stringvalidators.validate_pub_key(name):
name = unpaddedbase32.repad(name)
resp = sitefiles.get_file('index.html')
resp = sitefiles.get_file(name, 'index.html')
elif stringvalidators.validate_hash(name):
try:

View file

@ -14,9 +14,13 @@ from onionrcrypto import generate_deterministic
def find_site_gzip(user_id: str)->str:
sites = blockmetadb.get_blocks_by_type('osite')
user_site = None
for site in sites:
if onionrblockapi.Block(site).isSigner(user_id):
return tarfile.open(fileobj=io.BytesIO(site.bcontent), mode='r')
block = onionrblockapi.Block(site)
if block.isSigner(user_id):
user_site = block
if not user_site is None:
return tarfile.open(fileobj=io.BytesIO(user_site.bcontent), mode='r')
return None
def get_file(user_id, file)->Union[bytes, None]: