From 5d9dc638ea100a9737e4d714154a5a7111806075 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 7 Jun 2022 19:41:08 -0500 Subject: [PATCH] URL hashes relative to the room of the archive --- src/domain/navigation/URLRouter.js | 2 -- src/lib.ts | 1 + src/platform/web/dom/History.js | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/domain/navigation/URLRouter.js b/src/domain/navigation/URLRouter.js index 81fc3113..586eec8a 100644 --- a/src/domain/navigation/URLRouter.js +++ b/src/domain/navigation/URLRouter.js @@ -36,7 +36,6 @@ export class URLRouter { } attach() { - console.log('attach'); this._subscription = this._history.subscribe(url => this._applyUrl(url)); // subscribe to path before applying initial url // so redirects in _applyNavPathToHistory are reflected in url bar @@ -76,7 +75,6 @@ export class URLRouter { } _applyUrl(url) { - console.log('URLRouter _applyUrl', url); const navPath = this._urlAsNavPath(url); this._applyNavPathToNavigation(navPath); } diff --git a/src/lib.ts b/src/lib.ts index 9d0ca367..6796484a 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -71,6 +71,7 @@ export {TextMessageView} from "./platform/web/ui/session/room/timeline/TextMessa export {VideoView} from "./platform/web/ui/session/room/timeline/VideoView.js"; export {Navigation} from "./domain/navigation/Navigation.js"; +export {History} from "./platform/web/dom/History.js"; export {ComposerViewModel} from "./domain/session/room/ComposerViewModel.js"; export {MessageComposer} from "./platform/web/ui/session/room/MessageComposer.js"; export {TemplateView} from "./platform/web/ui/general/TemplateView"; diff --git a/src/platform/web/dom/History.js b/src/platform/web/dom/History.js index d51974bb..7a989879 100644 --- a/src/platform/web/dom/History.js +++ b/src/platform/web/dom/History.js @@ -30,10 +30,10 @@ export class History extends BaseObservableValue { But for SSO, we need to handle /?loginToken= Handle that as a special case for now. */ - if (document.location.search.includes("loginToken")) { + if (document?.location?.search.includes("loginToken")) { return document.location.search; } - return document.location.hash; + return document?.location?.hash; } /** does not emit */