logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 6ea69eb51a480e3ab81a69b99f92165fc97f8177
parent af236d71f0d5d75c179ddb97b763ba319f196f27
Author: Henry Jameson <me@hjkos.com>
Date:   Wed, 24 Apr 2024 15:09:52 +0300

checksum -> engineChecksum for clarity

Diffstat:

Msrc/services/style_setter/style_setter.js8++++----
Msrc/services/theme_data/theme_data_3.service.js6+++---
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js @@ -1,6 +1,6 @@ import { hex2rgb } from '../color_convert/color_convert.js' import { generatePreset } from '../theme_data/theme_data.service.js' -import { init, getChecksum } from '../theme_data/theme_data_3.service.js' +import { init, getEngineChecksum } from '../theme_data/theme_data_3.service.js' import { convertTheme2To3 } from '../theme_data/theme2_to_theme3.js' import { getCssRules } from '../theme_data/css_utils.js' import { defaultState } from '../../modules/config.js' @@ -97,7 +97,7 @@ export const tryLoadCache = () => { console.error('Failed to decode theme cache:', e) return false } - if (cache.checksum === getChecksum()) { + if (cache.engineChecksum === getEngineChecksum()) { const styleSheet = new CSSStyleSheet() const lazyStyleSheet = new CSSStyleSheet() @@ -108,7 +108,7 @@ export const tryLoadCache = () => { return true } else { - console.warn('Checksum doesn\'t match, cache not usable, clearing') + console.warn('Engine checksum doesn\'t match, cache not usable, clearing') localStorage.removeItem('pleroma-fe-theme-cache') } } @@ -136,7 +136,7 @@ export const applyTheme = async (input, onFinish = (data) => {}) => { }, onLazyFinished () { document.adoptedStyleSheets = [styleSheet, lazyStyleSheet] - const cache = { checksum: getChecksum(), data: [styleArray, lazyStyleArray] } + const cache = { engineChecksum: getEngineChecksum(), data: [styleArray, lazyStyleArray] } onFinish(cache) localStorage.setItem('pleroma-fe-theme-cache', JSON.stringify(cache)) } diff --git a/src/services/theme_data/theme_data_3.service.js b/src/services/theme_data/theme_data_3.service.js @@ -143,11 +143,11 @@ componentsContext.keys().forEach(key => { components[component.name] = component }) -const checksum = sum(components) +const engineChecksum = sum(components) const ruleToSelector = genericRuleToSelector(components) -export const getChecksum = () => checksum +export const getEngineChecksum = () => engineChecksum export const init = (extraRuleset, ultimateBackgroundColor) => { const staticVars = {} @@ -469,6 +469,6 @@ export const init = (extraRuleset, ultimateBackgroundColor) => { lazy: result.filter(x => typeof x === 'function'), eager: result.filter(x => typeof x !== 'function'), staticVars, - checksum + engineChecksum } }