feat: Add cache encryption #9

Merged
kamikazechaser merged 10 commits from lash/encrypt into master 2022-01-23 07:59:16 +01:00
4 changed files with 14 additions and 4 deletions
Showing only changes of commit 0bfe054b90 - Show all commits

View File

@ -1,7 +1,7 @@
# import notifier # import notifier
from clicada.cli.notify import NotifyWriter from clicada.cli.notify import NotifyWriter
notifier = NotifyWriter() notifier = NotifyWriter()
notifier.notify('loading script') #notifier.notify('loading script')
# standard imports # standard imports
import os import os

View File

@ -3,6 +3,7 @@ import hashlib
import urllib.parse import urllib.parse
import os import os
import logging import logging
from socket import getservbyname
# external imports # external imports
from usumbufu.client.base import ( from usumbufu.client.base import (
@ -48,7 +49,15 @@ class HTTPSession:
def __init__(self, url, auth=None, origin=None): def __init__(self, url, auth=None, origin=None):
self.base_url = url self.base_url = url
url_parts = urllib.parse.urlsplit(self.base_url) url_parts = urllib.parse.urlsplit(self.base_url)
url_parts_origin = (url_parts[0], url_parts[1], '', '', '',) url_parts_origin_host = url_parts[1].split(":")
host = url_parts_origin_host[0]
try:
host = host + ':' + url_parts_origin_host[1]
except IndexError:
host = host + ':' + str(getservbyname(url_parts[0]))
logg.info('changed origin with missing port number from {} to {}'.format(url_parts[1], host))
url_parts_origin = (url_parts[0], host, '', '', '',)
self.origin = origin self.origin = origin
if self.origin == None: if self.origin == None:
self.origin = urllib.parse.urlunsplit(url_parts_origin) self.origin = urllib.parse.urlunsplit(url_parts_origin)

View File

@ -1,12 +1,13 @@
# standard imports # standard imports
import os import os
import sys import sys
import shutil
class NotifyWriter: class NotifyWriter:
def __init__(self, writer=sys.stdout): def __init__(self, writer=sys.stdout):
(c, r) = os.get_terminal_size() (c, r) = shutil.get_terminal_size()
self.cols = c self.cols = c
self.fmt = "\r{:" + "<{}".format(c) + "}" self.fmt = "\r{:" + "<{}".format(c) + "}"
self.w = writer self.w = writer

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = clicada name = clicada
version = 0.0.6a1 version = 0.0.6a2
description = CLI CRM tool for the cic-stack custodial wallet system description = CLI CRM tool for the cic-stack custodial wallet system
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no author_email = dev@holbrook.no