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)
"matrixServerUrl": "http://localhost:8008/",
"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
// `/messages?limit=1000` and we don't want to miss messages in between.
"messageLimit": 100,

View File

@ -16,6 +16,16 @@ assert(matrixServerUrl);
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(
accessToken,
roomIdOrAlias,
@ -49,12 +59,7 @@ async function ensureRoomJoined(
accessToken,
abortSignal,
body: {
reason:
`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`,
reason: config.get("botJoinMessage"),
},
});
assert(