mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-07-01 09:56:44 -04:00
daemon: Catch a RuntimeError for the keyring.
If the keyring doesn't manage to find a sensible and secure keyring backend it will raise a RuntimeError. Catch this error and log the error message. The keyring can be disabled in the config if the system cannot provide a sensible keyring backend.
This commit is contained in:
parent
1a8f28b90a
commit
9dd3e79bac
1 changed files with 14 additions and 8 deletions
|
@ -99,9 +99,12 @@ class ProxyDaemon:
|
||||||
|
|
||||||
for user_id, device_id in accounts:
|
for user_id, device_id in accounts:
|
||||||
if self.conf.keyring:
|
if self.conf.keyring:
|
||||||
token = keyring.get_password(
|
try:
|
||||||
"pantalaimon", f"{user_id}-{device_id}-token"
|
token = keyring.get_password(
|
||||||
)
|
"pantalaimon", f"{user_id}-{device_id}-token"
|
||||||
|
)
|
||||||
|
except RuntimeError as e:
|
||||||
|
logger.error(e)
|
||||||
else:
|
else:
|
||||||
token = self.store.load_access_token(user_id, device_id)
|
token = self.store.load_access_token(user_id, device_id)
|
||||||
|
|
||||||
|
@ -559,11 +562,14 @@ class ProxyDaemon:
|
||||||
self.pan_clients[user_id] = pan_client
|
self.pan_clients[user_id] = pan_client
|
||||||
|
|
||||||
if self.conf.keyring:
|
if self.conf.keyring:
|
||||||
keyring.set_password(
|
try:
|
||||||
"pantalaimon",
|
keyring.set_password(
|
||||||
f"{user_id}-{pan_client.device_id}-token",
|
"pantalaimon",
|
||||||
pan_client.access_token,
|
f"{user_id}-{pan_client.device_id}-token",
|
||||||
)
|
pan_client.access_token,
|
||||||
|
)
|
||||||
|
except RuntimeError as e:
|
||||||
|
logger.error(e)
|
||||||
else:
|
else:
|
||||||
self.store.save_access_token(
|
self.store.save_access_token(
|
||||||
user_id, pan_client.device_id, pan_client.access_token
|
user_id, pan_client.device_id, pan_client.access_token
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue