diff --git a/src/Login.ts b/src/Login.ts
index d75e18ab4..ad4e0ed65 100644
--- a/src/Login.ts
+++ b/src/Login.ts
@@ -1,6 +1,8 @@
+import i18next from 'i18next'
import { DOMCacheGetOrSet } from './Cache/DOM'
import { QuarkHandler } from './Quark'
import { player } from './Synergism'
+import { Alert } from './UpdateHTML'
// Consts for Patreon Supporter Roles.
const TRANSCENDED_BALLER = '756419583941804072'
@@ -80,7 +82,7 @@ export async function handleLogin () {
currentBonus.textContent +=
` You also receive an extra ${personalBonus}% bonus for being a Patreon member and/or boosting the Discord server! Multiplicative with global bonus!`
- const user = member?.user?.username ?? 'player'
+ const user = member?.nick ?? member?.user?.username ?? member?.user?.global_name
const boosted = Boolean(member?.premium_since)
const hasTier1 = member?.roles.includes(TRANSCENDED_BALLER) ?? false
const hasTier2 = member?.roles.includes(REINCARNATED_BALLER) ?? false
@@ -93,37 +95,35 @@ export async function handleLogin () {
const exMark = '[✖] {+0%}'
- subtabElement.innerHTML = `Hello, ${user}!\n
- Your personal Quark bonus is ${personalBonus}%, computed by the following:
- Transcended Baller [+2%] - ${
- hasTier1 ? checkMark(2) : exMark
- }
- Reincarnated Baller [+3%] - ${
- hasTier2 ? checkMark(3) : exMark
- }
- ASCENDED Baller [+4%] - ${
- hasTier3 ? checkMark(4) : exMark
- }
- OMEGA Baller [+5%] - ${
- hasTier4 ? checkMark(5) : exMark
- }
- Discord Server Booster [+1%] - ${
- boosted ? checkMark(1) : exMark
- }
- And Finally...
- Being YOURSELF! [+1%] - ${
+ subtabElement.innerHTML = `
+ ${user ? `Hello, ${user}` : 'Hello'}!\n
+ Your personal Quark bonus is ${personalBonus}%, computed by the following:
+ Transcended Baller [+2%] - ${hasTier1 ? checkMark(2) : exMark}
+ Reincarnated Baller [+3%] - ${hasTier2 ? checkMark(3) : exMark}
+ ASCENDED Baller [+4%] - ${hasTier3 ? checkMark(4) : exMark}
+ OMEGA Baller [+5%] - ${hasTier4 ? checkMark(5) : exMark}
+ Discord Server Booster [+1%] - ${boosted ? checkMark(1) : exMark}
+ And Finally...
+ Being YOURSELF! [+1%] - ${
checkMark(1)
}
- The current maximum is 16%, by being a Discord server booster and an OMEGA Baller on Patreon!
-
- More will be incorporated both for general accounts and supporters of the game shortly.
- Become a supporter of development via the link below, and get special bonuses,
- while also improving the Global Bonus for all to enjoy!
-
- --> PATREON <--
-
- `
+ The current maximum is 16%, by being a Discord server booster and an OMEGA Baller on Patreon!
+
+ More will be incorporated both for general accounts and supporters of the game shortly.
+ Become a supporter of development via the link below, and get special bonuses,
+ while also improving the Global Bonus for all to enjoy!
+
+ --> PATREON <--
+
+ `.trim()
+
+ const logoutElement = document.createElement('button')
+ logoutElement.addEventListener('click', logout, { once: true })
+ logoutElement.style.cssText = 'border: 2px solid #5865F2; height: 25px; width: 150px;'
+ logoutElement.textContent = 'Log Out'
+
+ subtabElement.appendChild(logoutElement)
} else {
// User is not logged in
subtabElement.innerHTML = `
@@ -140,3 +140,15 @@ export async function handleLogin () {
`
}
}
+
+async function logout () {
+ if ('cookieStore' in window) {
+ await (window.cookieStore as { delete: (id: string) => Promise }).delete('id')
+ } else {
+ document.cookie = 'id=; Max-Age=0'
+ }
+
+ await Alert(i18next.t('account.logout'))
+
+ location.reload()
+}
diff --git a/translations/en.json b/translations/en.json
index 92fa06dfb..373314c30 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -3453,5 +3453,8 @@
"clicked": "See? Yet another reason to trust Unsmith. Ah well. For clicking me, you gain 5% more Offerings, Obtainium, and ALL Cubes until you refresh the page!",
"clickedText": "You have clicked the <>! Until refresh, gain <>, <>, <>!"
}
+ },
+ "account": {
+ "logout": "The page will now reload. You are logged out! Goodbye!!"
}
}
diff --git a/translations/source.json b/translations/source.json
index e1476f80c..cc46aa033 100644
--- a/translations/source.json
+++ b/translations/source.json
@@ -3438,5 +3438,8 @@
"clicked": "See? Yet another reason to trust Unsmith. Ah well. For clicking me, you gain 5% more Offerings, Obtainium, and ALL Cubes until you refresh the page!",
"clickedText": "You have clicked the <>! Until refresh, gain <>, <>, <>!"
}
+ },
+ "account": {
+ "logout": "The page will now reload. You are logged out! Goodbye!!"
}
}