From 84bdbd96670dce5e9d47b785932b74679b26a4ea Mon Sep 17 00:00:00 2001 From: Mark Joshwel Date: Fri, 14 Feb 2025 21:22:17 +0800 Subject: [PATCH] web: 404 and heartbreaks (groundwork) --- Web/public/404.html | 161 ++++++++++++++++++++++++++- Web/public/js/ebcd-landing-qrcode.js | 2 +- Web/public/js/ebcd-profile.js | 15 +++ 3 files changed, 174 insertions(+), 4 deletions(-) diff --git a/Web/public/404.html b/Web/public/404.html index ed6bbee..dc6ce48 100644 --- a/Web/public/404.html +++ b/Web/public/404.html @@ -3,9 +3,164 @@ - Document + Echoes Behind Closed Doors + + + + + + + + + + + + + + + + + - - 404 + +
+
+ wirm logo + wirm wordmark +
+ + +
+ + +
+
+
+

404!

+

+ Page not found. +

+
+ + Bring me back! + +
+
diff --git a/Web/public/js/ebcd-landing-qrcode.js b/Web/public/js/ebcd-landing-qrcode.js index 019c2e9..686be70 100644 --- a/Web/public/js/ebcd-landing-qrcode.js +++ b/Web/public/js/ebcd-landing-qrcode.js @@ -51,6 +51,6 @@ function generateQrCode(text) { ); } -const svg = generateQrCode(window.location.origin + "/signup.html"); +const svg = generateQrCode(window.location.origin + "/auth.html"); document.getElementById("hero-svg").innerHTML = svg; document.getElementById("hero-svg").classList.remove("uk-placeholder"); diff --git a/Web/public/js/ebcd-profile.js b/Web/public/js/ebcd-profile.js index d1c946f..3cc8d21 100644 --- a/Web/public/js/ebcd-profile.js +++ b/Web/public/js/ebcd-profile.js @@ -10,9 +10,24 @@ if (urlParams.get("logOut") === "true") { auth .signOut() .then(() => { + console.log("ebcd-profile: signed out"); window.location = "/"; }) .catch((error) => { console.error("ebcd-profile: error signing out", error); + window.location = "/"; }); } + +// if we're signed in, reload the page with ?uid=... +auth.onAuthStateChanged((user) => { + if (!urlParams.has("uid")) { + // if we dont have a uid and we're signed in, redirect to /profile?uid=... + if (user) { + window.location = `/profile.html?uid=${user.uid}`; + } else { + // if we're not signed in, redirect to 404 + window.location = "/404.html"; + } + } +});