logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/
commit: c2d2ec7e18c6fe7f130921788651de5011b6a195
parent 9e2086edaf08bd9a2b8adf0cf308c131a2a5ecc6
Author: HJ <30-hj@users.noreply.git.pleroma.social>
Date:   Wed, 26 Feb 2025 02:01:00 +0000

Merge branch 'boot-improvements' into 'develop'

Boot speed improvements

See merge request pleroma/pleroma-fe!2060

Diffstat:

Achangelog.d/boot-improvements.change1+
Mindex.html7++++++-
Msrc/App.scss4++--
Msrc/boot/after_store.js19+++++++++++--------
Msrc/main.js2+-
Astatic/pleromatan_apology_fox_small.webp0
Astatic/pleromatan_apology_small.webp0
7 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/changelog.d/boot-improvements.change b/changelog.d/boot-improvements.change @@ -0,0 +1 @@ +Speed up initial boot. diff --git a/index.html b/index.html @@ -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"> <!-- (。>﹏<) --> diff --git a/src/App.scss b/src/App.scss @@ -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); } diff --git a/src/boot/after_store.js b/src/boot/after_store.js @@ -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 }) diff --git a/src/main.js b/src/main.js @@ -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' }) diff --git a/static/pleromatan_apology_fox_small.webp b/static/pleromatan_apology_fox_small.webp Binary files differ. diff --git a/static/pleromatan_apology_small.webp b/static/pleromatan_apology_small.webp Binary files differ.