use botJoinMessage from config with default being the same as before

This commit is contained in:
felix.stupp@banananet.work 2023-07-27 14:30:06 +00:00
parent f91b8f07f3
commit d0165c58ab
No known key found for this signature in database
GPG Key ID: 93E1BD26F6B02FB7
2 changed files with 12 additions and 6 deletions

View File

@ -5,6 +5,7 @@
// (see readme for more details) // (see readme for more details)
"matrixServerUrl": "http://localhost:8008/", "matrixServerUrl": "http://localhost:8008/",
"matrixServerName": "localhost", "matrixServerName": "localhost",
// "botJoinMessage": "Joining room … See FAQ _" (full default in code)
// Set this to 100 since that is the max that Synapse will backfill even if you do a // Set this to 100 since that is the max that Synapse will backfill even if you do a
// `/messages?limit=1000` and we don't want to miss messages in between. // `/messages?limit=1000` and we don't want to miss messages in between.
"messageLimit": 100, "messageLimit": 100,

View File

@ -16,6 +16,16 @@ assert(matrixServerUrl);
const matrixViewerURLCreator = new MatrixViewerURLCreator(basePath); const matrixViewerURLCreator = new MatrixViewerURLCreator(basePath);
const defaultJoinMessage = `Joining room to check history visibility. ` +
`If your room is public with shared or world readable history visibility, ` +
`it will be accessible on ${matrixViewerURLCreator.roomDirectoryUrl()}. ` +
`See the FAQ for more details: ` +
`https://github.com/matrix-org/matrix-viewer/blob/main/docs/faq.md#why-did-the-bot-join-my-room`;
config.defaults({
botJoinMessage: defaultJoinMessage,
});
async function ensureRoomJoined( async function ensureRoomJoined(
accessToken, accessToken,
roomIdOrAlias, roomIdOrAlias,
@ -49,12 +59,7 @@ async function ensureRoomJoined(
accessToken, accessToken,
abortSignal, abortSignal,
body: { body: {
reason: reason: config.get("botJoinMessage"),
`Joining room to check history visibility. ` +
`If your room is public with shared or world readable history visibility, ` +
`it will be accessible on ${matrixViewerURLCreator.roomDirectoryUrl()}. ` +
`See the FAQ for more details: ` +
`https://github.com/matrix-org/matrix-viewer/blob/main/docs/faq.md#why-did-the-bot-join-my-room`,
}, },
}); });
assert( assert(