Skip to content
Open
Changes from 1 commit
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
14 changes: 10 additions & 4 deletions lib/plugins/matrix/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,25 @@
room,
accessToken,
retries = 3,
backoff = 5000
backoff = 5000,
transactionId = null

Check failure on line 13 in lib/plugins/matrix/send.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Use `undefined` instead of `null`
) {
if (transactionId === null) {
transactionId = `ssio-${Date.now()}`

Check failure on line 16 in lib/plugins/matrix/send.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Insert `;`
Comment thread
tulir marked this conversation as resolved.
Outdated
}
const retryCodes = new Set([408, 429, 500, 503]);
return new Promise((resolve, reject) => {
const request = _request(
{
host,
port: 443,
path: `/_matrix/client/r0/rooms/${room}/send/m.room.message?access_token=${accessToken}`,
path: `/_matrix/client/v3/rooms/${room}/send/m.room.message/${transactionId}`,
headers: {
'Authorization': `Bearer ${accessToken}`,

Check failure on line 26 in lib/plugins/matrix/send.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `'Authorization'` with `Authorization`
Comment thread
tulir marked this conversation as resolved.
Outdated
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(JSON.stringify(data), 'utf8')
},
method: 'POST'
method: 'PUT'
},
res => {
const { statusCode, statusMessage } = res;
Expand All @@ -36,7 +41,8 @@
room,
accessToken,
retries - 1,
backoff * 2
backoff * 2,
transactionId
);
}, backoff);
} else {
Expand Down
Loading