Merge branch 'boot-improvements' into 'develop'

Boot speed improvements

See merge request pleroma/pleroma-fe!2060
This commit is contained in:
HJ 2025-02-26 02:01:00 +00:00
commit c2d2ec7e18
7 changed files with 21 additions and 12 deletions

View file

@ -0,0 +1 @@
Speed up initial boot.

View file

@ -3,6 +3,11 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
<link rel="preload" href="/static/config.json" as="fetch" crossorigin />
<link rel="preload" href="/api/pleroma/frontend_configurations" as="fetch" crossorigin />
<link rel="preload" href="/nodeinfo/2.1.json" as="fetch" crossorigin />
<link rel="preload" href="/api/v1/instance" as="fetch" crossorigin />
<link rel="preload" href="/static/pleromatan_apology_fox_small.webp" as="image" />
<!-- putting styles here to avoid having to wait for styles to load up -->
<style id="splashscreen">
#splash {
@ -148,7 +153,7 @@
<div class="chunk" id="chunk-E">
</div>
</div>
<img id="mascot" src="/static/pleromatan_apology.png">
<img id="mascot" src="/static/pleromatan_apology_small.webp">
</div>
<div id="status" class="css-ok">
<!-- (。><) -->

View file

@ -931,7 +931,7 @@ option {
#splash {
pointer-events: none;
transition: opacity 2s;
transition: opacity 0.5s;
opacity: 1;
&.hidden {
@ -960,7 +960,7 @@ option {
&.dead {
animation-name: dead;
animation-duration: 2s;
animation-duration: 0.5s;
animation-iteration-count: 1;
transform: rotateX(90deg) rotateY(0) rotateZ(-45deg);
}

View file

@ -230,12 +230,16 @@ const getStickers = async ({ store }) => {
const getAppSecret = async ({ store }) => {
const { state, commit } = store
const { oauth, instance } = state
return getOrCreateApp({ ...oauth, instance: instance.server, commit })
.then((app) => getClientToken({ ...app, instance: instance.server }))
.then((token) => {
commit('setAppToken', token.access_token)
commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
})
if (oauth.userToken) {
commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
} else {
return getOrCreateApp({ ...oauth, instance: instance.server, commit })
.then((app) => getClientToken({ ...app, instance: instance.server }))
.then((token) => {
commit('setAppToken', token.access_token)
commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
})
}
}
const resolveStaffAccounts = ({ store, accounts }) => {
@ -377,10 +381,9 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
getInstanceConfig({ store })
]).catch(e => Promise.reject(e))
await store.dispatch('loadDrafts')
// Start fetching things that don't need to block the UI
store.dispatch('fetchMutes')
store.dispatch('loadDrafts')
useAnnouncementsStore().startFetchingAnnouncements()
getTOS({ store })
getStickers({ store })

View file

@ -85,7 +85,7 @@ const persistedStateOptions = {
console.error('Storage error', e)
storageError = e
}
document.querySelector('#mascot').src = `/static/pleromatan_apology${isFox}.png`
document.querySelector('#mascot').src = `/static/pleromatan_apology${isFox}_small.webp`
document.querySelector('#status').removeAttribute('class')
document.querySelector('#status').textContent = i18n.global.t('splash.loading')
document.querySelector('#splash-credit').textContent = i18n.global.t('update.art_by', { linkToArtist: 'pipivovott' })

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB