diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7e5427b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/assets/css/mainSite.css b/assets/css/mainSite.css index a39efb2..fdd63cc 100644 --- a/assets/css/mainSite.css +++ b/assets/css/mainSite.css @@ -3114,4 +3114,21 @@ small { max-width: 100%; border-radius: 15px; height: 200px; +} + +/* registration badge */ +.formBox .badge { + background: var(--main-color); + padding: 2px 8px; + border-radius: 12px; + font-size: 0.8em; + margin-left: 5px; + color: var(--hovered-button-text); + display: block; + margin-bottom: 5px; + margin-top: 10px; +} + +.formBox .badge i { + color: var(--hovered-button-text); } \ No newline at end of file diff --git a/assets/js/pageLoader.js b/assets/js/pageLoader.js index 414ad58..c623561 100644 --- a/assets/js/pageLoader.js +++ b/assets/js/pageLoader.js @@ -87,7 +87,7 @@ firebase.auth().onAuthStateChanged((user) => { const getTheme = snapshot.val(); // Set zoom level - if (getTheme.fontSizePref) { + if (getTheme && getTheme.fontSizePref) { if (getTheme.fontSizePref === "normal") { document.documentElement.style.setProperty('--zoom-level', '1'); } else if (getTheme.fontSizePref === "large") { @@ -95,9 +95,9 @@ firebase.auth().onAuthStateChanged((user) => { } } - if (getTheme.theme === "Dark" || getTheme.theme === undefined) { + if (getTheme && getTheme.theme === "Dark" || getTheme && getTheme.theme === undefined) { // Dark theme by default - } else if (getTheme.theme === "Light") { + } else if (getTheme && getTheme.theme === "Light") { document.documentElement.style.setProperty('--background', '#f5f5f5'); document.documentElement.style.setProperty('--main-color', '#dd6075'); document.documentElement.style.setProperty('--main-color-darker', '#b44d5d'); @@ -129,7 +129,7 @@ firebase.auth().onAuthStateChanged((user) => { if (currentMonth === 6 && getTheme.showPrideFlag === "Yes" || currentMonth === 6 && getTheme.showPrideFlag === undefined) { document.getElementById("transsocialHeaderLogo").src = "/assets/imgs/PrideHeaderLogo.png"; } - } else if (getTheme.theme === "Mint (Light)") { + } else if (getTheme && getTheme.theme === "Mint (Light)") { document.documentElement.style.setProperty('--background', '#f0f8ff'); document.documentElement.style.setProperty('--main-color', '#9be7c4'); document.documentElement.style.setProperty('--main-color-darker', '#62c198'); @@ -164,7 +164,7 @@ firebase.auth().onAuthStateChanged((user) => { } else { document.getElementById("transsocialHeaderLogo").src = "/assets/imgs/MintLightThemeLogo.png"; } - } else if (getTheme.theme === "Mint (Dark)") { + } else if (getTheme && getTheme.theme === "Mint (Dark)") { document.documentElement.style.setProperty('--background', '#18282d'); document.documentElement.style.setProperty('--main-color', '#add8d0'); document.documentElement.style.setProperty('--main-color-darker', '#8cc0b2'); @@ -198,7 +198,7 @@ firebase.auth().onAuthStateChanged((user) => { } else { document.getElementById("transsocialHeaderLogo").src = "/assets/imgs/MintDarkThemeLogo.png"; } - } else if (getTheme.theme === "High Contrast") { + } else if (getTheme && getTheme.theme === "High Contrast") { document.documentElement.style.setProperty('--background', 'black'); document.documentElement.style.setProperty('--main-color', 'yellow'); document.documentElement.style.setProperty('--main-color-darker', '#cccc00'); @@ -232,7 +232,7 @@ firebase.auth().onAuthStateChanged((user) => { } else { document.getElementById("transsocialHeaderLogo").src = "/assets/imgs/HighContrastThemeLogo.png"; } - } else if (getTheme.theme === "TransSocial Classic") { + } else if (getTheme && getTheme.theme === "TransSocial Classic") { document.documentElement.style.setProperty('--background', '#ffb2a8'); document.documentElement.style.setProperty('--main-color', '#ffb2a8'); document.documentElement.style.setProperty('--main-color-darker', '#f0cfb6'); @@ -266,7 +266,7 @@ firebase.auth().onAuthStateChanged((user) => { } else { document.getElementById("transsocialHeaderLogo").src = "/assets/imgs/TransSocialClassicThemeLogo.png"; } - } else if (getTheme.theme === "Midnight Purple") { + } else if (getTheme && getTheme.theme === "Midnight Purple") { document.documentElement.style.setProperty('--background', '#221e2b'); document.documentElement.style.setProperty('--main-color', '#957DAD'); document.documentElement.style.setProperty('--main-color-darker', '#786491'); @@ -300,7 +300,7 @@ firebase.auth().onAuthStateChanged((user) => { } else { document.getElementById("transsocialHeaderLogo").src = "/assets/imgs/MidnightPurpleThemeLogo.png"; } - } else if (getTheme.theme === "Darker") { + } else if (getTheme && getTheme.theme === "Darker") { document.documentElement.style.setProperty('--background', '#171717'); document.documentElement.style.setProperty('--main-color', '#ff869a'); document.documentElement.style.setProperty('--main-color-darker', '#e1788a'); @@ -328,7 +328,7 @@ firebase.auth().onAuthStateChanged((user) => { document.documentElement.style.setProperty('--reply-background', '#282828'); document.documentElement.style.setProperty('--reply-hovered-background', '#333333'); document.documentElement.style.setProperty('--note-background', '#202020'); - } else if (getTheme.theme === "Custom") { + } else if (getTheme && getTheme.theme === "Custom") { document.documentElement.style.setProperty('--background', getTheme.themeColors.background); document.documentElement.style.setProperty('--main-color', getTheme.themeColors.mainColor); document.documentElement.style.setProperty('--main-color-darker', getTheme.themeColors.mainColorDarker); diff --git a/assets/js/ts_fas_acih.js b/assets/js/ts_fas_acih.js index 1e377e4..5e70832 100644 --- a/assets/js/ts_fas_acih.js +++ b/assets/js/ts_fas_acih.js @@ -29,8 +29,8 @@ const pathName = pageURL.pathname; let isOnDesktopApp = null; // TransSocial Version -let transsocialVersion = "v2024.10.7"; -let transsocialUpdate = "v2024107-1"; +let transsocialVersion = "v2024.10.14"; +let transsocialUpdate = "v20241014-1"; let transsocialReleaseVersion = "pre-alpha"; const notices = document.getElementsByClassName("version-notice"); @@ -347,7 +347,7 @@ if (pathName !== "/suspended.html" || pathName !== "/suspended") { suspensionRef.on("value", (snapshot) => { const data = snapshot.val(); - if (data.suspensionStatus === "suspended") { + if (data && data.suspensionStatus === "suspended") { if (pathName !== "/suspended" && pathName !== "/suspended.html") { window.location.replace("/suspended"); } @@ -389,7 +389,9 @@ firebase.auth().onAuthStateChanged((user) => { document.getElementById("notificationsCount").classList.add("show"); document.getElementById("notificationsCount").innerHTML = `${unreadNotifications}`; } else { - document.getElementById("notificationsCount").classList.remove("show"); + if (document.getElementById("notificationsCount")) { + document.getElementById("notificationsCount").classList.remove("show"); + } } }) } @@ -414,7 +416,9 @@ firebase.auth().onAuthStateChanged((user) => { const hasDoneIt = snapshot.exists(); if (!hasDoneIt) { - document.getElementById("updatesBtn").innerHTML = ` Updates New!`; + if (document.getElementById("updatesBtn")) { + document.getElementById("updatesBtn").innerHTML = ` Updates New!`; + } } }) } else { @@ -444,15 +448,39 @@ if (document.getElementById("404page")) { // If user is on the register page and is not signed in, redirect to / if (pathName === "/auth/register" || pathName === "/auth/register.html") { + const url = new URL(window.location.href); + const urlParam = url.searchParams.get("return_to"); + + if (urlParam && urlParam === "https://music.transs.social/") { + document.getElementById("redirectNotice").innerHTML = ` You'll be returned to TransMusic after you create your account.`; + } else if (urlParam && urlParam !== "https://music.transs.social/") { + document.getElementById("redirectNotice").innerHTML = ` You'll be returned to ${urlParam} after you create your account.`; + } else { + document.getElementById("redirectNotice").remove(); + } + firebase.auth().onAuthStateChanged((user) => { if (user) { - window.location.replace("/auth/policies"); + if (!urlParam) { + window.location.replace("/auth/policies"); + } else { + window.location.replace(`/auth/policies?return_to=${urlParam}`); + } } else { // no need to do anything } }) } +if (pathName === "/auth/policies") { + const url = new URL(window.location.href); + const urlParam = url.searchParams.get("return_to"); + + if (urlParam) { + document.getElementById("continueBtn").href = `/auth/pfp?return_to=${urlParam}`; + } +} + // If user is on /auth/pfp, make sure their email is saved // We also add their profile picture here if (pathName === "/auth/pfp") { @@ -464,7 +492,14 @@ if (pathName === "/auth/pfp") { firebase.database().ref(`users/${user.uid}/pfp`).once("value", (snapshot) => { if (snapshot.exists()) { - window.location.replace("/auth/names"); + const url = new URL(window.location.href); + const urlParam = url.searchParams.get("return_to"); + + if (!urlParam) { + window.location.replace("/auth/names"); + } else { + window.location.replace(`/auth/names?return_to=${urlParam}`); + } } }); } else { @@ -521,7 +556,14 @@ if (pathName === "/auth/pfp") { pfp : file.name }) .then(() => { - window.location.replace("/auth/names"); + const url = new URL(window.location.href); + const urlParam = url.searchParams.get("return_to"); + + if (!urlParam) { + window.location.replace("/auth/names"); + } else { + window.location.replace(`/auth/names?return_to=${urlParam}`); + } }); }) } @@ -537,7 +579,14 @@ if (pathName === "/auth/pfp") { if (user) { firebase.database().ref(`users/${user.uid}/username`).once("value", (snapshot) => { if (snapshot.exists()) { - window.location.replace("/auth/done"); + const url = new URL(window.location.href); + const urlParam = url.searchParams.get("return_to"); + + if (!urlParam) { + window.location.replace("/auth/done"); + } else { + window.location.replace(`/auth/done?return_to=${urlParam}`); + } } }); } else { @@ -598,7 +647,14 @@ function displayAndUsernameReserve() { username : username }) .then(() => { - window.location.replace("/auth/done"); + const url = new URL(window.location.href); + const urlParam = url.searchParams.get("return_to"); + + if (!urlParam) { + window.location.replace("/auth/done"); + } else { + window.location.replace(`/auth/done?return_to=${urlParam}`); + } }); }); } @@ -613,9 +669,14 @@ function displayAndUsernameReserve() { // auth/done... not much to do, just check auth state if (pathName === "/auth/done") { + const url = new URL(window.location.href); + const urlParam = url.searchParams.get("return_to"); + firebase.auth().onAuthStateChanged((user) => { if (user) { - // nothing to do + if (urlParam) { + window.location.replace(urlParam); + } } else { window.location.replace("/auth/register"); } @@ -639,7 +700,14 @@ function register() { firebase.database().ref(`users/${userCredential.uid}`).update({ email : email }).then(() => { - window.location.replace("/auth/pfp"); + const url = new URL(window.location.href); + const urlParam = url.searchParams.get("return_to"); + + if (urlParam) { + window.location.replace(`/auth/pfp?return_to=${urlParam}`); + } else { + window.location.replace("/auth/pfp"); + } }); }) .catch((error) => { @@ -720,7 +788,9 @@ function validate_field(field) { // Hide error by default function hideErrorByDefault() { const errorTxt = document.getElementById('errorTxt'); - errorTxt.innerHTML = ''; + if (errorTxt) { + errorTxt.innerHTML = ''; + } } // Only allow user on page if they are signed in/signed out @@ -2287,7 +2357,7 @@ function loadEverything() { } // TransSocial account stuff -if (pathName !== "/auth/login.html" && pathName !== "/auth/register.html" && pathName !== "/auth/katniny.html" && pathName !== "/auth/login" && pathName !== "/auth/register" && pathName !== "/auth/katniny") { +if (!pathName.startsWith("/auth/")) { database.ref("users/G6GaJr8vPpeVdvenAntjOFYlbwr2").once("value", (snapshot) => { const data = snapshot.val(); if (data !== null) { @@ -7473,11 +7543,13 @@ if (pathName === "/search") { } } -document.getElementById("searchBar").addEventListener("keydown", (event) => { - if (event.key === "Enter") { - window.location.replace(`/search?q=${document.getElementById("searchBar").value}`); - } -}); +if (document.getElementById("searchBar")) { + document.getElementById("searchBar").addEventListener("keydown", (event) => { + if (event.key === "Enter") { + window.location.replace(`/search?q=${document.getElementById("searchBar").value}`); + } + }); +} // init stripe & allow users to create a subscription // also yes. this key is safe to have out. this wasn't an accident lol. (wait, you cant do that, it would violate our license) diff --git a/auth/policies.html b/auth/policies.html index fe72f70..c7abc95 100644 --- a/auth/policies.html +++ b/auth/policies.html @@ -100,7 +100,7 @@

Contact Us


- + diff --git a/auth/register.html b/auth/register.html index 9804a56..a42bcf6 100644 --- a/auth/register.html +++ b/auth/register.html @@ -35,6 +35,8 @@

Join TransSocial

Join a safe place for everyone! Already have an account?

+
You'll be returned to {link} after you create your account.
+

empty

diff --git a/updates.html b/updates.html index 3fb96b1..4200100 100644 --- a/updates.html +++ b/updates.html @@ -143,6 +143,15 @@

Trying to find older updates? You may be interested in the InDev tab, since TransSocial is no longer in InDev!

+
+

v2024.10.14_pre-alpha

+

Released: October 14, 2024

+
  • Started allowing redirection to other Katniny websites
  • +
  • Fixed not being able to progress past the policies page during registration
  • +
    + +
    +

    v2024.10.7_pre-alpha

    Released: October 7, 2024