Matrix: Allow token only for V2 API with ?token.

pull/1236/head
vocoder 2 weeks ago
parent 01c1082ad8
commit 46351d0d47

@ -103,11 +103,15 @@ class MatrixVersion:
# Version 3 # Version 3
V3 = "3" V3 = "3"
# Token
TOKEN = "token"
# webhook modes are placed into this list for validation purposes # webhook modes are placed into this list for validation purposes
MATRIX_VERSIONS = ( MATRIX_VERSIONS = (
MatrixVersion.V2, MatrixVersion.V2,
MatrixVersion.V3, MatrixVersion.V3,
MatrixVersion.TOKEN
) )
@ -1474,6 +1478,9 @@ class NotifyMatrix(NotifyBase):
auth = '' auth = ''
if self.mode != MatrixWebhookMode.T2BOT: if self.mode != MatrixWebhookMode.T2BOT:
if self.version == "token":
self.access_token = self.user
# Determine Authentication # Determine Authentication
if self.user and self.password: if self.user and self.password:
auth = '{user}:{password}@'.format( auth = '{user}:{password}@'.format(
@ -1574,6 +1581,8 @@ class NotifyMatrix(NotifyBase):
elif 'v' in results['qsd'] and len(results['qsd']['v']): elif 'v' in results['qsd'] and len(results['qsd']['v']):
results['version'] = NotifyMatrix.unquote(results['qsd']['v']) results['version'] = NotifyMatrix.unquote(results['qsd']['v'])
if results['version'] == "token":
results['mode'] = MatrixWebhookMode.DISABLED
return results return results

Loading…
Cancel
Save