mirror of
https://github.com/revanced/revanced-website.git
synced 2025-05-14 12:57:04 +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 submit = false;
|
||||||
let submitted = false;
|
let submitted = false;
|
||||||
let erred = false;
|
let erred = false;
|
||||||
|
let botToken: string;
|
||||||
$: finalPage = currentPage >= logoPages;
|
$: finalPage = currentPage >= logoPages;
|
||||||
$: min = currentPage * logoAmount;
|
$: min = currentPage * logoAmount;
|
||||||
$: max = min + logoAmount;
|
$: max = min + logoAmount;
|
||||||
@ -62,13 +63,9 @@
|
|||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await goto('/poll/token-expired/');
|
await goto('/poll/token-expired/');
|
||||||
localStorage.setItem('expired-token', token);
|
localStorage.setItem('expired-token', botToken);
|
||||||
}, 300000);
|
}, 300000);
|
||||||
|
|
||||||
if (localStorage.getItem('expired-token') === token) {
|
|
||||||
await goto('/poll/token-expired/');
|
|
||||||
}
|
|
||||||
|
|
||||||
window.use_token = exchange_token;
|
window.use_token = exchange_token;
|
||||||
window.submit_poll = submitBallot;
|
window.submit_poll = submitBallot;
|
||||||
|
|
||||||
@ -96,16 +93,21 @@
|
|||||||
logos = logos;
|
logos = logos;
|
||||||
|
|
||||||
if (location.hash !== '') {
|
if (location.hash !== '') {
|
||||||
|
botToken = location.hash.substring(1)
|
||||||
try {
|
try {
|
||||||
await exchange_token(location.hash.substring(1));
|
await exchange_token(location.hash.substring(1));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
alert(`Could not exchange the token: ${err}`);
|
console.log(`Could not exchange the token: ${err}`);
|
||||||
}
|
}
|
||||||
} else if (!dev) {
|
} else if (!dev) {
|
||||||
await goto('/poll/unauthorized/');
|
await goto('/poll/unauthorized/');
|
||||||
} else {
|
} else {
|
||||||
alert('Warning: no token!');
|
alert('Warning: no token!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (localStorage.getItem('expired-token') === botToken) {
|
||||||
|
await goto('/poll/token-expired/');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function preloadImage(url: string) {
|
function preloadImage(url: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user