Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix Long Lived Token: Don't logout, and use UUIDv4 for transactionIds #1249

Merged
merged 16 commits into from
Nov 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion apprise/plugins/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#
import re
import requests
import uuid
from markdown import markdown
from json import dumps
from json import loads
Expand Down Expand Up @@ -616,6 +617,7 @@ def _send_server_notification(self, body, title='',

if self.access_token is None and self.password and not self.user:
self.access_token = self.password
self.transaction_id = uuid.uuid4()

if self.access_token is None:
# We need to register
Expand Down Expand Up @@ -746,7 +748,8 @@ def _send_server_notification(self, body, title='',

# Increment the transaction ID to avoid future messages being
# recognized as retransmissions and ignored
if self.version == MatrixVersion.V3:
if self.version == MatrixVersion.V3 \
and self.access_token != self.password:
self.transaction_id += 1
self.store.set(
'transaction_id', self.transaction_id,
Expand Down Expand Up @@ -1401,6 +1404,10 @@ def __del__(self):
# re-use our credentials with
return

if self.access_token is not None \
and self.access_token == self.password and not self.user:
return

try:
self._logout()

Expand Down
Loading