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_id = self._get_cfg(["matrix", "device_id"], required=True)
|
||||||
self.device_name = self._get_cfg(["matrix", "device_name"], default="nio-template")
|
self.device_name = self._get_cfg(["matrix", "device_name"], default="nio-template")
|
||||||
self.homeserver_url = self._get_cfg(["matrix", "homeserver_url"], required=True)
|
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") + " "
|
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_limit_exceeded=0,
|
||||||
max_timeouts=0,
|
max_timeouts=0,
|
||||||
store_sync_tokens=True,
|
store_sync_tokens=True,
|
||||||
encryption_enabled=config.enable_encryption,
|
encryption_enabled=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Initialize the matrix client
|
# Initialize the matrix client
|
||||||
|
@ -73,19 +73,14 @@ async def main():
|
||||||
logger.error(f"Failed to login: %s", login_response.message)
|
logger.error(f"Failed to login: %s", login_response.message)
|
||||||
return False
|
return False
|
||||||
except LocalProtocolError as e:
|
except LocalProtocolError as e:
|
||||||
# There's an edge case here where the user enables encryption but hasn't installed
|
# There's an edge case here where the user hasn't installed the correct C
|
||||||
# the correct C dependencies. In that case, a LocalProtocolError is raised on login.
|
# dependencies. In that case, a LocalProtocolError is raised on login.
|
||||||
# Warn the user if these conditions are met.
|
logger.fatal(
|
||||||
if config.enable_encryption:
|
"Failed to login. Have you installed the correct dependencies? "
|
||||||
logger.fatal(
|
"https://github.com/poljar/matrix-nio#installation "
|
||||||
"Failed to login and encryption is enabled. Have you installed the correct dependencies? "
|
"Error: %s", e
|
||||||
"https://github.com/poljar/matrix-nio#installation"
|
)
|
||||||
)
|
return False
|
||||||
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
|
|
||||||
|
|
||||||
# Login succeeded!
|
# Login succeeded!
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,6 @@ matrix:
|
||||||
device_id: ABCDEFGHIJ
|
device_id: ABCDEFGHIJ
|
||||||
# What to name the logged in device
|
# What to name the logged in device
|
||||||
device_name: nio-template
|
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:
|
storage:
|
||||||
# The path to the database
|
# The path to the database
|
||||||
|
|
Loading…
Reference in a new issue