···55Public instance at: [https://bootleg.baileytownsend.dev](https://bootleg.baileytownsend.dev)
6677# Features
88-- You can watch your favorite streamer on the atmosphere. If you know their handle that is....
88+- You can watch your favorite streamer on the atmosphere.
99+- Shows everyone who is currently streaming
910- It even shows the stream. with play/pause, mute, and volume controls.
1011- Loads chats in as well from stream.place's websocket.
1112- You can login via oauth thanks to [@atcute/oauth-browser-client](https://github.com/mary-ext/atcute/tree/trunk/packages/oauth/browser-client).
+30-6
index.html
···10941094 let loggedInDid = null;
10951095 let loggedInHandle = null;
10961096 let currentStreamerDid = null;
10971097+ let handlingPopstate = false;
1097109810981099 // ---- DOM refs ----
10991100 const video = document.getElementById("video");
···16171618 //This is when the video is successfully loaded
16181619 videoLoadedAt = new Date();
1619162016201620- window.history.pushState(
16211621- {},
16221622- "",
16231623- `/${streamersHandle}`,
16241624- );
16211621+ if (!handlingPopstate) {
16221622+ window.history.pushState(
16231623+ {},
16241624+ "",
16251625+ `/${streamersHandle}`,
16261626+ );
16271627+ }
16251628 setStatus("Live", "live");
16261629 startStats();
16271630 } else if (
···16981701 });
16991702 }
1700170317011701- function disconnect() {
17041704+ function teardownStream() {
17021705 stopStats();
17031706 disconnectChat();
17041707 if (pc) {
···17121715 statusStats.textContent = "";
17131716 connectBtn.style.display = "";
17141717 disconnectBtn.style.display = "none";
17181718+ }
17191719+17201720+ function disconnect() {
17211721+ teardownStream();
17151722 log("Disconnected");
17161723 window.history.pushState({}, "", "/");
17171724 showBrowseView();
···19011908 window.togglePlayPause = togglePlayPause;
19021909 window.toggleMute = toggleMute;
19031910 window.setVolume = setVolume;
19111911+19121912+ // ---- History navigation ----
19131913+ window.addEventListener("popstate", () => {
19141914+ handlingPopstate = true;
19151915+ const profile = getProfileFromUrl();
19161916+ if (profile) {
19171917+ if (pc) teardownStream();
19181918+ browseView.classList.remove("visible");
19191919+ mainLayout.style.display = "";
19201920+ usernameInput.value = profile;
19211921+ connect();
19221922+ } else {
19231923+ if (pc) teardownStream();
19241924+ showBrowseView();
19251925+ }
19261926+ handlingPopstate = false;
19271927+ });
1904192819051929 // ---- Init ----
19061930 updateAuthUI();