2023-07-14 14:52:35 -06:00
|
|
|
import assert from 'matrix-viewer-shared/lib/assert.js';
|
|
|
|
import MatrixViewerURLCreator from 'matrix-viewer-shared/lib/url-creator.js';
|
|
|
|
import redirectIfRoomAliasInHash from 'matrix-viewer-shared/lib/redirect-if-room-alias-in-hash.js';
|
2022-10-27 23:32:24 -06:00
|
|
|
|
2023-04-24 22:50:53 -06:00
|
|
|
// Assets
|
|
|
|
import 'hydrogen-view-sdk/assets/theme-element-light.css';
|
|
|
|
import '../css/styles.css';
|
|
|
|
|
2023-07-14 14:52:35 -06:00
|
|
|
const config = window.matrixViewerContext.config;
|
2022-10-27 23:32:24 -06:00
|
|
|
assert(config);
|
|
|
|
assert(config.basePath);
|
|
|
|
|
2023-07-14 14:52:35 -06:00
|
|
|
const matrixViewerURLCreator = new MatrixViewerURLCreator(config.basePath);
|
2022-10-27 23:32:24 -06:00
|
|
|
|
|
|
|
console.log(`Trying to redirect based on pageHash=${window.location.hash}`);
|
2023-07-14 14:52:35 -06:00
|
|
|
const isRedirecting = redirectIfRoomAliasInHash(matrixViewerURLCreator);
|
2022-10-27 23:32:24 -06:00
|
|
|
|
|
|
|
// Show the message while we're trying to redirect or if we found nothing, remove the
|
|
|
|
// message
|
|
|
|
document.querySelector('.js-try-redirect-message').style.display = isRedirecting
|
|
|
|
? 'inline'
|
|
|
|
: 'none';
|