Encryption support is required
This commit is contained in:
parent
7d96c4731e
commit
a49c789251
3 changed files with 9 additions and 20 deletions
|
@ -61,7 +61,6 @@ class Config(object):
|
|||
self.device_id = self._get_cfg(["matrix", "device_id"], required=True)
|
||||
self.device_name = self._get_cfg(["matrix", "device_name"], default="nio-template")
|
||||
self.homeserver_url = self._get_cfg(["matrix", "homeserver_url"], required=True)
|
||||
self.enable_encryption = self._get_cfg(["matrix", "enable_encryption"], default=False)
|
||||
|
||||
self.command_prefix = self._get_cfg(["command_prefix"], default="!c") + " "
|
||||
|
||||
|
|
23
main.py
23
main.py
|
@ -41,7 +41,7 @@ async def main():
|
|||
max_limit_exceeded=0,
|
||||
max_timeouts=0,
|
||||
store_sync_tokens=True,
|
||||
encryption_enabled=config.enable_encryption,
|
||||
encryption_enabled=True,
|
||||
)
|
||||
|
||||
# Initialize the matrix client
|
||||
|
@ -73,19 +73,14 @@ async def main():
|
|||
logger.error(f"Failed to login: %s", login_response.message)
|
||||
return False
|
||||
except LocalProtocolError as e:
|
||||
# There's an edge case here where the user enables encryption but hasn't installed
|
||||
# the correct C dependencies. In that case, a LocalProtocolError is raised on login.
|
||||
# Warn the user if these conditions are met.
|
||||
if config.enable_encryption:
|
||||
logger.fatal(
|
||||
"Failed to login and encryption is enabled. Have you installed the correct dependencies? "
|
||||
"https://github.com/poljar/matrix-nio#installation"
|
||||
)
|
||||
return False
|
||||
else:
|
||||
# We don't know why this was raised. Throw it at the user
|
||||
logger.fatal("Error logging in: %s", e)
|
||||
return False
|
||||
# There's an edge case here where the user hasn't installed the correct C
|
||||
# dependencies. In that case, a LocalProtocolError is raised on login.
|
||||
logger.fatal(
|
||||
"Failed to login. Have you installed the correct dependencies? "
|
||||
"https://github.com/poljar/matrix-nio#installation "
|
||||
"Error: %s", e
|
||||
)
|
||||
return False
|
||||
|
||||
# Login succeeded!
|
||||
|
||||
|
|
|
@ -18,11 +18,6 @@ matrix:
|
|||
device_id: ABCDEFGHIJ
|
||||
# What to name the logged in device
|
||||
device_name: nio-template
|
||||
# End-to-end encryption support
|
||||
#
|
||||
# Enabling this requires installing the matrix-nio encryption dependencies
|
||||
# as described here: https://github.com/poljar/matrix-nio#installation
|
||||
enable_encryption: true
|
||||
|
||||
storage:
|
||||
# The path to the database
|
||||
|
|
Loading…
Reference in a new issue