mirror of
https://github.com/revanced/revanced-website.git
synced 2025-05-11 20:04:25 +02:00
fix: store bot token in local storage
This commit is contained in:
parent
5e97f5772b
commit
c16c89e1cc
@ -32,6 +32,7 @@
|
||||
let submit = false;
|
||||
let submitted = false;
|
||||
let erred = false;
|
||||
let botToken: string;
|
||||
$: finalPage = currentPage >= logoPages;
|
||||
$: min = currentPage * logoAmount;
|
||||
$: max = min + logoAmount;
|
||||
@ -62,13 +63,9 @@
|
||||
onMount(async () => {
|
||||
setTimeout(async () => {
|
||||
await goto('/poll/token-expired/');
|
||||
localStorage.setItem('expired-token', token);
|
||||
localStorage.setItem('expired-token', botToken);
|
||||
}, 300000);
|
||||
|
||||
if (localStorage.getItem('expired-token') === token) {
|
||||
await goto('/poll/token-expired/');
|
||||
}
|
||||
|
||||
window.use_token = exchange_token;
|
||||
window.submit_poll = submitBallot;
|
||||
|
||||
@ -96,16 +93,21 @@
|
||||
logos = logos;
|
||||
|
||||
if (location.hash !== '') {
|
||||
botToken = location.hash.substring(1)
|
||||
try {
|
||||
await exchange_token(location.hash.substring(1));
|
||||
} catch (err) {
|
||||
alert(`Could not exchange the token: ${err}`);
|
||||
console.log(`Could not exchange the token: ${err}`);
|
||||
}
|
||||
} else if (!dev) {
|
||||
await goto('/poll/unauthorized/');
|
||||
} else {
|
||||
alert('Warning: no token!');
|
||||
}
|
||||
|
||||
if (localStorage.getItem('expired-token') === botToken) {
|
||||
await goto('/poll/token-expired/');
|
||||
}
|
||||
});
|
||||
|
||||
function preloadImage(url: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user