diff --git a/server/lib/matrix-utils/ensure-room-joined.js b/server/lib/matrix-utils/ensure-room-joined.js index aa7af3a..09826f4 100644 --- a/server/lib/matrix-utils/ensure-room-joined.js +++ b/server/lib/matrix-utils/ensure-room-joined.js @@ -3,14 +3,19 @@ const assert = require('assert'); const urlJoin = require('url-join'); +const StatusError = require('../errors/status-error'); const { fetchEndpointAsJson } = require('../fetch-endpoint'); const getServerNameFromMatrixRoomIdOrAlias = require('./get-server-name-from-matrix-room-id-or-alias'); +const MatrixPublicArchiveURLCreator = require('matrix-public-archive-shared/lib/url-creator'); const config = require('../config'); -const StatusError = require('../errors/status-error'); +const basePath = config.get('basePath'); +assert(basePath); const matrixServerUrl = config.get('matrixServerUrl'); assert(matrixServerUrl); +const matrixPublicArchiveURLCreator = new MatrixPublicArchiveURLCreator(basePath); + async function ensureRoomJoined( accessToken, roomIdOrAlias, @@ -47,7 +52,12 @@ async function ensureRoomJoined( reason: `Joining room to check history visibility. ` + `If your room is public with shared or world readable history visibility, ` + - `it will be accessible at archive.matrix.org. ` + + `it will be accessible at ${matrixPublicArchiveURLCreator.archiveUrlForRoom( + roomIdOrAlias + // We don't need to include the `viaServers` option here because the archive + // will already be joined to the room from this request itself and we don't + // need to make the URL any longer/noisier than it needs to be. + )}. ` + `See the FAQ for more details: ` + `https://github.com/matrix-org/matrix-public-archive/blob/main/docs/faq.md#why-did-the-archive-bot-join-my-room`, },