|
|
|
@ -146,8 +146,8 @@ class Settings(dict):
|
|
|
|
|
try:
|
|
|
|
|
with open(path, 'rb') as fl:
|
|
|
|
|
data = fl.read()
|
|
|
|
|
if toxes.is_data_encrypted(data):
|
|
|
|
|
data = toxes.pass_decrypt(data)
|
|
|
|
|
if self._toxes.is_data_encrypted(data):
|
|
|
|
|
data = self._toxes.pass_decrypt(data)
|
|
|
|
|
info = json.loads(str(data, 'utf-8'))
|
|
|
|
|
LOG.debug('Parsed settings from: ' + str(path))
|
|
|
|
|
except Exception as ex:
|
|
|
|
@ -210,10 +210,7 @@ class Settings(dict):
|
|
|
|
|
text = bytes(self._toxes.pass_encrypt(bytes(text, 'utf-8')))
|
|
|
|
|
else:
|
|
|
|
|
text = bytes(text, 'utf-8')
|
|
|
|
|
json_path = self._path.replace('.tox', '.json')
|
|
|
|
|
if not json_path:
|
|
|
|
|
#?
|
|
|
|
|
json_path = os.path.join(get_user_config_path(), 'toxygen.json')
|
|
|
|
|
json_path = os.path.join(get_user_config_path(), 'toxygen.json')
|
|
|
|
|
tmp = json_path + str(os.getpid())
|
|
|
|
|
try:
|
|
|
|
|
with open(tmp, 'wb') as fl:
|
|
|
|
@ -271,12 +268,18 @@ class Settings(dict):
|
|
|
|
|
p = os.path.join(appdir, 'toxygen.json')
|
|
|
|
|
if not os.path.isfile(p):
|
|
|
|
|
return None
|
|
|
|
|
with open(p) as fl:
|
|
|
|
|
data = fl.read()
|
|
|
|
|
try:
|
|
|
|
|
auto = json.loads(data)
|
|
|
|
|
with open(p, 'rb') as fl:
|
|
|
|
|
data = fl.read()
|
|
|
|
|
if self._toxes.is_data_encrypted(data):
|
|
|
|
|
data = self._toxes.pass_decrypt(data)
|
|
|
|
|
except Exception as ex:
|
|
|
|
|
LOG.warn(f"fl.read {p}: {ex}")
|
|
|
|
|
return None
|
|
|
|
|
try:
|
|
|
|
|
auto = json.loads(str(data, 'utf-8'))
|
|
|
|
|
except Exception as ex:
|
|
|
|
|
LOG.warn(f"json.loads {data}: {ex}")
|
|
|
|
|
LOG.warn(f"json.loads {p}: {ex}")
|
|
|
|
|
auto = {}
|
|
|
|
|
if 'profile_path' in auto:
|
|
|
|
|
path = str(auto['profile_path'])
|
|
|
|
@ -375,7 +378,7 @@ class Settings(dict):
|
|
|
|
|
'unread_color': 'red',
|
|
|
|
|
'compact_mode': False,
|
|
|
|
|
'identicons': True,
|
|
|
|
|
'show_welcome_screen': True,
|
|
|
|
|
'show_welcome_screen': False,
|
|
|
|
|
'close_app': 0,
|
|
|
|
|
'font': 'Times New Roman',
|
|
|
|
|
'update': 0,
|
|
|
|
|