mirror of
https://github.com/ReVanced/revanced-website.git
synced 2026-01-11 13:46:17 +00:00
fix: Prevent FOUC and repetitive setting of about info
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
%sveltekit.head%
|
%sveltekit.head%
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body style="background-color: var(--background-one)">
|
||||||
<div style="display: contents">%sveltekit.body%</div>
|
<div style="display: contents">%sveltekit.body%</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ html {
|
|||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background-color: var(--background-one);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ export function api_base_url(): string {
|
|||||||
if (browser) {
|
if (browser) {
|
||||||
const apiUrl = localStorage.getItem(URL_KEY) || default_api_url;
|
const apiUrl = localStorage.getItem(URL_KEY) || default_api_url;
|
||||||
|
|
||||||
set_about_info(apiUrl);
|
|
||||||
|
|
||||||
return apiUrl;
|
return apiUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,11 +44,11 @@ export function set_api_base_url(url?: string) {
|
|||||||
localStorage.removeItem(URL_KEY);
|
localStorage.removeItem(URL_KEY);
|
||||||
} else {
|
} else {
|
||||||
localStorage.setItem(URL_KEY, url);
|
localStorage.setItem(URL_KEY, url);
|
||||||
set_about_info(url);
|
|
||||||
}
|
}
|
||||||
|
set_about_info(api_base_url());
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_about_info(apiUrl: string) {
|
export function set_about_info(apiUrl: string) {
|
||||||
if (!localStorage.getItem(STATUS_KEY) || !localStorage.getItem(EMAIL_KEY)) {
|
if (!localStorage.getItem(STATUS_KEY) || !localStorage.getItem(EMAIL_KEY)) {
|
||||||
fetch(`${apiUrl}/v4/about`)
|
fetch(`${apiUrl}/v4/about`)
|
||||||
.then((response) => (response.ok ? response.json() : null))
|
.then((response) => (response.ok ? response.json() : null))
|
||||||
|
|||||||
@@ -78,7 +78,6 @@
|
|||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
footer {
|
footer {
|
||||||
background-color: var(--background-one);
|
|
||||||
max-width: min(87%, 100rem);
|
max-width: min(87%, 100rem);
|
||||||
padding: 5rem 0rem;
|
padding: 5rem 0rem;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
import { events as themeEvents } from '$util/themeEvents';
|
import { events as themeEvents } from '$util/themeEvents';
|
||||||
|
|
||||||
import FooterHost from '$layout/Footer/FooterHost.svelte';
|
import FooterHost from '$layout/Footer/FooterHost.svelte';
|
||||||
|
import { api_base_url, set_about_info } from '$data/api/settings';
|
||||||
|
|
||||||
const queryClient = new QueryClient({
|
const queryClient = new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
set_about_info(api_base_url());
|
||||||
new DateTriggerEventHandler(themeEvents);
|
new DateTriggerEventHandler(themeEvents);
|
||||||
|
|
||||||
isRestoring.set(true);
|
isRestoring.set(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user